GameObject() Last Updated: August 24, 2019 12:38
Usage: 1 new GameObject(Jabo.canvasContext); Doesn't contain any parameters but you can set it individually after declaration Properties:
x - X coordinate
y - Y coordinate
width - Size of the object horizontally
height - Size of object vertically
sprite - May contain Animation(), JSprite(), or none (will render a black rectangle).
Functions:
GameObject.update() - Updates the object
GameObject.render() - Renders the object
GameObject.near() - returns nearest GameObject
GameObject.Translate(xMove, yMove) - Moves object more info.
GameObject.delete() - removes this GameObject() from objects[]
Additional Information
When you initialize a GameObject() it is automatically added into objects[] variable. objects[] are built-in variable to store all Game Objects. You can easily get an element from objects[] by using objects[index].