help
This commit is contained in:
parent
8a3e6e43f9
commit
8ec96ec4f0
|
@ -16,7 +16,7 @@ _ = require 'lodash'
|
|||
class Actor extends Emitter
|
||||
|
||||
constructor: ->
|
||||
@actions = []
|
||||
@actions = {}
|
||||
@events = []
|
||||
super
|
||||
|
||||
|
@ -49,7 +49,8 @@ class Actor extends Emitter
|
|||
# 000 000 000 000 000 000 000 000 0000
|
||||
# 000 000 0000000 000 000 0000000 000 000
|
||||
|
||||
addAction: (action) -> @actions[action.id] = action
|
||||
# addAction: (action) -> @actions[action.id] = action
|
||||
addAction: (action) -> @actions[action.name] = action
|
||||
|
||||
del: -> @deleteActions()
|
||||
|
||||
|
@ -57,23 +58,11 @@ class Actor extends Emitter
|
|||
a?.del() for a in @actions
|
||||
@actions = []
|
||||
|
||||
removeAction: (action) -> @actions[action.id] = null
|
||||
# removeAction: (action) -> @actions[action.id] = null
|
||||
removeAction: (action) -> @actions[action.name] = null
|
||||
|
||||
getActionWithId: (actionId) -> _.find @actions, (a) -> a?.id == actionId
|
||||
# if @actions[actionId]?.id? and @actions[actionId].id != actionId
|
||||
# throw new Error
|
||||
# @actions[actionId]
|
||||
# if actionId < @actions.length and @actions[actionId].id == actionId
|
||||
# return @actions[actionId]
|
||||
#
|
||||
# # to be deleted...
|
||||
# log "[WARNING] Actor.getActionWithId #{actionId} [#{@actions.length}]", (a?.id for a in @actions)
|
||||
# for a in @actions
|
||||
# return a if a?.id == actionId
|
||||
|
||||
getActionWithName: (name) ->
|
||||
for a in @actions
|
||||
return a if a?.name == name
|
||||
getActionWithName: (name) -> _.find @actions, (a) -> a?.name == name
|
||||
|
||||
initAction: ->
|
||||
performAction: ->
|
||||
|
|
|
@ -10,11 +10,8 @@ module.exports =
|
|||
scheme: "red"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
to get to the exit,
|
||||
use the bombs
|
||||
use the bombs.
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,0,4]
|
||||
|
|
|
@ -10,16 +10,14 @@ module.exports =
|
|||
scheme: "red"
|
||||
size: [9,9,5]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
to activate the exit,
|
||||
feed it with electricity:
|
||||
|
||||
connect the generator
|
||||
with the motor
|
||||
with the motor.
|
||||
|
||||
place a wire stone
|
||||
next to the exit
|
||||
next to the exit.
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,1,0]
|
||||
|
|
|
@ -10,16 +10,13 @@ module.exports =
|
|||
scheme: "bronze"
|
||||
size: [9,6,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit
|
||||
feed it with electricity:
|
||||
|
||||
connect the generator
|
||||
with the motor
|
||||
and close the circuit
|
||||
with the wire stones"
|
||||
with the wire stones.
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,0,5]
|
||||
|
|
|
@ -12,11 +12,8 @@ module.exports =
|
|||
scheme: "default"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
to get to the exit,
|
||||
move the stones
|
||||
move the stones.
|
||||
"""
|
||||
player:
|
||||
coordinates: [2,3,2]
|
||||
|
|
|
@ -11,9 +11,6 @@ module.exports =
|
|||
scheme: "yellow"
|
||||
size: [11,12,7]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit.
|
||||
|
||||
to activate the exit,
|
||||
activate all switches.
|
||||
"""
|
||||
|
|
|
@ -10,17 +10,14 @@ module.exports =
|
|||
scheme: "bronze"
|
||||
size: [5,7,5]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit,
|
||||
feed it with electricity:
|
||||
|
||||
connect the generator
|
||||
with the motor
|
||||
with the motor.
|
||||
|
||||
place a wire stone
|
||||
next to the exit
|
||||
next to the exit.
|
||||
"""
|
||||
player:
|
||||
coordinates: [2,1,1]
|
||||
|
|
|
@ -12,11 +12,8 @@ module.exports =
|
|||
scheme: "tron"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit
|
||||
feed it with electricity
|
||||
feed it with electricity.
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,5,3]
|
||||
|
|
|
@ -10,11 +10,8 @@ module.exports =
|
|||
scheme: "green"
|
||||
size: [7,9,7]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
to get to the exit,
|
||||
use the stones
|
||||
use the stones.
|
||||
"""
|
||||
player:
|
||||
coordinates: [3,7,0]
|
||||
|
|
|
@ -11,17 +11,14 @@ module.exports =
|
|||
scheme: "default"
|
||||
size: [11,9,11]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit
|
||||
feed it with electricity:
|
||||
|
||||
connect the generator
|
||||
with the motor
|
||||
with the motor.
|
||||
|
||||
and place a powered wirestone
|
||||
next to the exit
|
||||
next to the exit.
|
||||
"""
|
||||
player:
|
||||
coordinates: [6,2,0]
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports =
|
|||
design: "Michael Abel"
|
||||
scheme: "candy"
|
||||
size: [7,7,7]
|
||||
help: "$scale(1.5)mission:\nget to the exit!"
|
||||
help: "get to the exit!"
|
||||
player:
|
||||
coordinates: [3,0,5]
|
||||
orientation: ZupY
|
||||
|
|
|
@ -10,14 +10,11 @@ module.exports =
|
|||
scheme: "metal"
|
||||
size: [9,7,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit
|
||||
feed it with electricity:
|
||||
|
||||
connect the generator
|
||||
with the motor
|
||||
with the motor.
|
||||
"""
|
||||
player:
|
||||
coordinates: [2,3,5]
|
||||
|
|
|
@ -10,19 +10,12 @@ module.exports =
|
|||
scheme: "bronze"
|
||||
size: [9,5,7]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit,
|
||||
feed it with electricity
|
||||
|
||||
use the bombs
|
||||
to elevate the gears
|
||||
|
||||
and the generator
|
||||
and the generator.
|
||||
|
||||
the bombs will detonate
|
||||
if you shoot them
|
||||
if you shoot them.
|
||||
"""
|
||||
player:
|
||||
coordinates: [8,0,3]
|
||||
|
|
|
@ -10,11 +10,8 @@ module.exports =
|
|||
scheme: "default"
|
||||
size: [9,17,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit,
|
||||
shoot the 4 switches
|
||||
shoot the 4 switches.
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,4,5]
|
||||
|
|
|
@ -12,10 +12,8 @@ module.exports =
|
|||
scheme: "green"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
use the stones to reach it
|
||||
use the stones
|
||||
to reach the exit.
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,3,2]
|
||||
|
|
|
@ -10,18 +10,12 @@ module.exports =
|
|||
scheme: "metal"
|
||||
size: [7,9,7]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
try to escape!
|
||||
|
||||
to escape,
|
||||
activate the exit
|
||||
|
||||
to activate the exit,
|
||||
shoot the switch
|
||||
shoot the switch.
|
||||
|
||||
to be able to
|
||||
shoot the switch,
|
||||
move the stones
|
||||
move the stones.
|
||||
"""
|
||||
player:
|
||||
coordinates: [3,0,4]
|
||||
|
|
|
@ -7,22 +7,18 @@
|
|||
|
||||
module.exports =
|
||||
name: "evil"
|
||||
design: "Michael Abel?"
|
||||
design: "Michael Abel"
|
||||
scheme: "red"
|
||||
size: [13,5,13]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
place a powered
|
||||
wire stone next to it.
|
||||
place a powered wire stone
|
||||
next to the exit.
|
||||
a wirestone is powered by
|
||||
a rotating generator
|
||||
or it shares at least
|
||||
one edge with
|
||||
another powered wirestone.
|
||||
this one is hard,
|
||||
really hard,
|
||||
but it's possible.
|
||||
|
||||
good luck!
|
||||
|
|
|
@ -11,16 +11,10 @@ module.exports =
|
|||
scheme: "blue"
|
||||
size: [13,15,13]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
to get to the exit,
|
||||
jump and fall off the stones
|
||||
jump and fall off the stones.
|
||||
try to jump so that you
|
||||
land on other stones
|
||||
if you fall, there is a stone
|
||||
on ground to help get back on
|
||||
you have to fall of this stone, as well
|
||||
land on other stones.
|
||||
"""
|
||||
player:
|
||||
coordinates: [0,6,2]
|
||||
|
|
|
@ -6,11 +6,8 @@ module.exports =
|
|||
scheme: "metal"
|
||||
size: [7,7,11]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
the green stone is slicky
|
||||
you can't grab it while falling
|
||||
you can't grab it while falling.
|
||||
"""
|
||||
player:
|
||||
coordinates: [3,0,7]
|
||||
|
|
|
@ -13,10 +13,8 @@ module.exports =
|
|||
scheme: "tron"
|
||||
size: [10,10,10]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
shoot at the 4 switches to activate the exit
|
||||
shoot at the 4 switches
|
||||
to activate the exit.
|
||||
"""
|
||||
player:
|
||||
coordinates: [5,5,4]
|
||||
|
|
|
@ -3,16 +3,13 @@ module.exports =
|
|||
scheme: "blue"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit
|
||||
feed it with electricity:
|
||||
|
||||
connect the generator
|
||||
with the motor
|
||||
and close the circuit
|
||||
with the wire stones
|
||||
with the wire stones.
|
||||
"""
|
||||
player:
|
||||
position: [0,0,0]
|
||||
|
|
|
@ -10,10 +10,8 @@ module.exports =
|
|||
scheme: "yellow"
|
||||
size: [3,11,3]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
move the stones to reach it
|
||||
move the stones
|
||||
to reach the exit.
|
||||
"""
|
||||
player:
|
||||
coordinates: [1,1,0]
|
||||
|
|
|
@ -11,8 +11,6 @@ module.exports =
|
|||
scheme: "blue"
|
||||
size: [11,11,11]
|
||||
help: """
|
||||
$scale(1.5)mission:activate the exit!
|
||||
|
||||
to shoot, press $key(shoot)
|
||||
"""
|
||||
player:
|
||||
|
|
|
@ -3,16 +3,17 @@ module.exports =
|
|||
scheme: "green"
|
||||
size: [13,5,13]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
place a powered
|
||||
wire stone next to it.
|
||||
wire stone next to the exit.
|
||||
|
||||
a wirestone is powered by
|
||||
a rotating generator
|
||||
or it shares at least one edge with
|
||||
another powered wirestone.
|
||||
this one is hard, really hard, but it's possible.
|
||||
|
||||
this one is hard,
|
||||
but it's possible.
|
||||
|
||||
good luck!
|
||||
"""
|
||||
player: position: [1,1,1]
|
||||
|
|
|
@ -3,10 +3,8 @@ module.exports =
|
|||
scheme: "crazy"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
to get to the exit,
|
||||
use the stones
|
||||
use the stones.
|
||||
"""
|
||||
player:
|
||||
coordinates: [3,4,8]
|
||||
|
|
|
@ -10,14 +10,11 @@ module.exports =
|
|||
scheme: "metal"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit,
|
||||
activate the 5 switches
|
||||
activate the 5 switches.
|
||||
|
||||
use the stones to
|
||||
reach the exit
|
||||
reach the exit.
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,8,2]
|
||||
|
|
|
@ -10,13 +10,14 @@ module.exports =
|
|||
scheme: "red"
|
||||
size: [7,7,13]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
jump on the stones
|
||||
to reach the exit.
|
||||
|
||||
jump on the stones to reach it
|
||||
|
||||
you can attach to a stone when falling
|
||||
if you move into its direction
|
||||
you can attach
|
||||
to a stone
|
||||
when falling
|
||||
if you move
|
||||
into its direction.
|
||||
"""
|
||||
player:
|
||||
coordinates: [3,6,4]
|
||||
|
|
|
@ -2,7 +2,7 @@ module.exports =
|
|||
name: "love"
|
||||
scheme: "red"
|
||||
size: [13,13,13]
|
||||
help: "$scale(1.5)mission:\nget to the exit!"
|
||||
help: "get to the exit!"
|
||||
player:
|
||||
coordinates: [6,4,2]
|
||||
orientation: minusZupY
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports =
|
|||
deisgn: 'Michael Abel'
|
||||
scheme: "tron"
|
||||
size: [5,5,9]
|
||||
help: "$scale(1.5)mission:\nactivate the exit!"
|
||||
help: "activate the exit!"
|
||||
player:
|
||||
coordinates: [1,2,2]
|
||||
orientation: minusZupX
|
||||
|
|
|
@ -13,7 +13,6 @@ module.exports =
|
|||
size: [4,4,4]
|
||||
camera: 'inside'
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
but don't get confused :)
|
||||
"""
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports =
|
|||
design: 'Michael Abel'
|
||||
scheme: "default"
|
||||
size: [11,11,11]
|
||||
help: "$scale(1.5)mission:\nget to the exit!"
|
||||
help: "get to the exit!"
|
||||
player:
|
||||
coordinates: [6,10,5]
|
||||
orientation: YdownZ
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports =
|
|||
design: 'Michael Abel'
|
||||
scheme: "tron"
|
||||
size: [5,5,7]
|
||||
help: "$scale(1.5)mission:\nget to the exit!"
|
||||
help: "get to the exit!"
|
||||
player:
|
||||
coordinates: [2,1,0]
|
||||
orientation: minusYupZ
|
||||
|
|
|
@ -10,12 +10,11 @@ module.exports =
|
|||
scheme: "red"
|
||||
size: [7,7,7]
|
||||
help: """
|
||||
$scale(1.5)mission: activate the exit!
|
||||
to activate the exit, activate the switch
|
||||
to activate the switch,shoot it
|
||||
to be able to shoot the switch, move the stones
|
||||
to move a stone, press "$key(push)" while moving
|
||||
to shoot, press "$key(shoot)"
|
||||
shoot the switch
|
||||
to activate the exit.
|
||||
|
||||
"shift+w" to move the stone.
|
||||
"return" to shoot.
|
||||
"""
|
||||
player:
|
||||
coordinates: [3,3,2]
|
||||
|
|
|
@ -3,15 +3,14 @@ module.exports =
|
|||
scheme: "blue"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
deactivate the mutants!
|
||||
|
||||
to deactivate a mutant,
|
||||
shoot him until it get's transparent
|
||||
shoot him until it get's transparent.
|
||||
|
||||
the exit will open,
|
||||
when all mutant bots
|
||||
are deactivated
|
||||
are deactivated.
|
||||
"""
|
||||
player:
|
||||
coordinates: [7,1,8]
|
||||
|
|
|
@ -11,7 +11,6 @@ module.exports =
|
|||
scheme: "tron"
|
||||
size: [11,11,11]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
it looks simpler than it is.
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports =
|
|||
design: 'Michael Abel'
|
||||
scheme: "tron"
|
||||
size: [11,11,11]
|
||||
help: "$scale(1.5)mission:\nget to the exit!"
|
||||
help: "get to the exit!"
|
||||
player:
|
||||
coordinates: [7,4,0]
|
||||
orientation: minusZdownY
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports =
|
|||
design: 'Michael Abel'
|
||||
scheme: "green"
|
||||
size: [11,11,11]
|
||||
help: "$scale(1.5)mission:\nget to the exit!"
|
||||
help: "get to the exit!"
|
||||
player:
|
||||
coordinates: [5,9,6]
|
||||
orientation: ZdownY
|
||||
|
|
|
@ -11,10 +11,9 @@ module.exports =
|
|||
scheme: "default"
|
||||
size: [21,21,21]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
jump and try
|
||||
jump and try.
|
||||
"""
|
||||
player:
|
||||
coordinates: [0,10,1]
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports =
|
|||
name: "regal"
|
||||
scheme: "bronze"
|
||||
size: [7,3,9]
|
||||
help: "$scale(1.5)mission:\nactivate the exit!"
|
||||
help: "activate the exit!"
|
||||
player:
|
||||
coordinates: [3,2,4]
|
||||
orientation: XdownY
|
||||
|
|
|
@ -10,10 +10,8 @@ module.exports =
|
|||
scheme: "default"
|
||||
size: [9,7,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
to get to the exit,
|
||||
use the stones
|
||||
use the stones.
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,4,2]
|
||||
|
|
|
@ -11,10 +11,9 @@ module.exports =
|
|||
scheme: "bronze"
|
||||
size: [9,9,6]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
All you have to do
|
||||
all you have to do
|
||||
is to put nine stones
|
||||
into the sandbox
|
||||
and shoot at the switch
|
||||
|
|
|
@ -12,10 +12,8 @@ module.exports =
|
|||
scheme: "tron"
|
||||
size: [9,11,15]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
The green stone is slicky
|
||||
you can't grab it while falling
|
||||
the green stone is slicky
|
||||
you can't grab it while falling.
|
||||
"""
|
||||
player:
|
||||
coordinates: [0,10,13]
|
||||
|
|
|
@ -10,15 +10,12 @@ module.exports =
|
|||
scheme: "default"
|
||||
size: [7,5,11]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
to get to the exit,
|
||||
jump on the stone
|
||||
to jump,
|
||||
press "$key(jump)" while moving
|
||||
to move, press "$key(move forward)" or "$key(move backward)"
|
||||
to turn, press "$key(turn left)" or "$key(turn right)"
|
||||
jump on the stones.
|
||||
|
||||
"w" or "d" to move.
|
||||
"a" or "s" to turn.
|
||||
"space" to jump.
|
||||
"""
|
||||
player:
|
||||
coordinates: [1,0,4]
|
||||
|
|
|
@ -7,17 +7,13 @@
|
|||
|
||||
module.exports =
|
||||
name: "steps"
|
||||
# scheme: "blue"
|
||||
size: [7,7,13]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
to get to the exit,
|
||||
jump on the stones
|
||||
to jump, press "$key(jump)" while moving
|
||||
to move, press "$key(move forward)" or "$key(move backward)",
|
||||
to turn, press "$key(turn left)" or "$key(turn right)"
|
||||
jump on the stones.
|
||||
|
||||
"w" to move forward.
|
||||
"space" to jump.
|
||||
"""
|
||||
player:
|
||||
coordinates: [3,0,1]
|
||||
|
|
|
@ -3,13 +3,9 @@ module.exports =
|
|||
scheme: "blue"
|
||||
size: [11,11,12]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
use the stones.
|
||||
to move a stone,
|
||||
press "$key(push)"
|
||||
while moving
|
||||
press "shift+w"
|
||||
"""
|
||||
player:
|
||||
coordinates: [4,5,3]
|
||||
|
|
|
@ -11,17 +11,14 @@ module.exports =
|
|||
scheme: "default"
|
||||
size: [9,9,9]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit,
|
||||
feed it with electricity:
|
||||
|
||||
connect the generator
|
||||
with the motor
|
||||
with the motor.
|
||||
|
||||
place a wire stone
|
||||
next to the exit
|
||||
next to the exit.
|
||||
"""
|
||||
player:
|
||||
coordinates: [5,4,6]
|
||||
|
|
|
@ -10,9 +10,6 @@ module.exports =
|
|||
scheme: "tron"
|
||||
size: [7,7,7]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
activate the exit!
|
||||
|
||||
to activate the exit,
|
||||
activate the 4 switches.
|
||||
"""
|
||||
|
|
|
@ -12,13 +12,11 @@ module.exports =
|
|||
scheme: "tron"
|
||||
size: [5,7,7]
|
||||
help: """
|
||||
"$scale(1.5)mission:
|
||||
get to the exit!
|
||||
|
||||
use the stones to reach it
|
||||
use the stones
|
||||
to reach the exit.
|
||||
|
||||
push a stone and it will fall down
|
||||
if nothing is below it
|
||||
if nothing is below it.
|
||||
but remember:
|
||||
you decide where down and below is!
|
||||
"""
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports =
|
|||
design: 'Ben "mrthoughtful" Griffin'
|
||||
scheme: "metal"
|
||||
size: [9,9,15]
|
||||
help: "$scale(1.5)mission:\nget to the exit!\n\nto get to the exit,\nmove the stones"
|
||||
help: "to get to the exit,\nmove the stones."
|
||||
player:
|
||||
coordinates: [4,5,3]
|
||||
orientation: ZdownX
|
||||
|
|
|
@ -11,13 +11,11 @@ module.exports =
|
|||
scheme: "red"
|
||||
size: [7,5,5]
|
||||
help: """
|
||||
$scale(1.5)mission:
|
||||
|
||||
get to the exit!
|
||||
|
||||
The exit is hidden
|
||||
in the middle of
|
||||
the central wall
|
||||
the central wall.
|
||||
"""
|
||||
player:
|
||||
coordinates: [0,4,2]
|
||||
|
|
|
@ -35,7 +35,11 @@ module.exports =
|
|||
text: new THREE.MeshPhongMaterial
|
||||
side: THREE.FrontSide
|
||||
shading: THREE.SmoothShading
|
||||
specular: 0xffff00
|
||||
transparent: true
|
||||
|
||||
menu: new THREE.MeshPhongMaterial
|
||||
side: THREE.FrontSide
|
||||
shading: THREE.SmoothShading
|
||||
transparent: true
|
||||
|
||||
mutant: new THREE.MeshPhongMaterial
|
||||
|
|
|
@ -6,22 +6,61 @@
|
|||
# 000 000 00000000 000 000 0000000
|
||||
|
||||
ScreenText = require './screentext'
|
||||
Action = require './action'
|
||||
Material = require './material'
|
||||
|
||||
class Menu extends ScreenText
|
||||
|
||||
constructor: ->
|
||||
@current = 0
|
||||
@callbacks = []
|
||||
@lineHeight = 1.1
|
||||
super
|
||||
@getActionWithId(Action.SHOW).duration = 250
|
||||
@getActionWithId(Action.HIDE).duration = 200
|
||||
|
||||
del: ->
|
||||
world.menu = null
|
||||
super
|
||||
|
||||
addItem: (text, cb) ->
|
||||
@callbacks.push cb
|
||||
@addText text
|
||||
|
||||
show: ->
|
||||
world.playSound 'MENU_FADE'
|
||||
@setCurrent @current
|
||||
super
|
||||
|
||||
setCurrent: (current) ->
|
||||
@current = (@mesh.children.length + current) % @mesh.children.length
|
||||
for ci in [0...@mesh.children.length]
|
||||
m = ci == @current and Material.menu or Material.text
|
||||
o = @mesh.children[ci].material.opacity
|
||||
@mesh.children[ci].material = m.clone()
|
||||
@mesh.children[ci].material.opacity = o
|
||||
z = ci == @current and 4 or 0
|
||||
@mesh.children[ci].position.set @mesh.children[ci].position.x, @mesh.children[ci].position.y, z
|
||||
|
||||
next: ->
|
||||
world.playSound 'MENU_ITEM'
|
||||
@setCurrent @current + 1
|
||||
prev: ->
|
||||
world.playSound 'MENU_ITEM'
|
||||
@setCurrent @current - 1
|
||||
|
||||
modKeyComboEvent: (mod, key, combo, event) ->
|
||||
switch key
|
||||
when 'esc'
|
||||
world.playSound 'MENU_ABORT'
|
||||
@fadeOut()
|
||||
when 'down', 'right', 's', 'd'
|
||||
@next()
|
||||
when 'left', 'up', 'w', 'a'
|
||||
@prev()
|
||||
when 'enter'
|
||||
world.playSound 'MENU_SELECT'
|
||||
@callbacks[@current]()
|
||||
@fadeOut()
|
||||
|
||||
module.exports = Menu
|
||||
|
|
|
@ -21,15 +21,14 @@ class ScreenText extends Actor
|
|||
|
||||
constructor: (text) ->
|
||||
super
|
||||
|
||||
@addAction new Action @, Action.SHOW, "show", 500
|
||||
@addAction new Action @, Action.HIDE, "hide", 500
|
||||
@addAction new Action @, Action.SHOW, "show#{@constructor.name}", 500
|
||||
@addAction new Action @, Action.HIDE, "hide#{@constructor.name}", 500
|
||||
|
||||
@scene = new THREE.Scene()
|
||||
|
||||
sun = new THREE.PointLight 0xffffff
|
||||
sun.position.set -1,1,10
|
||||
@scene.add sun
|
||||
@lineHeight = 1.3 if not @lineHeight?
|
||||
@sun = new THREE.PointLight 0xffffff
|
||||
@sun.position.set -1,1,10
|
||||
@scene.add @sun
|
||||
|
||||
@width = @height = 0
|
||||
@mesh = new THREE.Object3D
|
||||
|
@ -40,13 +39,15 @@ class ScreenText extends Actor
|
|||
@far = 100
|
||||
@camera = new THREE.PerspectiveCamera @fov, @aspect, @near, @far
|
||||
if text?
|
||||
@addText text
|
||||
for l in text.split '\n'
|
||||
@addText l
|
||||
@show()
|
||||
|
||||
del: ->
|
||||
@scene.remove @mesh
|
||||
@scene.remove @sun
|
||||
Timer.removeActionsOfObject @
|
||||
world.text = null
|
||||
world.text = null if world.text == @
|
||||
|
||||
show: -> @startTimedAction @getActionWithId Action.SHOW
|
||||
|
||||
|
@ -54,7 +55,7 @@ class ScreenText extends Actor
|
|||
geom = new THREE.TextGeometry str,
|
||||
font: ScreenText.font
|
||||
size: 1
|
||||
height: 0.5
|
||||
height: 4
|
||||
bevelEnabled: true
|
||||
bevelThickness: 0.1
|
||||
bevelSize: 0.04
|
||||
|
@ -63,17 +64,23 @@ class ScreenText extends Actor
|
|||
geom.computeBoundingBox()
|
||||
min = geom.boundingBox.min
|
||||
max = geom.boundingBox.max
|
||||
mesh = new THREE.Mesh geom, Material.text
|
||||
mesh = new THREE.Mesh geom, Material.text.clone()
|
||||
mesh.translateX -(max.x-min.x)/2
|
||||
mesh.translateY -@height
|
||||
mesh.translateY -@height * @lineHeight
|
||||
@mesh.add mesh
|
||||
@mesh.position.set 0, @height/2*0.9, 0
|
||||
@mesh.position.set 0, @height/2*@lineHeight, 0
|
||||
|
||||
# adjust projection
|
||||
@camera.position.copy new Vector 0,0,12+5*@height
|
||||
# adjust projection
|
||||
z = 20+4*@height
|
||||
@camera.position.copy new Vector 0,0,z
|
||||
@sun.position.set -z/5,z/5,z
|
||||
@camera.lookAt new Vector 0,0,0
|
||||
@height += 1
|
||||
|
||||
setOpacity: (o) ->
|
||||
for c in @mesh.children
|
||||
c.material.opacity = o
|
||||
|
||||
resized: (w,h) ->
|
||||
@aspect = w/h
|
||||
@camera.aspect = @aspect
|
||||
|
@ -82,16 +89,16 @@ class ScreenText extends Actor
|
|||
performAction: (action) ->
|
||||
switch action.id
|
||||
when Action.SHOW
|
||||
Material.text.opacity = action.getRelativeTime()
|
||||
@setOpacity action.getRelativeTime()
|
||||
when Action.HIDE
|
||||
Material.text.opacity = 1 - action.getRelativeTime()
|
||||
@setOpacity 1 - action.getRelativeTime()
|
||||
|
||||
actionFinished: (action) ->
|
||||
switch action.id
|
||||
when Action.HIDE
|
||||
@del()
|
||||
when Action.SHOW
|
||||
Material.text.opacity = 1
|
||||
@setOpacity 1
|
||||
|
||||
fadeOut: ->
|
||||
return if @fadingOut
|
||||
|
|
|
@ -29,9 +29,8 @@ class Sound
|
|||
SWITCH_OFF: file: "switch_on.wav", volume: 0.5
|
||||
ATOM_BIRTH: file: "atom_digest.wav", volume: 1.0
|
||||
ATOM_DIGEST: file: "atom_digest.wav", volume: 1.0
|
||||
SPIKES_START: file: "bot_move.wav", volume: 1.0
|
||||
MENU_FADE: file: "menu_fade.wav", volume: 1.0
|
||||
MENU_ITEM: file: "menu_item.wav", volume: 1.0
|
||||
MENU_FADE: file: "stone_land.wav", volume: 1.0
|
||||
MENU_ITEM: file: "menu_item.wav", volume: 0.5
|
||||
MENU_SELECT: file: "menu_select.wav", volume: 1.0
|
||||
MENU_ABORT: file: "menu_abort.wav", volume: 1.0
|
||||
GATE_OPEN: file: "gate_open.wav", volume: 1.0
|
||||
|
|
|
@ -257,7 +257,7 @@ class World extends Actor
|
|||
|
||||
@creating = false
|
||||
|
||||
restart: () -> @create @dict
|
||||
restart: => @create @dict
|
||||
|
||||
finish: () -> # TODO: save progress
|
||||
|
||||
|
@ -290,10 +290,12 @@ class World extends Actor
|
|||
|
||||
colors.plate.emissive ?= colors.plate.color
|
||||
colors.bulb.emissive ?= colors.bulb.color
|
||||
colors.menu ?= {}
|
||||
colors.menu.color ?= colors.gear.color
|
||||
colors.raster ?= {}
|
||||
colors.raster.color ?= colors.plate.color
|
||||
colors.raster.color ?= colors.plate.color
|
||||
colors.wall ?= {}
|
||||
colors.wall.color ?= new THREE.Color(colors.plate.color).multiplyScalar 0.6
|
||||
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
|
||||
|
@ -778,39 +780,16 @@ class World extends Actor
|
|||
|
||||
false
|
||||
|
||||
reinit: () ->
|
||||
for o in @objects
|
||||
if o instanceof Light
|
||||
o.initialize()
|
||||
|
||||
# Text::reinit()
|
||||
|
||||
# 000 000 00000000 000 00000000
|
||||
# 000 000 000 000 000 000
|
||||
# 000000000 0000000 000 00000000
|
||||
# 000 000 000 000 000
|
||||
# 000 000 00000000 0000000 000
|
||||
|
||||
help: (index=0) ->
|
||||
# displays help messages
|
||||
showHelp: =>
|
||||
# @menu.del()
|
||||
@text = new ScreenText @dict['help']
|
||||
|
||||
# text_list = @dict["help"]
|
||||
# more_text = index < len (text_list) - 1
|
||||
# less_text = index > 0
|
||||
#
|
||||
# list = text_list[index].split("$key(")
|
||||
# for i in range (1, len(list))
|
||||
# close = list[i].find(")")
|
||||
# list[i] = Controller.player.getKeyForAction (list[i][:close]) + list[i][close+1:]
|
||||
#
|
||||
# list.append ("\n\n$scale(0.5)(%d/%d)" % (index+1, len (text_list)))
|
||||
# help_text = KikiPageText ("".join(list), more_text, less_text)
|
||||
#
|
||||
# if more_text:
|
||||
# help_text.getEventWithName ("next").addAction (once (lambda i=index+1: @help (i)))
|
||||
# if less_text:
|
||||
# help_text.getEventWithName ("previous").addAction (once (lambda i=index-1: @help (i)))
|
||||
|
||||
outro: (index=0) ->
|
||||
# well hidden outro :-)
|
||||
outro_text = """
|
||||
|
@ -841,22 +820,22 @@ class World extends Actor
|
|||
|
||||
resetProjection: -> @player.camera.setViewport 0.0, 0.0, 1.0, 1.0
|
||||
|
||||
# 00000000 0000000 0000000
|
||||
# 000 000 000
|
||||
# 0000000 0000000 000
|
||||
# 000 000 000
|
||||
# 00000000 0000000 0000000
|
||||
# 00 00 00000000 000 000 000 000
|
||||
# 000 000 000 0000 000 000 000
|
||||
# 000000000 0000000 000 0 000 000 000
|
||||
# 000 0 000 000 000 0000 000 000
|
||||
# 000 000 00000000 000 000 0000000
|
||||
|
||||
localizedString: (str) -> str
|
||||
|
||||
escape: (self) -> # handles an ESC key event
|
||||
@text?.del()
|
||||
showMenu: (self) -> # handles an ESC key event
|
||||
# @text?.del()
|
||||
@menu = new Menu()
|
||||
@menu.addItem @localizedString("help"), @help
|
||||
@menu.addItem @localizedString("help"), @showHelp
|
||||
@menu.addItem @localizedString("restart"), @restart
|
||||
@menu.addItem @localizedString("load level"), @levelSelection
|
||||
@menu.addItem @localizedString("setup"), @quickSetup
|
||||
@menu.addItem @localizedString("about"), @displayAbout
|
||||
@menu.addItem @localizedString("load level"), @showLevels
|
||||
@menu.addItem @localizedString("setup"), @showSetup
|
||||
@menu.addItem @localizedString("about"), @showAbout
|
||||
@menu.addItem @localizedString("quit"), @quit
|
||||
@menu.show()
|
||||
|
||||
|
@ -913,7 +892,7 @@ class World extends Actor
|
|||
@text?.fadeOut()
|
||||
return if @player?.modKeyComboEventDown mod, key, combo, event
|
||||
switch combo
|
||||
when 'esc' then @escape()
|
||||
when 'esc' then @showMenu()
|
||||
when '=' then @speed = Math.min 10, @speed+1
|
||||
when '-' then @speed = Math.max 1, @speed-1
|
||||
when 'r' then @restart()
|
||||
|
|
Loading…
Reference in New Issue
Block a user