add engine2d assets to the scene
adds an image to the scene
| Parameter | Type | Description |
|---|---|---|
| canvas | String | Name of the canvas to add to |
| id | String | unique id of the image |
| x | Number | x position of the image |
| y | Number | y position of the image |
| key | String | id of the image asset to use |
| onComplete | Function | function to run after adding the image (takes the newly create image as a parameter) |
adds a sprite to the scene
| Parameter | Type | Description |
|---|---|---|
| canvas | String | Name of the canvas to add to |
| id | String | unique id of the sprite |
| x | Number | x position of the sprite |
| y | Number | y position of the sprite |
| key | String | id of the sprite asset to use |
| onComplete | Function | function to run after adding the sprite (takes the newly create sprite as a parameter) |
adds text to the scene
| Parameter | Type | Description |
|---|---|---|
| canvas | String | Name of the canvas to add to |
| id | String | unique id of the text |
| x | Number | x position of the text |
| y | Number | y position of the text |
| text | String | the text for the text object to show |
| fontSize | Int | font size of the text |
| onComplete | Function | function to run after adding the text (takes the newly create text as a parameter) |
adds text that can use HTML and CSS styling to the scene
| Parameter | Type | Description |
|---|---|---|
| canvas | String | Name of the canvas to add to |
| id | String | unique id of the text |
| x | Number | x position of the text |
| y | Number | y position of the text |
| text | String | the text for the text object to show |
| fontSize | Int | font size of the text |
| onComplete | Function | function to run after adding the text (takes the newly create text as a parameter) |
adds a textbox to the scene
| Parameter | Type | Description |
|---|---|---|
| canvas | String | Name of the canvas to add to |
| id | String | unique id of the html element |
| x | Number | x position of the html element |
| y | Number | y position of the html element |
| onComplete | Function | function to run after adding the textbox (takes the newly create textbox as a parameter) |