Skip to content

Commit

Permalink
Fixes to plates, disengage doors
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Applegate committed Dec 1, 2012
1 parent b430f94 commit b0fe18c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion public/coffee/models/PlateEntity.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ define ['cs!models/StaticEntity', 'image!/img/level-asset-pressure-plate.png'],

class PlateEntity extends StaticEntity

active: false

template:
active: false
height: .4
Expand All @@ -15,9 +17,13 @@ define ['cs!models/StaticEntity', 'image!/img/level-asset-pressure-plate.png'],

onTick: =>
if @isActivated()
@active = true
@canvas.trigger @entity.$target + '.open'
@entity.sprite 1, 0
else
if @active
@canvas.trigger @entity.$target + '.disengage'
@active = false
@canvas.trigger @entity.$target + '.close'
@entity.sprite 0, 0

Expand All @@ -26,7 +32,7 @@ define ['cs!models/StaticEntity', 'image!/img/level-asset-pressure-plate.png'],
width = @entity._ops.width
height = @entity._ops.height
x1 = pos.x - width / 2
y2 = pos.y - height / 2 - .1
y2 = pos.y - height / 2
x2 = pos.x + width / 2
y1 = y2 - height
return @world.find(x1, y1, x2, y2).length
Expand Down

0 comments on commit b0fe18c

Please sign in to comment.