EasySprite.js use camelCase for identifier names (variables and functions).
The variables in [] are optional.
openScreen (id, x, y, width, height)
Opens a new screen according to the specified Width, Height.
Example: OpenScreen ("game", 0, 0,800, 600);
clearScreen(color)
Clear the whole screen with the specified color..
Example: ClearScreen('#000000');
screenWidth()
Returns the current screen width.
Example: var width = screenWidth();
screenHeight()
Returns the current screen height.
Example: var height = screenHeight();
createSprite(width, height, color, [onReady], [onClick])
Create new sprite.
Example: var square = createSprite(300, 200, "rgba(255, 255, 255, 1)", onLoadSuccess);
loadSprite(fileName, [onReady], [onClick])
Load the specified sprite.
Example: background = LoadSprite("assets/image/blur1.jpg", onLoadSuccess);
copySprite(sprite)
Copy the sprite1 to sprite2.
Example: sprite2 = copySprite(sprite1);
clipSprite (sprite, x, y, width, height)
Adds a clip zone to the specified sprite.
rotateSprite (sprite, angle, loop)
Rotates the specified sprite to the given angle
Example: rotateSprite(logo, 1, true)
opacitySprite(sprite, opacity)
Set the opacity of a sprite. Between 0.0 and 1.0
Example: opacity(Player, 0.5);
flipSprite (sprite, flipH, flipV)
Flip a sprite horizontally or vertically.
anchorSprite (sprite, x, y)
Change the pivot point of a sprite.
The anchor sets the origin point of the texture. The default is 0,0 this means the textures origin is the top left.
Setting than anchor to 0.5,0.5 means the textures origin is centered.
Setting the anchor to 1,1 would mean the textures origin points will be the bottom right.
spritePosition (sprite, x, y)
Moves sprite to the x and y coordinates.
spriteVelocity (sprite, x, y)
Adding velocity to a sprite.
displaySprite(sprite, x, y, [width], [height])
Display a sprite.
removeSprite(sprite)
Remove sprite from screen.
spriteCollision(sprite1, sprite2)
Tests if the two sprites are overlapping.
scrollSprite(sprite, x, y, stepX, stepY, width, height)
Scroll a sprite horizontally and / or vertically.
startDrawing(sprite)
Change the current drawing output to the specified output. Graphics will be rendered directly on the Sprite.
stopDrawing()
This function must be called to finish the drawing.
addAnimation(sprite, animation, frame, frameWidth, frameHeight, frameRate)
Add an animation.
example: addAnimation(coin, "animcoin", [0,1,2,3,4,5,6,7,8,9], 100, 100, 50);
playAnimation (sprite, animation)
Play animation
Example: playAnimation(player, "walk"
animationActive(sprite, animation)
Tests if the animation is active : true ou false
displayText (text, x, y, font, size, color)
Display a text.
Example: displayText("Make with S2D.js", 30, 30, "Arial", 18, "Red")
loadSound(fileName)
Load a sound.
Example: var sound = loadSound('assets/sound/yeah.mp3');
soundVolume(sound, volume)
Adjusts volume between 0.0 and 1.0.
Example: soundVolume(sound, 0.8);
playSound(sound, loop)
Play sound.
Example: playSound(sound);
pauseSound(sound)
Pause sound.
soundLength(sound)
Size of a sound
soundPosition (sound, position)
Returns the current pattern position of the playing music.
initKeyboard()
Initializes the keyboard environment.
keyboardPushed()
Checks if the specified key is pressed..
keyboardReleased()
Checks if the specified key has been pushed and released.
initMouse([hide])
Initializes the mouse environment.
If hide is true, the mouse cursor is hidden.
See example : 08 - Hide mouse.html
mouseX()
Returns the actual mouse 'x' position (in pixels) on the current screen
mouseY()
Returns the actual mouse 'y' position (in pixels) on the current screen
mouseButton()
Returns true if a click is detected.
mouseState()
Returns true if a mouse button is pressed.
debugScreen([x], [y])
Debug screen.
debugSprite(sprite, [x], [y])
Debug a sprite.