Class me.SpriteObject
Extends
me.Rect.
Defined in: <build/melonJS-0.9.3.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
me.SpriteObject(x, y, image, spritewidth, spriteheigth)
A Simple object to display a sprite on screen.
|
| Field Attributes | Field Name and Description |
|---|---|
|
a flag that can prevent the object to be destroyed
if set to false, the objet won't be destroy when calling me.game.remove(obj) default value : true |
|
|
the visible state of the object
default value : true |
| Method Attributes | Method Name and Description |
|---|---|
|
draw(context)
object draw
not to be called by the end user called by the game manager on each game loop |
|
|
flicker(duration, callback)
make the object flicker
|
|
|
flipX(flip)
Flip object on horizontal axis
|
|
|
flipY(flip)
Flip object on vertical axis
|
|
|
return the flickering state of the object
|
|
|
OnDestroy Notification function
Called by engine before deleting the object |
|
|
resize(ratio)
Resize the object around his center
Note : This won't resize the corresponding collision box |
|
|
setTransparency(color)
specify a transparent color
|
|
|
update()
sprite update
not to be called by the end user called by the game manager on each game loop |
Class Detail
me.SpriteObject(x, y, image, spritewidth, spriteheigth)
A Simple object to display a sprite on screen.
// create a static Sprite Object
mySprite = new SpriteObject (100, 100, me.loader.getImage("mySpriteImage"));
- Parameters:
- {int} x
- the x coordinates of the sprite object
- {int} y
- the y coordinates of the sprite object
- {me.loader#getImage} image
- reference to the Sprite Image
- {int} spritewidth Optional
- sprite width
- {int} spriteheigth Optional
- sprite height
Field Detail
{Boolean}
autodestroy
a flag that can prevent the object to be destroyed
if set to false, the objet won't be destroy when calling me.game.remove(obj)
default value : true
if set to false, the objet won't be destroy when calling me.game.remove(obj)
default value : true
{Boolean}
visible
the visible state of the object
default value : true
default value : true
Method Detail
draw(context)
object draw
not to be called by the end user
called by the game manager on each game loop
not to be called by the end user
called by the game manager on each game loop
- Parameters:
- {Context2d} context
- 2d Context on which draw our object
flicker(duration, callback)
make the object flicker
// make the object flicker for 60 frame
// and then remove it
this.flicker(60, function()
{
me.game.remove(this);
});
- Parameters:
- {Int} duration
- {Function} callback
flipX(flip)
Flip object on horizontal axis
- Parameters:
- {Boolean} flip
- enable/disable flip
flipY(flip)
Flip object on vertical axis
- Parameters:
- {Boolean} flip
- enable/disable flip
isFlickering()
return the flickering state of the object
- Returns:
- Boolean
onDestroyEvent()
OnDestroy Notification function
Called by engine before deleting the object
Called by engine before deleting the object
resize(ratio)
Resize the object around his center
Note : This won't resize the corresponding collision box
Note : This won't resize the corresponding collision box
- Parameters:
- {Boolean} ratio
- scaling ratio
setTransparency(color)
specify a transparent color
- Parameters:
- {String} color
- color key in rgb format (rrggb or #rrggb)
update()
sprite update
not to be called by the end user
called by the game manager on each game loop
not to be called by the end user
called by the game manager on each game loop
- Returns:
- false