Pixeljs

A simple and flexible HTML5 and JavaScript powered game engine.

View Project on GitHub Download Pixel.js (v0.9b)

Entity.moveTo Method

Moves the entity to a new position.

Parameters

Name Description
x The x coordinate to move the entity to.
y The y coordinate to move the entity to.
duration Optional: the time in milliseconds that it should take for the entity to reach its destination; or 0 / undefined to have an instant movement.
callback Optional: the function to be called when the entity has finished moving to its new position.

Examples

Supported Platforms

Google Chrome, Mozilla FireFox, Internet Explorer 9+, Opera, Safari.