This commit is contained in:
monsterkodi 2016-08-16 00:49:10 +02:00
parent 23cd85bf04
commit 2e755f1d68
13 changed files with 159 additions and 113 deletions

View File

@ -60,12 +60,15 @@ class Action
if @object? then @object.removeAction @ if @object? then @object.removeAction @
@deleted = true @deleted = true
init: () -> @object.initAction @ init: () -> @object.initAction? @
perform: () -> @object.performAction @ perform: () -> @object.performAction? @
finish: () -> @object.finishAction @ finish: () -> @object.finishAction? @
finished: () -> finished: () ->
# log "Action.finished #{@name} #{@object?.actionFinished?}" # log "Action.finished #{@name} #{@object?.actionFinished?}"
@object.actionFinished @ if _.isFunction @object
@object @
else
@object.actionFinished @
return if @deleted return if @deleted
@reset() @reset()
# if @current >= @getDuration() # if keepRest wasn't called -> reset start and current values # if @current >= @getDuration() # if keepRest wasn't called -> reset start and current values
@ -121,7 +124,7 @@ class Action
@last = 0 @last = 0
if @mode == Action.CONTINUOUS if @mode == Action.CONTINUOUS
log 'Action.CONTINUOUS' log "action.performWithEvent #{@name} mode == Action.CONTINUOUS"
@current = @rest @current = @rest
@start = eventTime @start = eventTime
@last = 0 @last = 0

View File

@ -351,8 +351,9 @@ class Bot extends Pushable
@rest_orientation = Quaternion.rotationAroundVector 90.0, new Vector 0,1,0 @rest_orientation = Quaternion.rotationAroundVector 90.0, new Vector 0,1,0
if action.id != Action.CLIMB_UP if action.id != Action.CLIMB_UP
world.objectMovedFromPos @, @position # update world @position targetPos = @current_position.round()
@position = @current_position.round() world.objectMoved @, @position, targetPos # update world @position
@position = targetPos
if action.id != Action.JUMP_FORWARD and @rotate_action == null # if not jumping forward if action.id != Action.JUMP_FORWARD and @rotate_action == null # if not jumping forward
@orientation = @orientation.mul @rest_orientation # update rotation @orientation @orientation = @orientation.mul @rest_orientation # update rotation @orientation
@ -365,7 +366,7 @@ class Bot extends Pushable
# 000 000 000 000 000 0000000 000 000 00000000 0000000 # 000 000 000 000 000 0000000 000 000 00000000 0000000
actionFinished: (action) -> actionFinished: (action) ->
# log "bot.actionFinished #{action.name} #{action.id}"a # log "bot.actionFinished #{action.name} #{action.id}"
# if @isDead() # if @isDead()
# log "DIE!" # log "DIE!"
@ -386,7 +387,7 @@ class Bot extends Pushable
return return
if @move_action # action was not a move action -> return if @move_action # action was not a move action -> return
log 'action was not a move action -> return' # log 'bot.actionFinished was not a move action!'
return return
# find next action depending on type of finished action and surrounding environment # find next action depending on type of finished action and surrounding environment

View File

@ -21,13 +21,14 @@ class Cell
getOccupant: -> _.find @objects, (o) -> o.isSpaceEgoistic() getOccupant: -> _.find @objects, (o) -> o.isSpaceEgoistic()
removeObject: (object) -> removeObject: (object) ->
# log 'cell.removeObject ', @objects.length # log 'cell.removeObject', @objects.length
for o in @objects for o in @objects
o.cellMateLeft object if o != object o.cellMateLeft object if o != object
_.remove @objects, (o) -> o == object or o.object == object _.remove @objects, (o) -> o == object or o.object == object
# log 'cell.removedObject ', (o.name for o in @objects) # log 'cell.removedObject ', (o.name for o in @objects)
addObject: (object) -> addObject: (object) ->
# log "cell.addObject #{object.name}"
for o in @objects for o in @objects
o.newCellMate object o.newCellMate object
@objects.push object @objects.push object

View File

@ -6,11 +6,14 @@
log = require "/Users/kodi/s/ko/js/tools/log" log = require "/Users/kodi/s/ko/js/tools/log"
Vector = require './lib/vector'
Switch = require './switch' Switch = require './switch'
Action = require './action' Action = require './action'
class Gate extends Switch class Gate extends Switch
isSpaceEgoistic: -> false
constructor: (active) -> constructor: (active) ->
super active super active
@ENTER_EVENT = @addEventWithName "enter" @ENTER_EVENT = @addEventWithName "enter"
@ -19,12 +22,33 @@ class Gate extends Switch
@sound_on = 'GATE_OPEN' @sound_on = 'GATE_OPEN'
@sound_off = 'GATE_CLOSE' @sound_off = 'GATE_CLOSE'
createMesh: () -> super createMesh: () ->
# log 'gate.createMesh' torusRadius = 0.05
t1 = new THREE.TorusGeometry 0.5-torusRadius, torusRadius, 16, 32
@mat = new THREE.MeshPhongMaterial
color: 0xff0000
side: THREE.FrontSide
shading: THREE.SmoothShading
shininess: 5
@mesh = new THREE.Mesh t1, @mat
t2 = new THREE.TorusGeometry 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, @mat
@mesh.add @tors
@mesh
bulletImpact: ->
newCellMate: (object) -> newCellMate: (object) ->
if object == world.player and @active log "gate.newCellMate --------------------------- #{object.name} #{@active}"
if object.name == 'player' and @active
world.playSound 'GATE_WARP' world.playSound 'GATE_WARP'
log "gate.newCellMate --------------------------- trigger enter event actions"
@events[@ENTER_EVENT].triggerActions() @events[@ENTER_EVENT].triggerActions()
renderBar: (r,b,h) -> renderBar: (r,b,h) ->

View File

@ -24,6 +24,7 @@ class Item extends Actor
@move_action = null @move_action = null
del: -> del: ->
log "item del!!!!!!!!!!!!!!!!!!!!!! #{@name}"
world.scene.remove @mesh if @mesh? world.scene.remove @mesh if @mesh?
world.removeObject @ world.removeObject @
@emit 'deleted' @emit 'deleted'
@ -33,7 +34,7 @@ class Item extends Actor
bulletImpact: -> bulletImpact: ->
render: -> render: ->
isSpaceEgoistic: -> true isSpaceEgoistic: -> false
isSlippery: -> false isSlippery: -> false
setPosition: (x,y,z) -> setPosition: (x,y,z) ->

View File

@ -30,8 +30,8 @@ module.exports =
] ]
create: -> create: ->
world.addObjectAtPos 'KikiWall', world.decenter 0,0,3 world.addObjectAtPos 'KikiStone', world.decenter 0,0,3
world.addObjectAtPos 'KikiWall', world.decenter 0,-1,1 world.addObjectAtPos 'KikiWall', world.decenter 0,-1,1
world.addObjectAtPos 'KikiWall', world.decenter 0,-2,-1 world.addObjectAtPos 'KikiWall', world.decenter 0,-2,-1
world.addObjectAtPos 'KikiWall', world.decenter 0,-3,-3 world.addObjectAtPos 'KikiWall', world.decenter 0,-3,-3

View File

@ -11,6 +11,8 @@ Vector = require './lib/vector'
class Pushable extends Item class Pushable extends Item
isSpaceEgoistic: -> true
constructor: () -> constructor: () ->
super super
@pusher = null @pusher = null
@ -48,7 +50,7 @@ class Pushable extends Item
switch action.id switch action.id
when Action.PUSH, Action.FALL when Action.PUSH, Action.FALL
@move_action = null @move_action = null
world.objectMovedFromPos @, @position world.objectMoved @, @position, @current_position
# log "Pushable.finishAction setPosition #{@current_position}" # log "Pushable.finishAction setPosition #{@current_position}"
@setPosition @current_position @setPosition @current_position

View File

@ -4,16 +4,16 @@
# 000 000 000 000 000 0000 000 # 000 000 000 000 000 0000 000
# 0000000 000 0000000 000 000 00000000 # 0000000 000 0000000 000 000 00000000
Item = require './item' Pushable = require './pushable'
class Stone extends Item class Stone extends Pushable
constructor: -> constructor: (@slippery=false) ->
@geom = new THREE.BoxGeometry 1,1,1 @geom = new THREE.BoxGeometry 1,1,1
@mat = new THREE.MeshPhongMaterial @mat = new THREE.MeshPhongMaterial
color: 0xffffff color: 0xff8800
side: THREE.FrontSide side: THREE.FrontSide
shading: THREE.SmoothShading shading: THREE.SmoothShading
transparent: true transparent: true
@ -25,4 +25,6 @@ class Stone extends Item
@mesh.matrixAutoUpdate = true @mesh.matrixAutoUpdate = true
super super
isSlippery: -> return @slippery
module.exports = Stone module.exports = Stone

View File

@ -13,6 +13,8 @@ Item = require './item'
class Switch extends Item class Switch extends Item
isSpaceEgoistic: -> true
constructor: (active=false) -> constructor: (active=false) ->
super super
@ -33,16 +35,13 @@ class Switch extends Item
@setActive active @setActive active
createMesh: () -> createMesh: () ->
log 'switch createMesh'
torusRadius = 0.05 torusRadius = 0.05
t1 = new THREE.TorusGeometry 0.5-torusRadius, torusRadius, 16, 32 t1 = new THREE.TorusGeometry 0.5-torusRadius, torusRadius, 16, 32
@mat = new THREE.MeshPhongMaterial @mat = new THREE.MeshPhongMaterial
color: 0x0000ff color: 0x0000ff
side: THREE.FrontSide side: THREE.FrontSide
shading: THREE.SmoothShading shading: THREE.SmoothShading
transparent: true shininess: 5
opacity: 0.9
shininess: 0.99
@mesh = new THREE.Mesh t1, @mat @mesh = new THREE.Mesh t1, @mat
t2 = new THREE.TorusGeometry 0.5-torusRadius, torusRadius, 16, 32 t2 = new THREE.TorusGeometry 0.5-torusRadius, torusRadius, 16, 32
@ -70,7 +69,6 @@ class Switch extends Item
@startTimedAction @getActionWithId Action.ROTATE @startTimedAction @getActionWithId Action.ROTATE
world.playSound @sound_on world.playSound @sound_on
@events[@SWITCH_ON_EVENT].triggerActions() @events[@SWITCH_ON_EVENT].triggerActions()
# log 'createLight at pos:', @position
@light = new Light @position, 10.0 @light = new Light @position, 10.0
@light.on 'deleted', @lightDeleted @light.on 'deleted', @lightDeleted
else else
@ -86,7 +84,6 @@ class Switch extends Item
@events[@SWITCHED_EVENT].triggerActions() @events[@SWITCHED_EVENT].triggerActions()
setPosition: (pos) -> setPosition: (pos) ->
# log "setPosition #{@light?} pos:", pos
super pos super pos
@light?.setPosition @position @light?.setPosition @position
@ -104,10 +101,4 @@ class Switch extends Item
else else
@animate action.getRelativeDelta() @animate action.getRelativeDelta()
# render: () ->
# if (active)
# colors[KikiSwitch_sphere_color].glColor()
# kDisplaySolidSphere(0.3);
module.exports = Switch module.exports = Switch

View File

@ -16,6 +16,7 @@ class Timer
@event = world.getEventWithId @eventID @event = world.getEventWithId @eventID
# log "Timer.init @eventID:#{@eventID} #{@event.name}" # log "Timer.init @eventID:#{@eventID} #{@event.name}"
@removeAllActions: -> @event.removeAllActions()
@removeActionsOfObject: (o) -> @removeActionsOfObject: (o) ->
# log "Timer.removeActionsOfObject" # log "Timer.removeActionsOfObject"
@event.removeActionsOfObject o @event.removeActionsOfObject o

View File

@ -4,13 +4,13 @@
# 000 000 0 000 000 000 000 000 000 000 000 000 000 000 # 000 000 0 000 000 000 000 000 000 000 000 000 000 000
# 000 000 000 000 0000000 0000000 0000000 00000000 0000000 000 # 000 000 000 000 0000000 0000000 0000000 00000000 0000000 000
log = require '/Users/kodi/s/ko/js/tools/log' log = require '/Users/kodi/s/ko/js/tools/log'
Item = require './item' Item = require './item'
class TmpObject extends Item class TmpObject extends Item
@tmpID = 0 @tmpID = 0
isSpaceEgoistic: -> true
constructor: (o) -> constructor: (o) ->
TmpObject.tmpID += 1 TmpObject.tmpID += 1

View File

@ -9,6 +9,8 @@ Item = require './item'
class Wall extends Item class Wall extends Item
isSpaceEgoistic: -> true
constructor: -> constructor: ->
@geom = new THREE.BoxGeometry 1,1,1 @geom = new THREE.BoxGeometry 1,1,1

View File

@ -19,6 +19,7 @@ Player = require './player'
Cage = require './cage' Cage = require './cage'
Timer = require './timer' Timer = require './timer'
Actor = require './actor' Actor = require './actor'
Action = require './action'
TmpObject = require './tmpobject' TmpObject = require './tmpobject'
Quaternion = require './lib/quaternion' Quaternion = require './lib/quaternion'
Vector = require './lib/vector' Vector = require './lib/vector'
@ -106,7 +107,6 @@ class World extends Actor
@preview = false @preview = false
@objects = [] @objects = []
@lights = [] @lights = []
@moved_objects = []
@cells = [] @cells = []
@size = new Pos() @size = new Pos()
@depth = -Number.MAX_SAFE_INTEGER @depth = -Number.MAX_SAFE_INTEGER
@ -149,8 +149,8 @@ class World extends Actor
@levelList = [ @levelList = [
# intro # intro
# "start",
"steps", "steps",
"start",
#"move", "electro", "elevate", #"move", "electro", "elevate",
# "throw", # "throw",
# easy # easy
@ -203,7 +203,8 @@ class World extends Actor
# ............................................................ appearance # ............................................................ appearance
@setSize @dict["size"] @setSize @dict["size"] # this removes all objects
# log "world size set", @size # log "world size set", @size
# if "scheme" in @dict # if "scheme" in @dict
@ -243,7 +244,12 @@ class World extends Actor
# exit_action = @once "exit #{exit_id}" # exit_action = @once "exit #{exit_id}"
# delay_action = @once (a=exit_action) -> Timer.addAction a # delay_action = @once (a=exit_action) -> Timer.addAction a
# exit_gate.getEventWithName("enter").addAction(delay_action) exitAction = new Action
func: @exitLevel
name: "exit #{exit_id}"
mode: Action.ONCE
exit_gate.getEventWithName("enter").addAction exitAction
if entry.position? if entry.position?
pos = @decenter entry.position pos = @decenter entry.position
else if entry.coordinates? else if entry.coordinates?
@ -298,8 +304,9 @@ class World extends Actor
@create() @create()
finish: () -> finish: () ->
log 'world.levelFinished'
# saves the current level status in highscore file # saves the current level status in highscore file
highscore.levelFinished world.level_name, Controller.player.getStatus().getMoves() # highscore.levelFinished world.level_name, Controller.player.getStatus().getMoves()
# 00000000 00000000 0000000 00000000 000000000 00000000 000 0000000 000 000 00000000 00000000 # 00000000 00000000 0000000 00000000 000000000 00000000 000 0000000 000 000 00000000 00000000
# 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 # 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
@ -328,22 +335,20 @@ class World extends Actor
# 000 000 000 000 000 000 000 000 0000 # 000 000 000 000 000 000 000 000 0000
# 000 000 0000000 000 000 0000000 000 000 # 000 000 0000000 000 000 0000000 000 000
performAction: (name, time) ->
# log "world.performAction #{name}" exitLevel: (action) =>
# action callback. used to exit current world log "world.exitLevel #{action}"
if /exit/.test name @finish()
@finish() # @player.status.setMoves 0
@player.status.setMoves 0 exitIndex = parseInt action.name.slice 5
if "world" in @dict["exits"][parseInt name.slice 5] log "world.exitLevel exitIndex:#{exitIndex}"
w = @dict["exits"][parseInt name.slice 5]["world"] # if @dict.exits[exitIndex]?.world?
if w instanceof World # w = @dict.exits[exitIndex].world
w.create() # w() if _.isFunction w
else if _.isFunction w # else
w() # world = world.create levelList[world.level_index+1]
# else log "world.level_index #{world.level_index} nextLevel #{World.levelList[world.level_index+1]}"
# exec "World().create(" + world + ")" world.create World.levelList[world.level_index+1]
else
world.create levelList[world.level_index+1]
activate: (objectName) -> activate: (objectName) ->
# activates object with name objectName # activates object with name objectName
@ -537,11 +542,11 @@ class World extends Actor
lrest = index % lsize lrest = index % lsize
new Pos index/lsize, lrest/@size.z, lrest%@size.z new Pos index/lsize, lrest/@size.z, lrest%@size.z
# 0000000 0000000 000 00000000 0000000 000000000 0000000 # 0000000 0000000 000 00000000 0000000 000000000 0000000
# 000 000 000 000 000 000 000 000 000 # 000 000 000 000 000 000 000 000 000
# 000 000 0000000 000 0000000 000 000 0000000 # 000 000 0000000 000 0000000 000 000 0000000
# 000 000 000 000 000 000 000 000 000 000 # 000 000 000 000 000 000 000 000 000 000
# 0000000 0000000 0000000 00000000 0000000 000 0000000 # 0000000 0000000 0000000 00000000 0000000 000 0000000
getObjectsOfType: (clss) -> @objects.filter (o) -> o instanceof clss getObjectsOfType: (clss) -> @objects.filter (o) -> o instanceof clss
getObjectsOfTypeAtPos: (clss, pos) -> @getCellAtPos(pos)?.getObjectsOfType clss getObjectsOfTypeAtPos: (clss, pos) -> @getCellAtPos(pos)?.getObjectsOfType clss
@ -566,7 +571,7 @@ class World extends Actor
if occupant.time > 0 if occupant.time > 0
log "World.setObjectAtPos [WARNING] already occupied pos:", pos log "World.setObjectAtPos [WARNING] already occupied pos:", pos
log "World.setObjectAtPos [WARNING] already occupied time:", occupant.time log "World.setObjectAtPos [WARNING] already occupied time:", occupant.time
occupant.del() # temporary object at new pos will vanish anyway . delete it occupant.del() # temporary object at new pos will vanish anyway . delete it
cell = @getCellAtPos pos cell = @getCellAtPos pos
if not cell? if not cell?
@ -630,6 +635,7 @@ class World extends Actor
# 0000000 00000000 0000000 00000000 000 00000000 # 0000000 00000000 0000000 00000000 000 00000000
deleteObject: (object) -> deleteObject: (object) ->
log "world.deleteObject #{object.name}"
if not object? if not object?
log "WARNING: World.deleteObject null" log "WARNING: World.deleteObject null"
return return
@ -637,8 +643,7 @@ class World extends Actor
object.del() object.del()
deleteAllObjects: () -> deleteAllObjects: () ->
@picked_pickable = null log 'world.deleteAllObjects'
@moved_objects = []
if @player? if @player?
@player.finishRotateAction() @player.finishRotateAction()
@ -686,16 +691,8 @@ class World extends Actor
# 000 000 000 000 000 000 000 0 000 000 000 000 000 # 000 000 000 000 000 000 000 0 000 000 000 000 000
# 0000000 0000000 0000000 000 000 0000000 0 00000000 # 0000000 0000000 0000000 000 000 0000000 0 00000000
objectMovedFromPos: (object, pos) ->
if cell = @getCellAtPos(pos)
if tmpObject = cell.getObjectOfType TmpObject
if tmpObject.object == object
tmpObject.del()
@moved_objects.push object
objectWillMoveToPos: (object, pos, duration) -> objectWillMoveToPos: (object, pos, duration) ->
# log "world.objectWillMoveToPos", pos # log "world.objectWillMoveToPos #{object.name} #{duration}", pos
if @isInvalidPos pos if @isInvalidPos pos
log "world.objectWillMoveToPos [WARNING] invalid pos:", pos log "world.objectWillMoveToPos [WARNING] invalid pos:", pos
@ -716,8 +713,8 @@ class World extends Actor
else else
log "world.objectWillMoveToPos [WARNING] already occupied:", pos log "world.objectWillMoveToPos [WARNING] already occupied:", pos
if object != @player if object.name != 'player'
log '---------- tmpObjects' log "---------- tmpObjects not player? #{object.name}"
@unsetObject object # remove object from cell grid @unsetObject object # remove object from cell grid
# log 'tmpObject at new pos', pos # log 'tmpObject at new pos', pos
tmpObject = new TmpObject object # insert tmp object at new pos tmpObject = new TmpObject object # insert tmp object at new pos
@ -729,27 +726,55 @@ class World extends Actor
tmpObject.setPosition object.position tmpObject.setPosition object.position
tmpObject.time = -duration tmpObject.time = -duration
@addObjectAtPos tmpObject, object.getPos() @addObjectAtPos tmpObject, object.getPos()
else @player.targetPos = pos
updateStatus: () -> objectMoved: (movedObject, from, to) ->
sourcePos = new Pos from
targetPos = new Pos to
while @moved_objects.length # log "world.objectMoved #{movedObject.name}", sourcePos
movedObject = last @moved_objects
pos = new Pos movedObject.position
if @isInvalidPos pos # if cell = @getCellAtPos sourcePos
log "World.updateStatus invalid new pos" # if tmpObject = cell.getObjectOfType TmpObject
return # if tmpObject.object == object
# tmpObject.del()
if tmpObject = @getObjectOfTypeAtPos TmpObject, pos if @isInvalidPos targetPos
if tmpObject.object == movedObject log "World.objectMoved invalid targetPos:", targetPos
tmpObject.del() return
else
log "World.updateStatus wrong tmp object at pos:", pos
else if @isOccupiedPos pos
log "World.updateStatus object moved to occupied pos:", pos
@setObjectAtPos movedObject, pos # if tmpObject = @getObjectOfTypeAtPos TmpObject, pos
@moved_objects.pop() # if tmpObject.object == movedObject
# tmpObject.del()
# else
# log "World.updateStatus wrong tmp object at pos:", pos
# else
if @isOccupiedPos targetPos
log "World.objectMoved object moved to occupied pos:", targetPos
# log 'World.objectMovedFromPos sourcePos:', sourcePos
# log 'World.objectMovedFromPos targetPos:', targetPos
sourceCell = @getCellAtPos sourcePos
targetCell = @getCellAtPos targetPos
if sourceCell?
sourceCell.removeObject movedObject
if sourceCell.isEmpty()
# log 'world.objectMoved remove empty cell at pos:', sourcePos
@cells[@posToIndex(sourcePos)] = null
if not targetCell?
cellIndex = @posToIndex targetPos
targetCell = new Cell()
# log "world.objectMoved created cell at index #{cellIndex}", targetPos
@cells[cellIndex] = targetCell
if targetCell?
targetCell.addObject movedObject
else
log 'world.objectMoved [WARNING] no target cell?'
setObjectColor: (color_name, color) -> setObjectColor: (color_name, color) ->
if color_name == 'base' if color_name == 'base'
@ -768,11 +793,9 @@ class World extends Actor
step: (step) -> step: (step) ->
if false if false
quat = @camera.quaternion.clone() quat = @camera.quaternion.clone()
quat.multiply (new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(1,0,0), step.dsecs*0.2) quat.multiply new THREE.Quaternion().setFromAxisAngle new THREE.Vector3(1,0,0), step.dsecs*0.2
quat.multiply (new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,1,0), step.dsecs*0.1) quat.multiply new THREE.Quaternion().setFromAxisAngle new THREE.Vector3(0,1,0), step.dsecs*0.1
# center = @decenter 0,0,0
center = @size.div 2 center = @size.div 2
# log center
@camera.position.set(center.x,center.y,center.z+@dist).applyQuaternion quat @camera.position.set(center.x,center.y,center.z+@dist).applyQuaternion quat
@camera.quaternion.copy quat @camera.quaternion.copy quat
@ -786,7 +809,6 @@ class World extends Actor
when World.CAMERA_BEHIND then @projection = @player.getBehindProjection() when World.CAMERA_BEHIND then @projection = @player.getBehindProjection()
when World.CAMERA_FOLLOW then @projection = @player.getFollowProjection() when World.CAMERA_FOLLOW then @projection = @player.getFollowProjection()
@projection.apply @camera @projection.apply @camera
@sun.position.copy @camera.position @sun.position.copy @camera.position
@renderer.render @scene, @camera @renderer.render @scene, @camera
@ -799,12 +821,8 @@ class World extends Actor
getTime: -> now().toFixed 0 getTime: -> now().toFixed 0
setSpeed: (s) -> @speed = s setSpeed: (s) -> @speed = s
getSpeed: -> @speed getSpeed: -> @speed
mapMsTime: (unmapped) -> mapMsTime: (unmapped) -> parseInt 10.0 * unmapped/@speed
# log "mapMsTime #{unmapped} #{@speed} #{parseInt 10.0 * unmapped/@speed}" unmapMsTime: (mapped) -> parseInt mapped * @speed/10.0
parseInt 10.0 * unmapped/@speed
unmapMsTime: (mapped) ->
# log "unmapMsTime #{mapped} #{@speed} #{parseInt mapped * @speed/10.0}"
parseInt mapped * @speed/10.0
continuous: (cb) -> continuous: (cb) ->
new Action new Action