Skip to content

Instantly share code, notes, and snippets.

@mattcolman
Created September 17, 2012 06:03
Show Gist options
  • Select an option

  • Save mattcolman/3735783 to your computer and use it in GitHub Desktop.

Select an option

Save mattcolman/3735783 to your computer and use it in GitHub Desktop.
Drag and drop
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'
@tansengming
Copy link
Copy Markdown

FYI you're missing the droppable class in the define

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment