Adds new media to the 'media queue' (game.render.queue).
All queued media will be rendered on canvas when game.render.all() is called.
All queued media will be rendered on canvas when game.render.all() is called.
- Source:
Namespaces
Members
(static) default
[Not directly used] Default values for the media properties.
- Source:
Methods
(static) image(x, y, img, scale, alpha) → {object}
Adds image to media queue.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | x coordinate for the figure |
y |
number | y coordinate for the figure |
img |
string | name of the cached image |
scale |
undefined | number | scale for the image (default = 1) |
alpha |
undefined | number | level of transparency, from 0 (invisible) to 1 (100% visible) (default = 1) |
- Source:
Returns:
a reference to the created image.
- Type
- object
(static) sprite(x, y, img, curFrame, scale, alpha) → {object}
Adds spritesheet to media queue.
A spritesheet is an image that can be cropped to show only one 'frame' at a time.
A spritesheet is an image that can be cropped to show only one 'frame' at a time.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | x coordinate for the figure |
y |
number | Y coordinate for the figure |
img |
string | name of the cached spritesheet |
curFrame |
undefined | number | current frame (default = 0) |
scale |
undefined | number | scale for the spritesheet (default = 1) |
alpha |
undefined | number | level of transparency, from 0 (invisible) to 1 (100% visible) (default = 1) |
- Source:
Returns:
a reference to the created sprite.
- Type
- object
(static) text(x, y, text, style) → {object}
Adds text to media queue.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | x coordinate for the figure |
y |
number | y coordinate for the figure |
text |
string | text to be displayed on screen |
style |
object | object containing font, color and align for the text |
- Source:
Returns:
a reference to the created text.
- Type
- object