2014-01-03 13:32:13 -05:00
|
|
|
Thang = require 'lib/world/thang'
|
|
|
|
CocoSprite = require 'lib/surface/CocoSprite'
|
|
|
|
|
|
|
|
module.exports = IndieSprite = class IndieSprite extends CocoSprite
|
|
|
|
notOfThisWorld: true
|
|
|
|
subscriptions:
|
|
|
|
'note-group-started': 'onNoteGroupStarted'
|
|
|
|
'note-group-ended': 'onNoteGroupEnded'
|
|
|
|
|
|
|
|
constructor: (thangType, options) ->
|
2014-08-24 19:09:06 -04:00
|
|
|
options.thang = @makeIndieThang thangType, options
|
2014-01-03 13:32:13 -05:00
|
|
|
super thangType, options
|
2014-03-24 02:19:18 -04:00
|
|
|
@shadow = @thang
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-08-24 19:09:06 -04:00
|
|
|
makeIndieThang: (thangType, options) ->
|
|
|
|
@thang = thang = new Thang null, thangType.get('name'), options.thangID
|
2014-01-03 13:32:13 -05:00
|
|
|
# Build needed results of what used to be Exists, Physical, Acts, and Selectable Components
|
|
|
|
thang.exists = true
|
|
|
|
thang.width = thang.height = thang.depth = 4
|
2014-08-24 19:09:06 -04:00
|
|
|
thang.pos = options.pos ? @defaultPos()
|
2014-02-01 14:02:20 -05:00
|
|
|
thang.pos.z = thang.depth / 2
|
2014-02-25 13:48:23 -05:00
|
|
|
thang.shape = 'ellipsoid'
|
2014-01-03 13:32:13 -05:00
|
|
|
thang.rotation = 0
|
|
|
|
thang.action = 'idle'
|
|
|
|
thang.setAction = (action) -> thang.action = action
|
|
|
|
thang.getActionName = -> thang.action
|
|
|
|
thang.acts = true
|
|
|
|
thang.isSelectable = true
|
|
|
|
thang
|
|
|
|
|
|
|
|
onNoteGroupStarted: => @scriptRunning = true
|
|
|
|
onNoteGroupEnded: => @scriptRunning = false
|
|
|
|
onMouseEvent: (e, ourEventName) -> super e, ourEventName unless @scriptRunning
|
|
|
|
defaultPos: -> x: -20, y: 20, z: @thang.depth / 2
|