-
Notifications
You must be signed in to change notification settings - Fork 0
Class Sprite
Moderr edited this page Feb 28, 2023
·
5 revisions
class Sprite extends GameObject
Represents Gameobject
Inheritance of GameObject. Used for creating game sprites which player can see on the canvas.
Constructs new Sprite with given parameters.
Params:
number
x - X-coordinate (Default: 0)
number
y - Y-coordinate (Default: 0)
number
width - Width on the grid (Default: 0)
number
height - Height on the grid (Default: 0)
new Sprite().setImage(*IMAGE_ELEMENT*).setWidth(1).setHeight(1).setVisible(true);
// setWidth, setHeight is from GameObject inheritance.
From | Method | Description |
---|---|---|
GameObject | OnDraw(renderer, gameManager) | Draws image (if visible) on Sprite position. |
Method | Description |
---|---|
getImage() | Gets sprite image. |
isVisible() | Gets visible value. |
setImage(image) | Sets sprite image. |
setVisible(visible) | Sets visible value. |
switchVisible() | Negates visible value. |