Constructor
new ObjectFactory(game)
This claass offers the possibility of creating sprites and groups.
Parameters:
Name | Type | Description |
---|---|---|
game |
Carrot.Game | The core game object. |
Methods
group()
Creates a group.
sprite(xopt, yopt, keyopt, frameopt, activeopt) → {Carrot.Sprite}
Creates a sprite.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x |
integer |
<optional> |
0 | X position |
y |
integer |
<optional> |
0 | Y position |
key |
string |
<optional> |
null | The key (name) of the image. If null, the sprite will be a green rectangle. |
frame |
integer |
<optional> |
0 | The initial frame to show. Only for spritesheets. |
active |
boolean |
<optional> |
true | The initial frame to show. Only for spritesheets. |
Returns:
- Type
- Carrot.Sprite
timer()
Creates a timed event.