diff --git a/coffee/levels.coffee b/coffee/levels.coffee index 5b4e05d..6cea703 100644 --- a/coffee/levels.coffee +++ b/coffee/levels.coffee @@ -10,6 +10,7 @@ class Levels @dict = {} @list = [ # "test", + "electro", # --- introduction "steps", "start", diff --git a/coffee/levels/blocks.coffee b/coffee/levels/blocks.coffee index 33b6f25..b98caf1 100644 --- a/coffee/levels/blocks.coffee +++ b/coffee/levels/blocks.coffee @@ -1,4 +1,10 @@ +# 0000000 000 0000000 0000000 000 000 0000000 +# 000 000 000 000 000 000 000 000 000 +# 0000000 000 000 000 000 0000000 0000000 +# 000 000 000 000 000 000 000 000 000 +# 0000000 0000000 0000000 0000000 000 000 0000000 + module.exports = name: "blocks" design: 'Michael Abel' @@ -17,18 +23,18 @@ module.exports = player: coordinates: [1,6,2] exits: [ - name: "exit" - active: 1 - coordinates: [7,9,2] - ] + name: "exit" + active: 1 + coordinates: [7,9,2] + ] create: -> {Stone} = require '../items' world.addObjectAtPos 'Wall', 1,1,2 world.addObjectAtPos 'Wall', 4,2,2 world.addObjectAtPos 'Wall', 7,2,2 world.addObjectAtPos 'Stone', 10,2,2 - world.addObjectAtPos new Stone(slippery:true), 13,2,2 - world.addObjectAtPos new Stone(slippery:true), 15,4,2 + world.addObjectAtPos new Stone(slippery: true), 13,2,2 + world.addObjectAtPos new Stone(slippery: true), 15,4,2 world.addObjectAtPos new Stone(color: [0,1,0], opacity: 0.8, slippery: true), 13,7,2 world.addObjectAtPos new Stone(color: [1,0,0], opacity: 0.8, slippery: true), 10,7,2 diff --git a/coffee/light.coffee b/coffee/light.coffee index 9f64ccc..82f5cd8 100644 --- a/coffee/light.coffee +++ b/coffee/light.coffee @@ -13,26 +13,23 @@ class Light extends Item @radius = opt?.radius ? 4 @shadow = opt?.shadow ? false @intensity = opt?.intensity ? 0.5 - # @ambient_color = colors[KikiLight_base_color] - # @diffuse_color = colors[KikiLight_diffuse_color] - # @specular_color = colors[KikiLight_specular_color] + world.addLight @ + super + @setPosition opt.pos if opt?.pos? + + createMesh: -> @point = new THREE.PointLight 0xffffff, @intensity, @radius, 2 @point.castShadow = @shadow @point.shadow.darkness = 0.5 @point.shadow.mapSize = new THREE.Vector2 2048, 2048 @point.shadow.bias = 0.01 geom = new THREE.SphereGeometry 0.3, 16, 16 - # world.scene.add new THREE.CameraHelper @point.shadow.camera if @shadow - @point.shadow.camera.near = 0.1 @point.shadow.camera.far = @radius*2 @mesh = new THREE.Mesh geom, Material.bulb world.scene.add @point - world.addLight @ - @setPosition opt.pos if opt?.pos? - super del: -> world.removeLight @ diff --git a/coffee/material.coffee b/coffee/material.coffee index 2a8ba06..9581a13 100644 --- a/coffee/material.coffee +++ b/coffee/material.coffee @@ -12,8 +12,14 @@ module.exports = color: 0xffff00 id: 999 + bulb: new THREE.MeshLambertMaterial + side: THREE.FrontSide + shading: THREE.SmoothShading + transparent: true + opacity: 0.7 + emissiveIntensity: 0.9 + player: new THREE.MeshPhongMaterial - color: 0x2222ff side: THREE.FrontSide shading: THREE.SmoothShading transparent: true @@ -21,8 +27,6 @@ module.exports = shininess: 5 tire: new THREE.MeshPhongMaterial - color: 0x000066 - # specular: 0x222255 side: THREE.FrontSide shading: THREE.FlatShading transparent: true @@ -72,15 +76,6 @@ module.exports = shading: THREE.SmoothShading shininess: 10 - bulb: new THREE.MeshLambertMaterial - color: 0xffffff - side: THREE.FrontSide - shading: THREE.SmoothShading - transparent: true - opacity: 0.7 - emissive: 0xffff00 - emissiveIntensity: 0.9 - bomb: new THREE.MeshPhongMaterial color: 0xff0000 side: THREE.FrontSide @@ -102,24 +97,21 @@ module.exports = shininess: 5 raster: new THREE.MeshPhongMaterial - color: 0x880000 side: THREE.FrontSide shading: THREE.SmoothShading shininess: 20 wall: new THREE.MeshPhongMaterial - color: 0x770000 + # color: 0x770000 side: THREE.FrontSide shading: THREE.SmoothShading - shininess: 10 + shininess: 20 plate: new THREE.MeshPhongMaterial - color: 0x880000 side: THREE.FrontSide shading: THREE.SmoothShading shininess: 10 - emissive: 0x880000 - emissiveIntensity: 0.02 + emissiveIntensity: 0.05 stone: new THREE.MeshPhongMaterial side: THREE.DoubleSide diff --git a/coffee/scheme.coffee b/coffee/scheme.coffee index 7969730..e54c5ec 100644 --- a/coffee/scheme.coffee +++ b/coffee/scheme.coffee @@ -5,6 +5,8 @@ # 000 000 000 000 000 000 0 000 000 # 0000000 0000000 000 000 00000000 000 000 00000000 +rgb = (r,g,b) -> new THREE.Color r,g,b + module.exports = # 0000000 00000000 00000000 0000000 000 000 000 000000000 @@ -14,42 +16,39 @@ module.exports = # 0000000 00000000 000 000 000 0000000 0000000 000 default: - raster: - color: [0.5, 0, 0] plate: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 wall: - color: [0.4, 0, 0] - bulb: - color: [1, 1, 0] - bomb: - color: [0.5, 0, 0] + specular: rgb 0.16, 0, 0 stone: - color: [0.5, 0.5, 0.5] - switch: - color: [0, 0, 0.5] - gate: - color: [1, 0.5, 0] + color: rgb 0.8, 0.5, 0 + bomb: + color: rgb 0.5, 0, 0 + bulb: + color: rgb 1, 0.6, 0 player: - color: [0.8, 0.4, 0] + color: rgb 0x2222ff tire: - color: [0.4, 0, 0] + color: rgb 0x000066 + specular: rgb 0x222255 + switch: + color: rgb 0, 0, 0.5 + gate: + color: rgb 1, 0.5, 0 mutant: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 mutantTire: - color: [0, 0, 0.2] + color: rgb 0, 0, 0.2 text: - color: [0.8, 0.8, 0] - bright: [1, 1, 0] - dark: [0.6, 0.4, 0] + color: rgb 0.8, 0.8, 0 + bright: rgb 1, 1, 0 + dark: rgb 0.6, 0.4, 0 gear: - color: [0.1, 0.1, 0.9] - valve: - color: [0, 0, 0.5] + color: rgb 0.1, 0.1, 0.9 wire: - color: [0.1, 0.1, 0.9] + color: rgb 0.1, 0.1, 0.9 glow: - color: [1, 1, 0] + color: rgb 1, 1, 0 # 000000000 00000000 0000000 000 000 # 000 000 000 000 000 0000 000 @@ -58,41 +57,38 @@ module.exports = # 000 000 000 0000000 000 000 tron: - raster: - color: [0, 0, 0.3] plate: - color: [0.05, 0.05] - opacity: 0.2 + color: rgb 0.05, 0.05, 0.2 + # raster: + # color: rgb 0, 0, 0.3 bulb: - color: [0, 0, 1] + color: rgb 0, 0, 1 bomb: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 stone: - color: [0, 0, 1] + color: rgb 0, 0, 1 switch: - color: [0, 0, 0.5] + color: rgb 0, 0, 0.5 gate: - color: [1, 1, 0] + color: rgb 1, 1, 0 player: - color: [0.5, 0.5, 0.5] + color: rgb 0.5, 0.5, 0.5 tire: - color: [0, 0, 0.5] + color: rgb 0, 0, 0.5 mutant: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 mutantTire: - color: [0, 0, 0.2] + color: rgb 0, 0, 0.2 text: - color: [0.8, 0.8, 0] - bright: [1, 1, 0] - dark: [0.6, 0.4, 0] + color: rgb 0.8, 0.8, 0 + bright: rgb 1, 1, 0 + dark: rgb 0.6, 0.4, 0 gear: - color: [0.1, 0.1, 0.9] - valve: - color: [0, 0, 0.5] + color: rgb 0.1, 0.1, 0.9 wire: - color: [0.1, 0.1, 0.9] + color: rgb 0.1, 0.1, 0.9 glow: - color: [1, 1, 0] + color: rgb 1, 1, 0 # 000 000 00000000 000 000 000000000 00000000 0000000 000 000 # 0000 000 000 000 000 000 000 000 000 000 0000 000 @@ -101,41 +97,39 @@ module.exports = # 000 000 00000000 0000000 000 000 000 0000000 000 000 neutron: - raster: - color: [0.13, 0.13, 0.13] plate: - color: [0.5, 0.5, 0.5] + color: rgb 0.5, 0.5, 0.5 + # raster: + # color: rgb 0.13, 0.13, 0.13 bulb: - color: [0, 0, 0] + color: rgb 0, 0, 0 bomb: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 stone: - color: [0.5, 0.5, 0.5] + color: rgb 0.5, 0.5, 0.5 opacity: 0.5 switch: - color: [0, 0, 0.5] + color: rgb 0, 0, 0.5 gate: - color: [1, 1, 0] + color: rgb 1, 1, 0 player: - color: [1, 0.5, 0] + color: rgb 1, 0.5, 0 tire: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 mutant: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 mutantTire: - color: [0, 0, 0.2] + color: rgb 0, 0, 0.2 text: - color: [0.8, 0.8, 0] - bright: [1, 1, 0] - dark: [0.6, 0.4, 0] + color: rgb 0.8, 0.8, 0 + bright: rgb 1, 1, 0 + dark: rgb 0.6, 0.4, 0 gear: - color: [1, 0, 0] - valve: - color: [0.7, 0, 0] + color: rgb 1, 0, 0 wire: - color: [0.1, 0.1, 0.9] + color: rgb 0.1, 0.1, 0.9 glow: - color: [1, 1, 0] + color: rgb 1, 1, 0 # 000000000 00000000 0000000 000000000 # 000 000 000 000 @@ -144,41 +138,39 @@ module.exports = # 000 00000000 0000000 000 test: - raster: - color: [1, 1, 1] plate: - color: [0.08, 0.08, 0.08] + color: rgb 0.08, 0.08, 0.08 + # raster: + # color: rgb 1, 1, 1 bulb: - color: [0, 0, 0] + color: rgb 0, 0, 0 bomb: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 stone: - color: [0.5, 0.5, 0.5] + color: rgb 0.5, 0.5, 0.5 opacity: 0.5 switch: - color: [0, 0, 0.5, 0.8] + color: rgb 0, 0, 0.5, 0.8 gate: - color: [1, 1, 0, 0.8] + color: rgb 1, 1, 0, 0.8 player: - color: [1, 0.5, 0] + color: rgb 1, 0.5, 0 tire: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 mutant: - color: [1, 0.5, 0] + color: rgb 1, 0.5, 0 mutantTire: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 text: - color: [0.8, 0.8, 0] - bright: [1, 1, 0] - dark: [0.6, 0.4, 0] + color: rgb 0.8, 0.8, 0 + bright: rgb 1, 1, 0 + dark: rgb 0.6, 0.4, 0 gear: - color: [0.1, 0.1, 0.9] - valve: - color: [0, 0, 0.5] + color: rgb 0.1, 0.1, 0.9 wire: - color: [0.1, 0.1, 0.9] + color: rgb 0.1, 0.1, 0.9 glow: - color: [1, 1, 0] + color: rgb 1, 1, 0 # 0000000 0000000 000 000 0000000 000 000 # 000 000 000 0000 000 000 000 000 000 @@ -187,41 +179,39 @@ module.exports = # 0000000 000 000 000 000 0000000 000 candy: - raster: - color: [0.35, 0, 0.35] plate: - color: [0.8, 0, 0.9] + color: rgb 0.8, 0, 0.9 + # raster: + # color: rgb 0.35, 0, 0.35 bulb: - color: [0, 0, 0] + color: rgb 0, 0, 0 text: - color: [0.7, 0, 0.7] - bright: [1, 0, 1] - dark: [0.4, 0, 0.4] + color: rgb 0.7, 0, 0.7 + bright: rgb 1, 0, 1 + dark: rgb 0.4, 0, 0.4 bomb: - color: [0.73, 0, 0.75] + color: rgb 0.73, 0, 0.75 stone: - color: [0.85, 0, 0.95] + color: rgb 0.85, 0, 0.95 opacity: 0.6 switch: - color: [0.3, 0, 0.3] + color: rgb 0.3, 0, 0.3 gate: - color: [1, 0, 1, 0.8] + color: rgb 1, 0, 1, 0.8 player: - color: [0.7, 0, 0.7] + color: rgb 0.7, 0, 0.7 tire: - color: [0.3, 0, 0.3] + color: rgb 0.3, 0, 0.3 mutant: - color: [0.3, 0, 0.3] + color: rgb 0.3, 0, 0.3 mutantTire: - color: [0.7, 0, 0.7] - valve: - color: [0.5, 0, 0.5] + color: rgb 0.7, 0, 0.7 gear: - color: [0.7, 0, 0.7] + color: rgb 0.7, 0, 0.7 wire: - color: [1, 0, 1] + color: rgb 1, 0, 1 glow: - color: [1, 1, 0] + color: rgb 1, 1, 0 # 0000000 00000000 0000000 000 000 0000000 00000000 # 000 000 000 000 000 000 0000 000 000 000 @@ -230,41 +220,38 @@ module.exports = # 0000000 000 000 0000000 000 000 0000000 00000000 bronze: - raster: - color: [0.25, 0.15, 0.05] plate: - color: [0.8, 0.6, 0.2] + color: rgb 0.8, 0.6, 0.2 bulb: - color: [0.1, 0.1, 0] + color: rgb 1,1,1 + emissive: rgb 1,1,0 stone: - color: [1, 0.8, 0.4] + color: rgb 1, 0.8, 0.4 opacity: 0.8 switch: - color: [0.9, 0.7, 0.1] + color: rgb 0.9, 0.7, 0.1 gate: - color: [0.9, 0.7, 0.1] + color: rgb 0.9, 0.7, 0.1 player: - color: [0.8, 0.6, 0.3] + color: rgb 0.8, 0.6, 0.3 tire: - color: [0.5, 0.2, 0.1] + color: rgb 0.5, 0.2, 0.1 mutant: - color: [0.5, 0.2, 0.1] + color: rgb 0.5, 0.2, 0.1 mutantTire: - color: [0.3, 0.1, 0] + color: rgb 0.3, 0.1, 0 gear: - color: [0.7, 0.4, 0.1] - valve: - color: [0.5, 0.2, 0.1] + color: rgb 0.7, 0.4, 0.1 wire: - color: [0.7, 0.5, 0.3] + color: rgb 0.6, 0, 0 glow: - color: [1, 1, 0] + color: rgb 1, 1, 0 bomb: - color: [0.9, 0.7, 0.1] + color: rgb 0.9, 0.7, 0.1 text: - color: [0.7, 0.5, 0.1] - bright: [0.9, 0.7, 0.15] - dark: [0.6, 0.4, 0] + color: rgb 0.7, 0.5, 0.1 + bright: rgb 0.9, 0.7, 0.15 + dark: rgb 0.6, 0.4, 0 # 00000000 00000000 0000000 # 000 000 000 000 000 @@ -273,39 +260,37 @@ module.exports = # 000 000 00000000 0000000 red: - raster: - color: [0.2, 0, 0] plate: - color: [0.3, 0, 0] + color: rgb 0.3, 0, 0 + wall: + color: rgb 0.2, 0, 0 bulb: - color: [0.1, 0.1, 0.1] + color: rgb 0.8, 0, 0 bomb: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 stone: - color: [0.5, 0, 0] - opacity: 0.6 + color: rgb 0.5, 0, 0 + opacity: 0.6 switch: - color: [0.8, 0, 0] + color: rgb 0.6, 0, 0 gate: - color: [1, 0.2, 0] + color: rgb 1, 0.2, 0 player: - color: [0.7, 0, 0] + color: rgb 0.7, 0, 0 tire: - color: [0.3, 0, 0] + color: rgb 0.3, 0, 0 mutant: - color: [0.3, 0, 0] + color: rgb 0.3, 0, 0 mutantTire: - color: [0.7, 0, 0] - valve: - color: [0.5, 0.2, 0] + color: rgb 0.7, 0, 0 gear: - color: [1, 0.5, 0] + color: rgb 1, 0.5, 0 wire: - color: [0.5, 0, 0] + color: rgb 0.5, 0, 0 text: - color: [1, 0.5, 0] - bright: [1, 0.8, 0] - dark: [0.4, 0.2, 0] + color: rgb 1, 0.5, 0 + bright: rgb 1, 0.8, 0 + dark: rgb 0.4, 0.2, 0 # 0000000 000 000 000 00000000 # 000 000 000 000 000 000 @@ -314,42 +299,40 @@ module.exports = # 0000000 0000000 0000000 00000000 blue: - raster: - color: [0, 0, 0.2] plate: - color: [0.1, 0.1, 0.6] + color: rgb 0.1, 0.1, 0.6 + # raster: + # color: rgb 0, 0, 0.2 bulb: - color: [0.1, 0.1, 0.1] + color: rgb 0.1, 0.1, 0.1 stone: - color: [0, 0, 0.5] + color: rgb 0, 0, 0.5 opacity: 0.6 switch: - color: [0, 0, 0.6, 0.8] + color: rgb 0, 0, 0.6, 0.8 bomb: - color: [0.2, 0.2, 0.9] + color: rgb 0.2, 0.2, 0.9 opacity: 0.8 gate: - color: [0, 0.2, 1] + color: rgb 0, 0.2, 1 player: - color: [0, 0, 0.7] + color: rgb 0, 0, 0.7 tire: - color: [0, 0, 0.3] + color: rgb 0, 0, 0.3 mutant: - color: [0, 0, 0.3] + color: rgb 0, 0, 0.3 mutantTire: - color: [0, 0, 0.7] + color: rgb 0, 0, 0.7 text: - color: [0.2, 0.4, 0.8] - bright: [0.7, 0.8, 1] - dark: [0, 0, 0.6] + color: rgb 0.2, 0.4, 0.8 + bright: rgb 0.7, 0.8, 1 + dark: rgb 0, 0, 0.6 gear: - color: [0.1, 0.1, 0.9] - valve: - color: [0, 0, 0.5] + color: rgb 0.1, 0.1, 0.9 wire: - color: [0.1, 0.1, 0.9] + color: rgb 0.1, 0.1, 0.9 glow: - color: [1, 0.5, 0] + color: rgb 1, 0.5, 0 # 000 000 00000000 000 000 0000000 000 000 # 000 000 000 000 000 000 000 000 0 000 @@ -358,41 +341,39 @@ module.exports = # 000 00000000 0000000 0000000 0000000 00 00 yellow: - raster: - color: [0.34, 0.34, 0] plate: - color: [0.9, 0.9, 0] + color: rgb 0.9, 0.9, 0 + # raster: + # color: rgb 0.34, 0.34, 0 bulb: - color: [0, 0, 0] + color: rgb 0, 0, 0 bomb: - color: [0.75, 0.75, 0] + color: rgb 0.75, 0.75, 0 stone: - color: [0.8, 0.85, 0] + color: rgb 0.8, 0.85, 0 opacity: 0.6 switch: - color: [0.8, 0.8, 0] + color: rgb 0.8, 0.8, 0 gate: - color: [1, 1, 0, 0.8] + color: rgb 1, 1, 0, 0.8 player: - color: [0.7, 0.7, 0] + color: rgb 0.7, 0.7, 0 tire: - color: [0.3, 0.3, 0] + color: rgb 0.3, 0.3, 0 mutant: - color: [0.3, 0.3, 0] + color: rgb 0.3, 0.3, 0 mutantTire: - color: [0.7, 0.7, 0] - valve: - color: [0.5, 0.5, 0] + color: rgb 0.7, 0.7, 0 gear: - color: [0.7, 0.5, 0] + color: rgb 0.7, 0.5, 0 wire: - color: [1, 1, 0] + color: rgb 1, 1, 0 glow: - color: [0, 0, 1] + color: rgb 0, 0, 1 text: - color: [0.7, 0.7, 0] - bright: [1, 1, 0] - dark: [0.4, 0.4, 0] + color: rgb 0.7, 0.7, 0 + bright: rgb 1, 1, 0 + dark: rgb 0.4, 0.4, 0 # 0000000 00000000 00000000 00000000 000 000 # 000 000 000 000 000 0000 000 @@ -401,40 +382,38 @@ module.exports = # 0000000 000 000 00000000 00000000 000 000 green: - raster: - color: [0, 0.2, 0] plate: - color: [0.1, 0.6, 0.1] + color: rgb 0.1, 0.6, 0.1 + # raster: + # color: rgb 0, 0.2, 0 bulb: - color: [0, 0, 0] + color: rgb 0, 0, 0 stone: - color: [0, 0.5, 0] + color: rgb 0, 0.5, 0 switch: - color: [0, 0.6, 0] + color: rgb 0, 0.6, 0 bomb: - color: [0, 0.2, 0] + color: rgb 0, 0.2, 0 gate: - color: [0, 0.5, 0] + color: rgb 0, 0.5, 0 player: - color: [0, 0.7, 0] + color: rgb 0, 0.7, 0 tire: - color: [0, 0.3, 0] + color: rgb 0, 0.3, 0 mutant: - color: [0, 0.3, 0] + color: rgb 0, 0.3, 0 mutantTire: - color: [0, 0.7, 0] + color: rgb 0, 0.7, 0 text: - color: [0, 0.4, 0] - bright: [0, 0.6, 0] - dark: [0, 0.2, 0] + color: rgb 0, 0.4, 0 + bright: rgb 0, 0.6, 0 + dark: rgb 0, 0.2, 0 gear: - color: [0, 0.2, 0] - valve: - color: [0, 0.5, 0] + color: rgb 0, 0.2, 0 wire: - color: [0.1, 0.9, 0] + color: rgb 0.1, 0.9, 0 glow: - color: [1, 1, 1] + color: rgb 1, 1, 1 # 00 00 00000000 000000000 0000000 000 # 000 000 000 000 000 000 000 @@ -443,41 +422,39 @@ module.exports = # 000 000 00000000 000 000 000 0000000 metal: - raster: - color: [0.2, 0.2, 0.2] plate: - color: [1, 1, 1] + color: rgb 0.7,0.7,0.7 + # raster: + # color: rgb 0.2, 0.2, 0.2 bulb: - color: [0, 0, 0] + color: rgb 1, 1, 1 stone: - color: [1, 1, 1, 0.6] + color: rgb 1, 1, 1 + opacity: 0.6 switch: - color: [0.9, 1, 0.9] + color: rgb 0.9, 1, 0.9 gate: - color: [1, 1, 1, 0.8] + color: rgb 1, 1, 1, 0.8 player: - color: [0.6, 0.6, 0.6] + color: rgb 0.6, 0.6, 0.6 tire: - color: [0.3, 0.3, 0.3] + color: rgb 0.3, 0.3, 0.3 mutant: - color: [0.8, 0.8, 0.8] + color: rgb 0.8, 0.8, 0.8 mutantTire: - color: [0.7, 0.7, 0.7] + color: rgb 0.7, 0.7, 0.7 bomb: - color: [0.4, 0.4, 0.5] - opacity: 0.9 + color: rgb 0.4, 0.4, 0.5 gear: - color: [0.2, 0.4, 0.5] - valve: - color: [0.4, 0.4, 0.5] + color: rgb 0.2, 0.4, 0.5 wire: - color: [1, 1, 1, 0.9] + color: rgb 1, 1, 1 glow: - color: [0, 0, 1] + color: rgb 1, 1, 1 text: - color: [0.2, 0.4, 0.5] - bright: [0.3, 0.9, 1] - dark: [0.1, 0.3, 0.4] + color: rgb 0.2, 0.4, 0.5 + bright: rgb 0.3, 0.9, 1 + dark: rgb 0.1, 0.3, 0.4 # 0000000 00000000 0000000 0000000 000 000 # 000 000 000 000 000 000 000 000 @@ -486,42 +463,40 @@ module.exports = # 0000000 000 000 000 000 0000000 000 crazy: + # plate: + # color: rgb 0, 0.51, 0.82 raster: - color: [0.84, 0.22, 0.20] - plate: - color: [0, 0.51, 0.82] + color: rgb 0.84, 0.22, 0.20 bulb: - color: [0, 0, 0] + color: rgb 0, 0, 0 stone: - color: [1, 1, 1] + color: rgb 1, 1, 1 stone: 0.2 switch: - color: [0.9, 1, 0.9] + color: rgb 0.9, 1, 0.9 gate: - color: [1, 1, 1, 0.8] + color: rgb 1, 1, 1, 0.8 player: - color: [0.6, 0.6, 0.6] + color: rgb 0.6, 0.6, 0.6 tire: - color: [0.3, 0.3, 0.3] + color: rgb 0.3, 0.3, 0.3 mutant: - color: [0.8, 0.8, 0.8] + color: rgb 0.8, 0.8, 0.8 mutantTire: - color: [0.7, 0.7, 0.7] + color: rgb 0.7, 0.7, 0.7 bomb: - color: [0.4, 0.4, 0.5] + color: rgb 0.4, 0.4, 0.5 opacity: 0.2 gear: - color: [0.2, 0.4, 0.5] - valve: - color: [0.4, 0.4, 0.5] + color: rgb 0.2, 0.4, 0.5 wire: - color: [1, 1, 1] + color: rgb 1, 1, 1 glow: - color: [0, 0, 1] + color: rgb 0, 0, 1 text: - color: [0.2, 0.4, 0.5] - bright: [0.3, 0.9, 1] - dark: [0.1, 0.3, 0.4] + color: rgb 0.2, 0.4, 0.5 + bright: rgb 0.3, 0.9, 1 + dark: rgb 0.1, 0.3, 0.4 # 0000000 00000000 000 000 # 000 000 0000 000 @@ -530,41 +505,39 @@ module.exports = # 0000000 00000000 000 000 zen: - raster: - color: [0.75, 0.95, 0.64] plate: - color: [0.36, 0.45, 0.30] + color: rgb 0.36, 0.45, 0.30 + # raster: + # color: rgb 0.75, 0.95, 0.64 bulb: - color: [0, 0, 0] + color: rgb 0, 0, 0 stone: - color: [0.36, 0.45, 0.30] + color: rgb 0.36, 0.45, 0.30 opacity: 0.7 switch: - color: [0.9, 1, 0.9, 0.8] + color: rgb 0.9, 1, 0.9, 0.8 gate: - color: [1, 1, 1, 0.8] + color: rgb 1, 1, 1, 0.8 player: - color: [0.6, 0.6, 0.6] + color: rgb 0.6, 0.6, 0.6 tire: - color: [0.3, 0.3, 0.3] + color: rgb 0.3, 0.3, 0.3 mutant: - color: [0.8, 0.8, 0.8] + color: rgb 0.8, 0.8, 0.8 mutantTire: - color: [0.7, 0.7, 0.7] + color: rgb 0.7, 0.7, 0.7 bomb: - color: [0.4, 0.4, 0.5] + color: rgb 0.4, 0.4, 0.5 opacity: 0.9 gear: - color: [0.2, 0.4, 0.5] - valve: - color: [0.4, 0.4, 0.5] + color: rgb 0.2, 0.4, 0.5 wire: - color: [1, 1, 1, 0.9] + color: rgb 1, 1, 1, 0.9 glow: - color: [0, 0, 1] + color: rgb 0, 0, 1 text: - color: [0.2, 0.4, 0.5] - bright: [0.3, 0.9, 1] - dark: [0.1, 0.3, 0.4] + color: rgb 0.2, 0.4, 0.5 + bright: rgb 0.3, 0.9, 1 + dark: rgb 0.1, 0.3, 0.4 \ No newline at end of file diff --git a/coffee/stone.coffee b/coffee/stone.coffee index 91f4968..6c0f65b 100644 --- a/coffee/stone.coffee +++ b/coffee/stone.coffee @@ -11,14 +11,12 @@ class Stone extends Pushable constructor: (opt) -> @slippery = opt?.slippery or false - @opacity = opt?.opacity ? 0.7 - @color = 0xff8800 + @opacity = opt?.opacity if opt?.color if Array.isArray opt.color @color = new THREE.Color opt.color[0], opt.color[1], opt.color[2] else @color = opt.color - log 'color: ', @color super isSlippery: -> return @slippery @@ -37,8 +35,8 @@ class Stone extends Pushable else @geom = new THREE.BoxBufferGeometry 0.98,0.98,0.98 @mat = Material.stone.clone() - @mat.opacity = @opacity - @mat.color.set @color + @mat.opacity = @opacity if @opacity? + @mat.color.set @color if @color? @mesh = new THREE.Mesh @geom, @mat @mesh.receiveShadow = true @mesh.castShadow = true diff --git a/coffee/switch.coffee b/coffee/switch.coffee index 02e5c9d..545d144 100644 --- a/coffee/switch.coffee +++ b/coffee/switch.coffee @@ -47,10 +47,7 @@ class Switch extends Item @mesh.receiveShadow = true t2 = new THREE.TorusBufferGeometry 0.5-torusRadius, torusRadius, 16, 32 - # t3 = new THREE.TorusGeometry 0.5-torusRadius, torusRadius, 16, 32 t2.rotateY Vector.DEG2RAD 90 - # t3.rotateX Vector.DEG2RAD 90 - # t2.merge t3 @tors = new THREE.Mesh t2, Material.switch @tors.castShadow = true @tors.receiveShadow = true diff --git a/coffee/world.coffee b/coffee/world.coffee index cb119a9..dd35fa5 100644 --- a/coffee/world.coffee +++ b/coffee/world.coffee @@ -33,7 +33,12 @@ Vector = require './lib/vector' Pos = require './lib/pos' _ = require 'lodash' now = require 'performance-now' -{Wire,Gear,MotorGear,MotorCylinder,Face} = require './items' +{ +Wire, +Gear, +MotorGear, +MotorCylinder, +Face} = require './items' world = null @@ -182,8 +187,6 @@ class World extends Actor @setSize @dict["size"] # this removes all objects - # log "world size set", @size - @applyScheme @dict.scheme ? 'default' # ............................................................ intro text @@ -266,12 +269,31 @@ class World extends Actor applyScheme: (scheme) -> return if not Scheme[scheme] - log "Scheme[#{scheme}]", Scheme[scheme] - for k,v of Scheme[scheme] - if Material[k]? - if v.color - c = v.color - Material[k].color = new THREE.Color c[0], c[1], c[2] + + log "world.applyScheme #{scheme}" + + colors = _.clone Scheme[scheme] + + opacity = + stone: 0.7 + bomb: 0.9 + + colors.plate.emissive ?= colors.plate.color + colors.bulb.emissive ?= colors.bulb.color + colors.raster ?= {} + colors.raster.color ?= colors.plate.color + colors.wall ?= {} + colors.wall.color ?= new THREE.Color(colors.plate.color).multiplyScalar 0.6 + colors.wirePlate ?= {} + colors.wirePlate.color ?= colors.wire.color + for k,v of colors + # log "#{k} #{v.color?.r} #{v.color?.g} #{v.color?.b}", v + continue if k == 'text' + mat = Material[k] + mat.color = v.color + mat.opacity = v.opacity ? opacity[k] ? 1 + mat.specular = v.specular ? new THREE.Color(v.color).multiplyScalar 0.2 + mat.emissive = v.emissive ? new THREE.Color 0,0,0 # 000 000 0000000 000 000 000000000 # 000 000 000 000 000 000 @@ -909,3 +931,4 @@ class World extends Actor return if @player?.modKeyComboEventUp mod, key, combo, event module.exports = World + diff --git a/img/shot05.png b/img/shot05.png new file mode 100644 index 0000000..f8f8a66 Binary files /dev/null and b/img/shot05.png differ diff --git a/img/shot06.png b/img/shot06.png new file mode 100644 index 0000000..44d4d33 Binary files /dev/null and b/img/shot06.png differ diff --git a/screenShot.png b/screenShot.png new file mode 100644 index 0000000..f8f8a66 Binary files /dev/null and b/screenShot.png differ