Typically data will be set as the sprite itself. The event listener function is called and data is optionally passed to the listener, when it is called, as the first argument. Note that Box2D collision listeners must be added to the global "world" object and other events should be added to sprites. Sprite:addEventListener(type,function,)Īdd event listener of type type to the sprite. Returns true if child is a child of parent sprite sprite. Returns the number of children that the sprite has. Return the parent of sprite or nil if it has no parent. The sprite then has no parent and is removed from the display tree. Remove the n-th child sprite from parent. Has no effect is child is not a child of parent. Child then has no parent and is removed from the display tree. If child already has a parent, it is removed from that parent. Set child to be the n-th child of parent. If child already has a parent, it is removed from that parent before adding to the new parent. Child is added as the last child of parent. Set sprite child to be a child of sprite parent. Returns the global screen coordinates of this point.įunctions to manipulate the display tree parent:addChild(child) If (x,y) a point in the local coordinate system of sprite, If (x,y) a point in the global, screen coordinate system, returns the local coordinates of this point in sprite's coordinate system. Note, this refers only to the visible sprite itself, not its children (if any). This function takes account of the fact that the sprite may be translated, rotated and scaled and be the child of other sprites similarly translated etc. Return true if the global (screen coords) point (x,y) is within the sprite. Sprite query functions sprite:hitTestPoint(x,y)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |