Created
September 17, 2012 06:03
-
-
Save mattcolman/3735783 to your computer and use it in GitHub Desktop.
Drag and drop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define [ | |
'caper/actor' | |
], (Actor) -> | |
class Ball extends Actor | |
added: -> | |
#DRAGGABLE | |
@dragImage = @bitmap 'draggy' | |
@stage.addChild @dragImage | |
@draggable = @makeDraggable(@dragImage) | |
@draggable.on 'dropped', (draggable, droppable) => | |
@emit 'dropped', draggable, droppable | |
#DROPPABLE | |
@dropImage = @bitmap 'dropzone' | |
@stage.addChild @dropImage | |
@droppable = @makeDroppable(@dropImage) | |
@droppable.on 'dropped', (droppable, draggable) => | |
console.log 'droppable detected a drop' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI you're missing the droppable class in the define