diff --git a/coffee/bot.coffee b/coffee/bot.coffee index 6155ba9..db1eb5e 100644 --- a/coffee/bot.coffee +++ b/coffee/bot.coffee @@ -419,10 +419,13 @@ class Bot extends Pushable else @dir_sgn = 1 @jump_once = false if action.id != Action.NOOP - log "bot.actionFinished '#{action.name}' position:", @position if action.id in [Action.FORWARD, Action.JUMP_FORWARD, Action.CLIMB_DOWN] - log "bot.actionFinished '#{action.name}' orientation:", @orientation.rounded().name if action.id in [Action.TURN_LEFT, Action.TURN_RIGHT, Action.CLIMB_UP] - # keep action chain flowinwg in order to detect environment changes - # @startTimedAction @getActionWithId(Action.NOOP), 0 + # log "bot.actionFinished '#{action.name}' position:", @position if action.id in [Action.FORWARD, Action.JUMP_FORWARD, Action.CLIMB_DOWN] + # log "bot.actionFinished '#{action.name}' orientation:", @orientation.rounded().name if action.id in [Action.TURN_LEFT, Action.TURN_RIGHT, Action.CLIMB_UP] + + if world.getRealOccupantAtPos(@position.plus @getDown()).isMutant?() + # keep action chain flowinwg in order to detect environment changes + log 'bot.actionFinished mutant below: startTimedAction NOOP' + @startTimedAction @getActionWithId(Action.NOOP), 0 fixOrientationAndPosition: -> @setPosition @current_position.round() diff --git a/coffee/levels.coffee b/coffee/levels.coffee index 9f8ca3b..2c890bb 100644 --- a/coffee/levels.coffee +++ b/coffee/levels.coffee @@ -11,21 +11,21 @@ class Levels @list = [ # "test", # --- introduction - "steps", - "start", - "blocks", - "move", - "electro", - "elevate", - "throw", + "steps", # ok + "start", # ok + "move", # ok + "electro", # ok + "elevate", # ok + "jump", # ok # # --- easy + "blocks", # ok + "throw", "gold", - "jump", "escape", "gears", "gamma", "cube", - "switch", + "switch", # exit doesnt open, other scheme # # "borg", "mini", "bombs", diff --git a/coffee/levels/core.coffee b/coffee/levels/core.coffee index 0260095..2f262a1 100644 --- a/coffee/levels/core.coffee +++ b/coffee/levels/core.coffee @@ -8,7 +8,7 @@ module.exports = name: "core" design: "Michael Abel" - scheme: "yellow" + scheme: "green" size: [9,9,9] help: """ reach the exit. diff --git a/coffee/levels/cube.coffee b/coffee/levels/cube.coffee index e95ce49..f3f026d 100644 --- a/coffee/levels/cube.coffee +++ b/coffee/levels/cube.coffee @@ -8,7 +8,7 @@ module.exports = name: "cube" deisgn: 'Michael Abel' - scheme: "default" + scheme: "red" size: [5,5,5] help: "reach the exit!" player: diff --git a/coffee/levels/entropy.coffee b/coffee/levels/entropy.coffee index 6d2beb3..50249d6 100644 --- a/coffee/levels/entropy.coffee +++ b/coffee/levels/entropy.coffee @@ -34,5 +34,5 @@ module.exports = for j in [0...s.y] for l in [0...s.z] if Math.pow(-1, i+j+l)==1 and not (d<=i<=s.x-d-1 and d<=j<=s.y-d-1 and d<=l<=s.z-d-1) - world.addObjectAtPos(new Stone(color:[0,0.8,0.2],opacity:0.8, slippery:true), i,j,l) + world.addObjectAtPos(new Stone(slippery:true), i,j,l) diff --git a/coffee/levels/gold.coffee b/coffee/levels/gold.coffee index 9c1017f..c2e727d 100644 --- a/coffee/levels/gold.coffee +++ b/coffee/levels/gold.coffee @@ -16,7 +16,7 @@ module.exports = move the stones to reach it """ player: - coordinates: [1,0,0] + coordinates: [1,1,0] orientation: minusYupZ exits: [ diff --git a/coffee/levels/jump.coffee b/coffee/levels/jump.coffee index 847246e..89b7df5 100644 --- a/coffee/levels/jump.coffee +++ b/coffee/levels/jump.coffee @@ -24,7 +24,7 @@ module.exports = exits: [ name: "exit" active: 1 - position: [0,0,4] + position: [0,0,3] ] create: -> diff --git a/coffee/levels/switch.coffee b/coffee/levels/switch.coffee index 053285e..8b395a3 100644 --- a/coffee/levels/switch.coffee +++ b/coffee/levels/switch.coffee @@ -7,7 +7,7 @@ module.exports = name: "switch" - scheme: "yellow" + scheme: "tron" size: [7,7,7] help: """ $scale(1.5)mission: diff --git a/coffee/lib/pos.coffee b/coffee/lib/pos.coffee index 260de5f..0397a8a 100644 --- a/coffee/lib/pos.coffee +++ b/coffee/lib/pos.coffee @@ -34,6 +34,7 @@ class Pos mul: (f) -> new Pos @x*f, @y*f, @z*f div: (d) -> new Pos Math.floor(@x/d), Math.floor(@y/d), Math.floor(@z/d) eql: (p) -> @x==p.x and @y==p.y and @z==p.z + str: -> "#{@x} #{@y} #{@z}" reset: -> @x = @y = @z = 0 diff --git a/coffee/material.coffee b/coffee/material.coffee index 9581a13..867dd2c 100644 --- a/coffee/material.coffee +++ b/coffee/material.coffee @@ -31,7 +31,6 @@ module.exports = shading: THREE.FlatShading transparent: true opacity: 1 - shininess: 4 mutant: new THREE.MeshPhongMaterial color: 0x888888 @@ -55,7 +54,7 @@ module.exports = shading: THREE.SmoothShading transparent: true opacity: 0.8 - shininess: 5 + shininess: 50 depthWrite: false gear: new THREE.MeshPhongMaterial @@ -99,23 +98,18 @@ module.exports = raster: new THREE.MeshPhongMaterial side: THREE.FrontSide shading: THREE.SmoothShading - shininess: 20 wall: new THREE.MeshPhongMaterial - # color: 0x770000 side: THREE.FrontSide shading: THREE.SmoothShading - shininess: 20 plate: new THREE.MeshPhongMaterial side: THREE.FrontSide shading: THREE.SmoothShading - shininess: 10 emissiveIntensity: 0.05 stone: new THREE.MeshPhongMaterial side: THREE.DoubleSide shading: THREE.SmoothShading transparent: true - shininess: 20 \ No newline at end of file diff --git a/coffee/mutant.coffee b/coffee/mutant.coffee index dd0f636..a5a4656 100644 --- a/coffee/mutant.coffee +++ b/coffee/mutant.coffee @@ -21,7 +21,8 @@ class Mutant extends Bot super() @setOpacity 0.6 @getActionWithId(Action.FALL).duration = 40 - + + isMutant: -> true bulletImpact: -> @health -= 0.1 bulletHitSound: -> @health > 0 and 'BULLET_HIT_MUTANT' or 'BULLET_HIT_OBJECT' diff --git a/coffee/scheme.coffee b/coffee/scheme.coffee index 816455f..29e0773 100644 --- a/coffee/scheme.coffee +++ b/coffee/scheme.coffee @@ -60,7 +60,7 @@ module.exports = plate: color: rgb 0.05, 0.05, 0.2 bulb: - color: rgb 0, 0, 1 + color: rgb 0.4, 0.4, 1 bomb: color: rgb 0.5, 0, 0 stone: @@ -70,9 +70,9 @@ module.exports = gate: color: rgb 1, 1, 0 player: - color: rgb 0.5, 0.5, 0.5 + color: rgb 1, 0.6, 0 tire: - color: rgb 0, 0, 0.5 + color: rgb 0, 0, 0.6 mutant: color: rgb 0.5, 0, 0 mutantTire: @@ -318,7 +318,8 @@ module.exports = bright: rgb 0.7, 0.8, 1 dark: rgb 0, 0, 0.6 gear: - color: rgb 0, 0, 0.9 + color: rgb 0.8, 0.4, 0 + shininess: 80 wire: color: rgb 0, 0, 0.9 glow: @@ -332,9 +333,15 @@ module.exports = yellow: plate: - color: rgb 0.9, 0.9, 0 + color: rgb 0.9, 0.9, 0 + specular: rgb 0.005, 0.005, 0 + shininess: 40 + raster: + specular: rgb 0.05, 0.05, 0 + shininess: 180 bulb: color: rgb 1, 1, 1 + emissive: rgb 1,1,0 glow: color: rgb 1, 1, 1 bomb: @@ -342,14 +349,18 @@ module.exports = stone: color: rgb 0.8, 0.85, 0 opacity: 0.6 + shininess: 130 switch: color: rgb 0.8, 0.8, 0 gate: color: rgb 1, 1, 0 player: - color: rgb 0.7, 0.7, 0 + color: rgb 0.8, 0.8, 0 + shininess: 10 tire: - color: rgb 0.3, 0.3, 0 + color: rgb 0.4, 0.4, 0 + specular: rgb 0.4, 0.4, 0 + shininess: 10 mutant: color: rgb 0.3, 0.3, 0 mutantTire: @@ -375,7 +386,10 @@ module.exports = bulb: color: rgb 0.3, 1, 0.3 stone: - color: rgb 0, 0.5, 0 + color: rgb 0, 0.2, 0 + # specular: rgb 0, 0.01, 0 + opacity: 0.8 + shininess: 60 switch: color: rgb 0, 0.6, 0 bomb: diff --git a/coffee/world.coffee b/coffee/world.coffee index d3326be..1d0a638 100644 --- a/coffee/world.coffee +++ b/coffee/world.coffee @@ -185,7 +185,7 @@ class World extends Actor @dict = worldDict @level_index = World.levels.list.indexOf @level_name - log "World.create #{@level_index} ---------------------- #{@level_name}" + log "World.create #{@level_index} size: #{new Pos(@dict["size"]).str()} ---------------------- '#{@level_name}' scheme: '#{@dict.scheme ? 'default'}'" @creating = true @@ -268,7 +268,7 @@ class World extends Actor applyScheme: (scheme) -> return if not Scheme[scheme] - log "world.applyScheme #{scheme}" + # log "world.applyScheme #{scheme}" colors = _.clone Scheme[scheme] @@ -276,6 +276,14 @@ class World extends Actor stone: 0.7 bomb: 0.9 + shininess = + tire: 4 + plate: 10 + raster: 20 + wall: 20 + stone: 20 + gear: 20 + colors.plate.emissive ?= colors.plate.color colors.bulb.emissive ?= colors.bulb.color colors.raster ?= {} @@ -292,6 +300,8 @@ class World extends Actor 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 + if shininess[k]? + mat.shininess = v.shininess ? shininess[k] # 000 000 0000000 000 000 000000000 # 000 000 000 000 000 000 @@ -320,8 +330,8 @@ class World extends Actor exitLevel: (action) => @finish() - log "world.level_index #{world.level_index} nextLevel #{World.levels.list[world.level_index+1]}" - world.create World.levels.list[world.level_index+1] + # log "world.level_index #{world.level_index} nextLevel #{World.levels.list[world.level_index+1]}" + world.create World.levels.list[world.level_index+(_.isNumber(action) and action or 1)] activate: (objectName) -> @getObjectWithName(objectName)?.setActive? true @@ -896,6 +906,7 @@ class World extends Actor when '-' then @speed = Math.max 1, @speed-1 when 'r' then @restart() when 'n' then @exitLevel() + when 'm' then @exitLevel 5 modKeyComboEventUp: (mod, key, combo, event) -> return if @player?.modKeyComboEventUp mod, key, combo, event diff --git a/img/shot07.png b/img/shot07.png new file mode 100644 index 0000000..9e99708 Binary files /dev/null and b/img/shot07.png differ diff --git a/img/shot08.png b/img/shot08.png new file mode 100644 index 0000000..af47fcc Binary files /dev/null and b/img/shot08.png differ diff --git a/img/shot09.png b/img/shot09.png new file mode 100644 index 0000000..aa6d702 Binary files /dev/null and b/img/shot09.png differ diff --git a/img/shot10.png b/img/shot10.png new file mode 100644 index 0000000..25dfa66 Binary files /dev/null and b/img/shot10.png differ diff --git a/img/shot11.png b/img/shot11.png new file mode 100644 index 0000000..c6949be Binary files /dev/null and b/img/shot11.png differ diff --git a/levels.txt b/levels.txt new file mode 100644 index 0000000..b9270c6 --- /dev/null +++ b/levels.txt @@ -0,0 +1,107 @@ +0 size: 7 7 13 'steps' scheme: 'default' +1 size: 7 5 11 'start' scheme: 'default' +2 size: 7 7 7 'move' scheme: 'red' +3 size: 9 7 9 'electro' scheme: 'metal' +4 size: 9 5 7 'elevate' scheme: 'bronze' +5 size: 7 7 13 'jump' scheme: 'red' +6 size: 18 12 5 'blocks' scheme: 'default' +7 size: 5 7 7 'throw' scheme: 'tron' +8 size: 3 11 3 'gold' scheme: 'yellow' +9 size: 7 9 7 'escape' scheme: 'metal' +10 size: 9 9 9 'gears' scheme: 'blue' +11 size: 10 10 10 'gamma' scheme: 'tron' +12 size: 5 5 5 'cube' scheme: 'red' +13 size: 7 7 7 'switch' scheme: 'tron' +14 size: 5 5 7 'mini' scheme: 'tron' +15 size: 9 9 9 'bombs' scheme: 'red' +16 size: 9 9 6 'sandbox' scheme: 'bronze' +17 size: 9 17 9 'energy' scheme: 'default' +18 size: 4 4 4 'maze' scheme: 'default' +world.unsetObject [WARNING] no cell at pos: +x 3 +y 3 +z 4 +world.unsetObject [WARNING] no cell at pos: +x 5 +y 1 +z 3 +world.unsetObject [WARNING] no cell at pos: +x 2 +y 1 +z 6 +world.unsetObject [WARNING] no cell at pos: +x 6 +y 1 +z 2 +world.unsetObject [WARNING] no cell at pos: +x 3 +y 1 +z 3 +world.unsetObject [WARNING] no cell at pos: +x 5 +y 1 +z 5 +world.unsetObject [WARNING] no cell at pos: +x 6 +y 1 +z 6 +19 size: 13 13 13 'love' scheme: 'red' +20 size: 9 9 5 'chain' scheme: 'candy' +world.unsetObject [WARNING] no cell at pos: +x 6 +y 0 +z 7 +21 size: 9 9 15 'towers' scheme: 'metal' +22 size: 7 7 7 'edge' scheme: 'candy' +23 size: 21 21 21 'random' scheme: 'default' +24 size: 7 7 9 'plate' scheme: 'blue' +25 size: 11 11 11 'nice' scheme: 'tron' +26 size: 9 9 9 'entropy' scheme: 'green' +27 size: 11 11 11 'neutron' scheme: 'neutron' +28 size: 9 9 9 'strange' scheme: 'default' +29 size: 9 9 9 'core' scheme: 'green' +30 size: 9 11 15 'slick' scheme: 'tron' +31 size: 9 9 5 'bridge' scheme: 'red' +32 size: 7 7 11 'flower' scheme: 'metal' +33 size: 11 11 12 'stones' scheme: 'blue' +34 size: 7 5 5 'walls' scheme: 'default' +1 0 0 +1 0 1 +1 0 2 +35 size: 9 9 9 'grid' scheme: 'candy' +36 size: 9 7 9 'rings' scheme: 'default' +37 size: 9 6 9 'bronze' scheme: 'bronze' +38 size: 11 11 11 'pool' scheme: 'green' +39 size: 11 11 11 'grasp' scheme: 'blue' +40 size: 13 15 13 'fallen' scheme: 'blue' +41 size: 11 12 7 'cheese' scheme: 'yellow' +42 size: 9 5 5 'invisimaze' scheme: 'yellow' +43 size: 5 25 5 'spiral' scheme: 'zen' +44 size: 9 9 9 'hidden' scheme: 'metal' +45 size: 5 7 5 'church' scheme: 'yellow' +46 size: 11 11 11 'mesh' scheme: 'default' +47 size: 7 9 7 'columns' scheme: 'green' +48 size: 5 5 9 'machine' scheme: 'tron' +49 size: 9 9 9 'captured' scheme: 'default' +50 size: 9 9 9 'circuit' scheme: 'tron' +51 size: 7 3 9 'regal' scheme: 'bronze' +52 size: 11 9 11 'conductor' scheme: 'default' +53 size: 13 5 13 'evil' scheme: 'red' +54 size: 9 9 9 'mutants' scheme: 'blue' +-1 size: 0 0 0 'undefined' scheme: 'default' +world.unsetObject [WARNING] no cell at pos: +x 8 +y 0 +z 1 +world.unsetObject [WARNING] no cell at pos: +x 6 +y 4 +z 0 +world.unsetObject [WARNING] no cell at pos: +x 4 +y 3 +z 7 +world.unsetObject [WARNING] no cell at pos: +x 1 +y 3 +z 6 diff --git a/screenShot.png b/screenShot.png deleted file mode 100644 index f8f8a66..0000000 Binary files a/screenShot.png and /dev/null differ