This commit is contained in:
monsterkodi 2016-08-23 21:10:30 +02:00
parent d4c28ee1d6
commit 1d8f52dcfe
11 changed files with 303 additions and 316 deletions

View File

@ -10,6 +10,7 @@ class Levels
@dict = {} @dict = {}
@list = [ @list = [
# "test", # "test",
"electro",
# --- introduction # --- introduction
"steps", "steps",
"start", "start",

View File

@ -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 = module.exports =
name: "blocks" name: "blocks"
design: 'Michael Abel' design: 'Michael Abel'
@ -17,18 +23,18 @@ module.exports =
player: player:
coordinates: [1,6,2] coordinates: [1,6,2]
exits: [ exits: [
name: "exit" name: "exit"
active: 1 active: 1
coordinates: [7,9,2] coordinates: [7,9,2]
] ]
create: -> create: ->
{Stone} = require '../items' {Stone} = require '../items'
world.addObjectAtPos 'Wall', 1,1,2 world.addObjectAtPos 'Wall', 1,1,2
world.addObjectAtPos 'Wall', 4,2,2 world.addObjectAtPos 'Wall', 4,2,2
world.addObjectAtPos 'Wall', 7,2,2 world.addObjectAtPos 'Wall', 7,2,2
world.addObjectAtPos 'Stone', 10,2,2 world.addObjectAtPos 'Stone', 10,2,2
world.addObjectAtPos new Stone(slippery:true), 13,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), 15,4,2
world.addObjectAtPos new Stone(color: [0,1,0], opacity: 0.8, slippery: true), 13,7,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 world.addObjectAtPos new Stone(color: [1,0,0], opacity: 0.8, slippery: true), 10,7,2

View File

@ -13,26 +13,23 @@ class Light extends Item
@radius = opt?.radius ? 4 @radius = opt?.radius ? 4
@shadow = opt?.shadow ? false @shadow = opt?.shadow ? false
@intensity = opt?.intensity ? 0.5 @intensity = opt?.intensity ? 0.5
# @ambient_color = colors[KikiLight_base_color] world.addLight @
# @diffuse_color = colors[KikiLight_diffuse_color] super
# @specular_color = colors[KikiLight_specular_color] @setPosition opt.pos if opt?.pos?
createMesh: ->
@point = new THREE.PointLight 0xffffff, @intensity, @radius, 2 @point = new THREE.PointLight 0xffffff, @intensity, @radius, 2
@point.castShadow = @shadow @point.castShadow = @shadow
@point.shadow.darkness = 0.5 @point.shadow.darkness = 0.5
@point.shadow.mapSize = new THREE.Vector2 2048, 2048 @point.shadow.mapSize = new THREE.Vector2 2048, 2048
@point.shadow.bias = 0.01 @point.shadow.bias = 0.01
geom = new THREE.SphereGeometry 0.3, 16, 16 geom = new THREE.SphereGeometry 0.3, 16, 16
# world.scene.add new THREE.CameraHelper @point.shadow.camera if @shadow # world.scene.add new THREE.CameraHelper @point.shadow.camera if @shadow
@point.shadow.camera.near = 0.1 @point.shadow.camera.near = 0.1
@point.shadow.camera.far = @radius*2 @point.shadow.camera.far = @radius*2
@mesh = new THREE.Mesh geom, Material.bulb @mesh = new THREE.Mesh geom, Material.bulb
world.scene.add @point world.scene.add @point
world.addLight @
@setPosition opt.pos if opt?.pos?
super
del: -> del: ->
world.removeLight @ world.removeLight @

View File

@ -12,8 +12,14 @@ module.exports =
color: 0xffff00 color: 0xffff00
id: 999 id: 999
bulb: new THREE.MeshLambertMaterial
side: THREE.FrontSide
shading: THREE.SmoothShading
transparent: true
opacity: 0.7
emissiveIntensity: 0.9
player: new THREE.MeshPhongMaterial player: new THREE.MeshPhongMaterial
color: 0x2222ff
side: THREE.FrontSide side: THREE.FrontSide
shading: THREE.SmoothShading shading: THREE.SmoothShading
transparent: true transparent: true
@ -21,8 +27,6 @@ module.exports =
shininess: 5 shininess: 5
tire: new THREE.MeshPhongMaterial tire: new THREE.MeshPhongMaterial
color: 0x000066
# specular: 0x222255
side: THREE.FrontSide side: THREE.FrontSide
shading: THREE.FlatShading shading: THREE.FlatShading
transparent: true transparent: true
@ -72,15 +76,6 @@ module.exports =
shading: THREE.SmoothShading shading: THREE.SmoothShading
shininess: 10 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 bomb: new THREE.MeshPhongMaterial
color: 0xff0000 color: 0xff0000
side: THREE.FrontSide side: THREE.FrontSide
@ -102,24 +97,21 @@ module.exports =
shininess: 5 shininess: 5
raster: new THREE.MeshPhongMaterial raster: new THREE.MeshPhongMaterial
color: 0x880000
side: THREE.FrontSide side: THREE.FrontSide
shading: THREE.SmoothShading shading: THREE.SmoothShading
shininess: 20 shininess: 20
wall: new THREE.MeshPhongMaterial wall: new THREE.MeshPhongMaterial
color: 0x770000 # color: 0x770000
side: THREE.FrontSide side: THREE.FrontSide
shading: THREE.SmoothShading shading: THREE.SmoothShading
shininess: 10 shininess: 20
plate: new THREE.MeshPhongMaterial plate: new THREE.MeshPhongMaterial
color: 0x880000
side: THREE.FrontSide side: THREE.FrontSide
shading: THREE.SmoothShading shading: THREE.SmoothShading
shininess: 10 shininess: 10
emissive: 0x880000 emissiveIntensity: 0.05
emissiveIntensity: 0.02
stone: new THREE.MeshPhongMaterial stone: new THREE.MeshPhongMaterial
side: THREE.DoubleSide side: THREE.DoubleSide

View File

@ -5,6 +5,8 @@
# 000 000 000 000 000 000 0 000 000 # 000 000 000 000 000 000 0 000 000
# 0000000 0000000 000 000 00000000 000 000 00000000 # 0000000 0000000 000 000 00000000 000 000 00000000
rgb = (r,g,b) -> new THREE.Color r,g,b
module.exports = module.exports =
# 0000000 00000000 00000000 0000000 000 000 000 000000000 # 0000000 00000000 00000000 0000000 000 000 000 000000000
@ -14,42 +16,39 @@ module.exports =
# 0000000 00000000 000 000 000 0000000 0000000 000 # 0000000 00000000 000 000 000 0000000 0000000 000
default: default:
raster:
color: [0.5, 0, 0]
plate: plate:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
wall: wall:
color: [0.4, 0, 0] specular: rgb 0.16, 0, 0
bulb:
color: [1, 1, 0]
bomb:
color: [0.5, 0, 0]
stone: stone:
color: [0.5, 0.5, 0.5] color: rgb 0.8, 0.5, 0
switch: bomb:
color: [0, 0, 0.5] color: rgb 0.5, 0, 0
gate: bulb:
color: [1, 0.5, 0] color: rgb 1, 0.6, 0
player: player:
color: [0.8, 0.4, 0] color: rgb 0x2222ff
tire: 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: mutant:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
mutantTire: mutantTire:
color: [0, 0, 0.2] color: rgb 0, 0, 0.2
text: text:
color: [0.8, 0.8, 0] color: rgb 0.8, 0.8, 0
bright: [1, 1, 0] bright: rgb 1, 1, 0
dark: [0.6, 0.4, 0] dark: rgb 0.6, 0.4, 0
gear: gear:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
valve:
color: [0, 0, 0.5]
wire: wire:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
glow: glow:
color: [1, 1, 0] color: rgb 1, 1, 0
# 000000000 00000000 0000000 000 000 # 000000000 00000000 0000000 000 000
# 000 000 000 000 000 0000 000 # 000 000 000 000 000 0000 000
@ -58,41 +57,38 @@ module.exports =
# 000 000 000 0000000 000 000 # 000 000 000 0000000 000 000
tron: tron:
raster:
color: [0, 0, 0.3]
plate: plate:
color: [0.05, 0.05] color: rgb 0.05, 0.05, 0.2
opacity: 0.2 # raster:
# color: rgb 0, 0, 0.3
bulb: bulb:
color: [0, 0, 1] color: rgb 0, 0, 1
bomb: bomb:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
stone: stone:
color: [0, 0, 1] color: rgb 0, 0, 1
switch: switch:
color: [0, 0, 0.5] color: rgb 0, 0, 0.5
gate: gate:
color: [1, 1, 0] color: rgb 1, 1, 0
player: player:
color: [0.5, 0.5, 0.5] color: rgb 0.5, 0.5, 0.5
tire: tire:
color: [0, 0, 0.5] color: rgb 0, 0, 0.5
mutant: mutant:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
mutantTire: mutantTire:
color: [0, 0, 0.2] color: rgb 0, 0, 0.2
text: text:
color: [0.8, 0.8, 0] color: rgb 0.8, 0.8, 0
bright: [1, 1, 0] bright: rgb 1, 1, 0
dark: [0.6, 0.4, 0] dark: rgb 0.6, 0.4, 0
gear: gear:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
valve:
color: [0, 0, 0.5]
wire: wire:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
glow: glow:
color: [1, 1, 0] color: rgb 1, 1, 0
# 000 000 00000000 000 000 000000000 00000000 0000000 000 000 # 000 000 00000000 000 000 000000000 00000000 0000000 000 000
# 0000 000 000 000 000 000 000 000 000 000 0000 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 # 000 000 00000000 0000000 000 000 000 0000000 000 000
neutron: neutron:
raster:
color: [0.13, 0.13, 0.13]
plate: 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: bulb:
color: [0, 0, 0] color: rgb 0, 0, 0
bomb: bomb:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
stone: stone:
color: [0.5, 0.5, 0.5] color: rgb 0.5, 0.5, 0.5
opacity: 0.5 opacity: 0.5
switch: switch:
color: [0, 0, 0.5] color: rgb 0, 0, 0.5
gate: gate:
color: [1, 1, 0] color: rgb 1, 1, 0
player: player:
color: [1, 0.5, 0] color: rgb 1, 0.5, 0
tire: tire:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
mutant: mutant:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
mutantTire: mutantTire:
color: [0, 0, 0.2] color: rgb 0, 0, 0.2
text: text:
color: [0.8, 0.8, 0] color: rgb 0.8, 0.8, 0
bright: [1, 1, 0] bright: rgb 1, 1, 0
dark: [0.6, 0.4, 0] dark: rgb 0.6, 0.4, 0
gear: gear:
color: [1, 0, 0] color: rgb 1, 0, 0
valve:
color: [0.7, 0, 0]
wire: wire:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
glow: glow:
color: [1, 1, 0] color: rgb 1, 1, 0
# 000000000 00000000 0000000 000000000 # 000000000 00000000 0000000 000000000
# 000 000 000 000 # 000 000 000 000
@ -144,41 +138,39 @@ module.exports =
# 000 00000000 0000000 000 # 000 00000000 0000000 000
test: test:
raster:
color: [1, 1, 1]
plate: plate:
color: [0.08, 0.08, 0.08] color: rgb 0.08, 0.08, 0.08
# raster:
# color: rgb 1, 1, 1
bulb: bulb:
color: [0, 0, 0] color: rgb 0, 0, 0
bomb: bomb:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
stone: stone:
color: [0.5, 0.5, 0.5] color: rgb 0.5, 0.5, 0.5
opacity: 0.5 opacity: 0.5
switch: switch:
color: [0, 0, 0.5, 0.8] color: rgb 0, 0, 0.5, 0.8
gate: gate:
color: [1, 1, 0, 0.8] color: rgb 1, 1, 0, 0.8
player: player:
color: [1, 0.5, 0] color: rgb 1, 0.5, 0
tire: tire:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
mutant: mutant:
color: [1, 0.5, 0] color: rgb 1, 0.5, 0
mutantTire: mutantTire:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
text: text:
color: [0.8, 0.8, 0] color: rgb 0.8, 0.8, 0
bright: [1, 1, 0] bright: rgb 1, 1, 0
dark: [0.6, 0.4, 0] dark: rgb 0.6, 0.4, 0
gear: gear:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
valve:
color: [0, 0, 0.5]
wire: wire:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
glow: glow:
color: [1, 1, 0] color: rgb 1, 1, 0
# 0000000 0000000 000 000 0000000 000 000 # 0000000 0000000 000 000 0000000 000 000
# 000 000 000 0000 000 000 000 000 000 # 000 000 000 0000 000 000 000 000 000
@ -187,41 +179,39 @@ module.exports =
# 0000000 000 000 000 000 0000000 000 # 0000000 000 000 000 000 0000000 000
candy: candy:
raster:
color: [0.35, 0, 0.35]
plate: plate:
color: [0.8, 0, 0.9] color: rgb 0.8, 0, 0.9
# raster:
# color: rgb 0.35, 0, 0.35
bulb: bulb:
color: [0, 0, 0] color: rgb 0, 0, 0
text: text:
color: [0.7, 0, 0.7] color: rgb 0.7, 0, 0.7
bright: [1, 0, 1] bright: rgb 1, 0, 1
dark: [0.4, 0, 0.4] dark: rgb 0.4, 0, 0.4
bomb: bomb:
color: [0.73, 0, 0.75] color: rgb 0.73, 0, 0.75
stone: stone:
color: [0.85, 0, 0.95] color: rgb 0.85, 0, 0.95
opacity: 0.6 opacity: 0.6
switch: switch:
color: [0.3, 0, 0.3] color: rgb 0.3, 0, 0.3
gate: gate:
color: [1, 0, 1, 0.8] color: rgb 1, 0, 1, 0.8
player: player:
color: [0.7, 0, 0.7] color: rgb 0.7, 0, 0.7
tire: tire:
color: [0.3, 0, 0.3] color: rgb 0.3, 0, 0.3
mutant: mutant:
color: [0.3, 0, 0.3] color: rgb 0.3, 0, 0.3
mutantTire: mutantTire:
color: [0.7, 0, 0.7] color: rgb 0.7, 0, 0.7
valve:
color: [0.5, 0, 0.5]
gear: gear:
color: [0.7, 0, 0.7] color: rgb 0.7, 0, 0.7
wire: wire:
color: [1, 0, 1] color: rgb 1, 0, 1
glow: glow:
color: [1, 1, 0] color: rgb 1, 1, 0
# 0000000 00000000 0000000 000 000 0000000 00000000 # 0000000 00000000 0000000 000 000 0000000 00000000
# 000 000 000 000 000 000 0000 000 000 000 # 000 000 000 000 000 000 0000 000 000 000
@ -230,41 +220,38 @@ module.exports =
# 0000000 000 000 0000000 000 000 0000000 00000000 # 0000000 000 000 0000000 000 000 0000000 00000000
bronze: bronze:
raster:
color: [0.25, 0.15, 0.05]
plate: plate:
color: [0.8, 0.6, 0.2] color: rgb 0.8, 0.6, 0.2
bulb: bulb:
color: [0.1, 0.1, 0] color: rgb 1,1,1
emissive: rgb 1,1,0
stone: stone:
color: [1, 0.8, 0.4] color: rgb 1, 0.8, 0.4
opacity: 0.8 opacity: 0.8
switch: switch:
color: [0.9, 0.7, 0.1] color: rgb 0.9, 0.7, 0.1
gate: gate:
color: [0.9, 0.7, 0.1] color: rgb 0.9, 0.7, 0.1
player: player:
color: [0.8, 0.6, 0.3] color: rgb 0.8, 0.6, 0.3
tire: tire:
color: [0.5, 0.2, 0.1] color: rgb 0.5, 0.2, 0.1
mutant: mutant:
color: [0.5, 0.2, 0.1] color: rgb 0.5, 0.2, 0.1
mutantTire: mutantTire:
color: [0.3, 0.1, 0] color: rgb 0.3, 0.1, 0
gear: gear:
color: [0.7, 0.4, 0.1] color: rgb 0.7, 0.4, 0.1
valve:
color: [0.5, 0.2, 0.1]
wire: wire:
color: [0.7, 0.5, 0.3] color: rgb 0.6, 0, 0
glow: glow:
color: [1, 1, 0] color: rgb 1, 1, 0
bomb: bomb:
color: [0.9, 0.7, 0.1] color: rgb 0.9, 0.7, 0.1
text: text:
color: [0.7, 0.5, 0.1] color: rgb 0.7, 0.5, 0.1
bright: [0.9, 0.7, 0.15] bright: rgb 0.9, 0.7, 0.15
dark: [0.6, 0.4, 0] dark: rgb 0.6, 0.4, 0
# 00000000 00000000 0000000 # 00000000 00000000 0000000
# 000 000 000 000 000 # 000 000 000 000 000
@ -273,39 +260,37 @@ module.exports =
# 000 000 00000000 0000000 # 000 000 00000000 0000000
red: red:
raster:
color: [0.2, 0, 0]
plate: plate:
color: [0.3, 0, 0] color: rgb 0.3, 0, 0
wall:
color: rgb 0.2, 0, 0
bulb: bulb:
color: [0.1, 0.1, 0.1] color: rgb 0.8, 0, 0
bomb: bomb:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
stone: stone:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
opacity: 0.6 opacity: 0.6
switch: switch:
color: [0.8, 0, 0] color: rgb 0.6, 0, 0
gate: gate:
color: [1, 0.2, 0] color: rgb 1, 0.2, 0
player: player:
color: [0.7, 0, 0] color: rgb 0.7, 0, 0
tire: tire:
color: [0.3, 0, 0] color: rgb 0.3, 0, 0
mutant: mutant:
color: [0.3, 0, 0] color: rgb 0.3, 0, 0
mutantTire: mutantTire:
color: [0.7, 0, 0] color: rgb 0.7, 0, 0
valve:
color: [0.5, 0.2, 0]
gear: gear:
color: [1, 0.5, 0] color: rgb 1, 0.5, 0
wire: wire:
color: [0.5, 0, 0] color: rgb 0.5, 0, 0
text: text:
color: [1, 0.5, 0] color: rgb 1, 0.5, 0
bright: [1, 0.8, 0] bright: rgb 1, 0.8, 0
dark: [0.4, 0.2, 0] dark: rgb 0.4, 0.2, 0
# 0000000 000 000 000 00000000 # 0000000 000 000 000 00000000
# 000 000 000 000 000 000 # 000 000 000 000 000 000
@ -314,42 +299,40 @@ module.exports =
# 0000000 0000000 0000000 00000000 # 0000000 0000000 0000000 00000000
blue: blue:
raster:
color: [0, 0, 0.2]
plate: plate:
color: [0.1, 0.1, 0.6] color: rgb 0.1, 0.1, 0.6
# raster:
# color: rgb 0, 0, 0.2
bulb: bulb:
color: [0.1, 0.1, 0.1] color: rgb 0.1, 0.1, 0.1
stone: stone:
color: [0, 0, 0.5] color: rgb 0, 0, 0.5
opacity: 0.6 opacity: 0.6
switch: switch:
color: [0, 0, 0.6, 0.8] color: rgb 0, 0, 0.6, 0.8
bomb: bomb:
color: [0.2, 0.2, 0.9] color: rgb 0.2, 0.2, 0.9
opacity: 0.8 opacity: 0.8
gate: gate:
color: [0, 0.2, 1] color: rgb 0, 0.2, 1
player: player:
color: [0, 0, 0.7] color: rgb 0, 0, 0.7
tire: tire:
color: [0, 0, 0.3] color: rgb 0, 0, 0.3
mutant: mutant:
color: [0, 0, 0.3] color: rgb 0, 0, 0.3
mutantTire: mutantTire:
color: [0, 0, 0.7] color: rgb 0, 0, 0.7
text: text:
color: [0.2, 0.4, 0.8] color: rgb 0.2, 0.4, 0.8
bright: [0.7, 0.8, 1] bright: rgb 0.7, 0.8, 1
dark: [0, 0, 0.6] dark: rgb 0, 0, 0.6
gear: gear:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
valve:
color: [0, 0, 0.5]
wire: wire:
color: [0.1, 0.1, 0.9] color: rgb 0.1, 0.1, 0.9
glow: glow:
color: [1, 0.5, 0] color: rgb 1, 0.5, 0
# 000 000 00000000 000 000 0000000 000 000 # 000 000 00000000 000 000 0000000 000 000
# 000 000 000 000 000 000 000 000 0 000 # 000 000 000 000 000 000 000 000 0 000
@ -358,41 +341,39 @@ module.exports =
# 000 00000000 0000000 0000000 0000000 00 00 # 000 00000000 0000000 0000000 0000000 00 00
yellow: yellow:
raster:
color: [0.34, 0.34, 0]
plate: plate:
color: [0.9, 0.9, 0] color: rgb 0.9, 0.9, 0
# raster:
# color: rgb 0.34, 0.34, 0
bulb: bulb:
color: [0, 0, 0] color: rgb 0, 0, 0
bomb: bomb:
color: [0.75, 0.75, 0] color: rgb 0.75, 0.75, 0
stone: stone:
color: [0.8, 0.85, 0] color: rgb 0.8, 0.85, 0
opacity: 0.6 opacity: 0.6
switch: switch:
color: [0.8, 0.8, 0] color: rgb 0.8, 0.8, 0
gate: gate:
color: [1, 1, 0, 0.8] color: rgb 1, 1, 0, 0.8
player: player:
color: [0.7, 0.7, 0] color: rgb 0.7, 0.7, 0
tire: tire:
color: [0.3, 0.3, 0] color: rgb 0.3, 0.3, 0
mutant: mutant:
color: [0.3, 0.3, 0] color: rgb 0.3, 0.3, 0
mutantTire: mutantTire:
color: [0.7, 0.7, 0] color: rgb 0.7, 0.7, 0
valve:
color: [0.5, 0.5, 0]
gear: gear:
color: [0.7, 0.5, 0] color: rgb 0.7, 0.5, 0
wire: wire:
color: [1, 1, 0] color: rgb 1, 1, 0
glow: glow:
color: [0, 0, 1] color: rgb 0, 0, 1
text: text:
color: [0.7, 0.7, 0] color: rgb 0.7, 0.7, 0
bright: [1, 1, 0] bright: rgb 1, 1, 0
dark: [0.4, 0.4, 0] dark: rgb 0.4, 0.4, 0
# 0000000 00000000 00000000 00000000 000 000 # 0000000 00000000 00000000 00000000 000 000
# 000 000 000 000 000 0000 000 # 000 000 000 000 000 0000 000
@ -401,40 +382,38 @@ module.exports =
# 0000000 000 000 00000000 00000000 000 000 # 0000000 000 000 00000000 00000000 000 000
green: green:
raster:
color: [0, 0.2, 0]
plate: plate:
color: [0.1, 0.6, 0.1] color: rgb 0.1, 0.6, 0.1
# raster:
# color: rgb 0, 0.2, 0
bulb: bulb:
color: [0, 0, 0] color: rgb 0, 0, 0
stone: stone:
color: [0, 0.5, 0] color: rgb 0, 0.5, 0
switch: switch:
color: [0, 0.6, 0] color: rgb 0, 0.6, 0
bomb: bomb:
color: [0, 0.2, 0] color: rgb 0, 0.2, 0
gate: gate:
color: [0, 0.5, 0] color: rgb 0, 0.5, 0
player: player:
color: [0, 0.7, 0] color: rgb 0, 0.7, 0
tire: tire:
color: [0, 0.3, 0] color: rgb 0, 0.3, 0
mutant: mutant:
color: [0, 0.3, 0] color: rgb 0, 0.3, 0
mutantTire: mutantTire:
color: [0, 0.7, 0] color: rgb 0, 0.7, 0
text: text:
color: [0, 0.4, 0] color: rgb 0, 0.4, 0
bright: [0, 0.6, 0] bright: rgb 0, 0.6, 0
dark: [0, 0.2, 0] dark: rgb 0, 0.2, 0
gear: gear:
color: [0, 0.2, 0] color: rgb 0, 0.2, 0
valve:
color: [0, 0.5, 0]
wire: wire:
color: [0.1, 0.9, 0] color: rgb 0.1, 0.9, 0
glow: glow:
color: [1, 1, 1] color: rgb 1, 1, 1
# 00 00 00000000 000000000 0000000 000 # 00 00 00000000 000000000 0000000 000
# 000 000 000 000 000 000 000 # 000 000 000 000 000 000 000
@ -443,41 +422,39 @@ module.exports =
# 000 000 00000000 000 000 000 0000000 # 000 000 00000000 000 000 000 0000000
metal: metal:
raster:
color: [0.2, 0.2, 0.2]
plate: plate:
color: [1, 1, 1] color: rgb 0.7,0.7,0.7
# raster:
# color: rgb 0.2, 0.2, 0.2
bulb: bulb:
color: [0, 0, 0] color: rgb 1, 1, 1
stone: stone:
color: [1, 1, 1, 0.6] color: rgb 1, 1, 1
opacity: 0.6
switch: switch:
color: [0.9, 1, 0.9] color: rgb 0.9, 1, 0.9
gate: gate:
color: [1, 1, 1, 0.8] color: rgb 1, 1, 1, 0.8
player: player:
color: [0.6, 0.6, 0.6] color: rgb 0.6, 0.6, 0.6
tire: tire:
color: [0.3, 0.3, 0.3] color: rgb 0.3, 0.3, 0.3
mutant: mutant:
color: [0.8, 0.8, 0.8] color: rgb 0.8, 0.8, 0.8
mutantTire: mutantTire:
color: [0.7, 0.7, 0.7] color: rgb 0.7, 0.7, 0.7
bomb: bomb:
color: [0.4, 0.4, 0.5] color: rgb 0.4, 0.4, 0.5
opacity: 0.9
gear: gear:
color: [0.2, 0.4, 0.5] color: rgb 0.2, 0.4, 0.5
valve:
color: [0.4, 0.4, 0.5]
wire: wire:
color: [1, 1, 1, 0.9] color: rgb 1, 1, 1
glow: glow:
color: [0, 0, 1] color: rgb 1, 1, 1
text: text:
color: [0.2, 0.4, 0.5] color: rgb 0.2, 0.4, 0.5
bright: [0.3, 0.9, 1] bright: rgb 0.3, 0.9, 1
dark: [0.1, 0.3, 0.4] dark: rgb 0.1, 0.3, 0.4
# 0000000 00000000 0000000 0000000 000 000 # 0000000 00000000 0000000 0000000 000 000
# 000 000 000 000 000 000 000 000 # 000 000 000 000 000 000 000 000
@ -486,42 +463,40 @@ module.exports =
# 0000000 000 000 000 000 0000000 000 # 0000000 000 000 000 000 0000000 000
crazy: crazy:
# plate:
# color: rgb 0, 0.51, 0.82
raster: raster:
color: [0.84, 0.22, 0.20] color: rgb 0.84, 0.22, 0.20
plate:
color: [0, 0.51, 0.82]
bulb: bulb:
color: [0, 0, 0] color: rgb 0, 0, 0
stone: stone:
color: [1, 1, 1] color: rgb 1, 1, 1
stone: 0.2 stone: 0.2
switch: switch:
color: [0.9, 1, 0.9] color: rgb 0.9, 1, 0.9
gate: gate:
color: [1, 1, 1, 0.8] color: rgb 1, 1, 1, 0.8
player: player:
color: [0.6, 0.6, 0.6] color: rgb 0.6, 0.6, 0.6
tire: tire:
color: [0.3, 0.3, 0.3] color: rgb 0.3, 0.3, 0.3
mutant: mutant:
color: [0.8, 0.8, 0.8] color: rgb 0.8, 0.8, 0.8
mutantTire: mutantTire:
color: [0.7, 0.7, 0.7] color: rgb 0.7, 0.7, 0.7
bomb: bomb:
color: [0.4, 0.4, 0.5] color: rgb 0.4, 0.4, 0.5
opacity: 0.2 opacity: 0.2
gear: gear:
color: [0.2, 0.4, 0.5] color: rgb 0.2, 0.4, 0.5
valve:
color: [0.4, 0.4, 0.5]
wire: wire:
color: [1, 1, 1] color: rgb 1, 1, 1
glow: glow:
color: [0, 0, 1] color: rgb 0, 0, 1
text: text:
color: [0.2, 0.4, 0.5] color: rgb 0.2, 0.4, 0.5
bright: [0.3, 0.9, 1] bright: rgb 0.3, 0.9, 1
dark: [0.1, 0.3, 0.4] dark: rgb 0.1, 0.3, 0.4
# 0000000 00000000 000 000 # 0000000 00000000 000 000
# 000 000 0000 000 # 000 000 0000 000
@ -530,41 +505,39 @@ module.exports =
# 0000000 00000000 000 000 # 0000000 00000000 000 000
zen: zen:
raster:
color: [0.75, 0.95, 0.64]
plate: 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: bulb:
color: [0, 0, 0] color: rgb 0, 0, 0
stone: stone:
color: [0.36, 0.45, 0.30] color: rgb 0.36, 0.45, 0.30
opacity: 0.7 opacity: 0.7
switch: switch:
color: [0.9, 1, 0.9, 0.8] color: rgb 0.9, 1, 0.9, 0.8
gate: gate:
color: [1, 1, 1, 0.8] color: rgb 1, 1, 1, 0.8
player: player:
color: [0.6, 0.6, 0.6] color: rgb 0.6, 0.6, 0.6
tire: tire:
color: [0.3, 0.3, 0.3] color: rgb 0.3, 0.3, 0.3
mutant: mutant:
color: [0.8, 0.8, 0.8] color: rgb 0.8, 0.8, 0.8
mutantTire: mutantTire:
color: [0.7, 0.7, 0.7] color: rgb 0.7, 0.7, 0.7
bomb: bomb:
color: [0.4, 0.4, 0.5] color: rgb 0.4, 0.4, 0.5
opacity: 0.9 opacity: 0.9
gear: gear:
color: [0.2, 0.4, 0.5] color: rgb 0.2, 0.4, 0.5
valve:
color: [0.4, 0.4, 0.5]
wire: wire:
color: [1, 1, 1, 0.9] color: rgb 1, 1, 1, 0.9
glow: glow:
color: [0, 0, 1] color: rgb 0, 0, 1
text: text:
color: [0.2, 0.4, 0.5] color: rgb 0.2, 0.4, 0.5
bright: [0.3, 0.9, 1] bright: rgb 0.3, 0.9, 1
dark: [0.1, 0.3, 0.4] dark: rgb 0.1, 0.3, 0.4

View File

@ -11,14 +11,12 @@ class Stone extends Pushable
constructor: (opt) -> constructor: (opt) ->
@slippery = opt?.slippery or false @slippery = opt?.slippery or false
@opacity = opt?.opacity ? 0.7 @opacity = opt?.opacity
@color = 0xff8800
if opt?.color if opt?.color
if Array.isArray opt.color if Array.isArray opt.color
@color = new THREE.Color opt.color[0], opt.color[1], opt.color[2] @color = new THREE.Color opt.color[0], opt.color[1], opt.color[2]
else else
@color = opt.color @color = opt.color
log 'color: ', @color
super super
isSlippery: -> return @slippery isSlippery: -> return @slippery
@ -37,8 +35,8 @@ class Stone extends Pushable
else else
@geom = new THREE.BoxBufferGeometry 0.98,0.98,0.98 @geom = new THREE.BoxBufferGeometry 0.98,0.98,0.98
@mat = Material.stone.clone() @mat = Material.stone.clone()
@mat.opacity = @opacity @mat.opacity = @opacity if @opacity?
@mat.color.set @color @mat.color.set @color if @color?
@mesh = new THREE.Mesh @geom, @mat @mesh = new THREE.Mesh @geom, @mat
@mesh.receiveShadow = true @mesh.receiveShadow = true
@mesh.castShadow = true @mesh.castShadow = true

View File

@ -47,10 +47,7 @@ class Switch extends Item
@mesh.receiveShadow = true @mesh.receiveShadow = true
t2 = new THREE.TorusBufferGeometry 0.5-torusRadius, torusRadius, 16, 32 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 t2.rotateY Vector.DEG2RAD 90
# t3.rotateX Vector.DEG2RAD 90
# t2.merge t3
@tors = new THREE.Mesh t2, Material.switch @tors = new THREE.Mesh t2, Material.switch
@tors.castShadow = true @tors.castShadow = true
@tors.receiveShadow = true @tors.receiveShadow = true

View File

@ -33,7 +33,12 @@ Vector = require './lib/vector'
Pos = require './lib/pos' Pos = require './lib/pos'
_ = require 'lodash' _ = require 'lodash'
now = require 'performance-now' now = require 'performance-now'
{Wire,Gear,MotorGear,MotorCylinder,Face} = require './items' {
Wire,
Gear,
MotorGear,
MotorCylinder,
Face} = require './items'
world = null world = null
@ -182,8 +187,6 @@ class World extends Actor
@setSize @dict["size"] # this removes all objects @setSize @dict["size"] # this removes all objects
# log "world size set", @size
@applyScheme @dict.scheme ? 'default' @applyScheme @dict.scheme ? 'default'
# ............................................................ intro text # ............................................................ intro text
@ -266,12 +269,31 @@ class World extends Actor
applyScheme: (scheme) -> applyScheme: (scheme) ->
return if not Scheme[scheme] return if not Scheme[scheme]
log "Scheme[#{scheme}]", Scheme[scheme]
for k,v of Scheme[scheme] log "world.applyScheme #{scheme}"
if Material[k]?
if v.color colors = _.clone Scheme[scheme]
c = v.color
Material[k].color = new THREE.Color c[0], c[1], c[2] 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 0000000 000 000 000000000
# 000 000 000 000 000 000 # 000 000 000 000 000 000
@ -909,3 +931,4 @@ class World extends Actor
return if @player?.modKeyComboEventUp mod, key, combo, event return if @player?.modKeyComboEventUp mod, key, combo, event
module.exports = World module.exports = World

BIN
img/shot05.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
img/shot06.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 KiB

BIN
screenShot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB