The variables that make up an Entity are all public and open for changes.
Feel free to play with them as they all are only read by the engine and never set, so these variables essentially control how the Entity is displayed and interacts with the game.
name = "the name of the Entity"
tag = "a Tag that can be assigned to multiple Entities"
x = "X position"
y = "Y position"
z = "Z position"
width = "the Entity's Width"
height = "the Entity's Height"
rotation = "the Entity's Rotation angle"
scaleX = "the Entity's scale on the X axis"
scaleY = "the Entity's scale on the Y axis"
alpha = "How transparent from 0 to 1 the Entity is"
imageCenter = "a Vector2 indicating the image center: { x, y }"
colliderRadius = "how big the Entity's radius is for collision detection"
Apart from 1 function, all the functions within the Entity are overridable and hook into the engine.
This means that they are called at specific times during Pockety’s Update() loop, so you can use them as “event listeners” and act accordingly!
// called when a Scene is loaded or the Entity is Instantiated
const Start()
// called once per frame, the DELTA indicates the time in milliseconds
// between two rendered Frames
const Update(DELTA)
// Called when a click or touch is performed on this Entity
const OnTouchDown()
// same as above, but for a continous touch and not for just one Frame
const OnTouch = () => {};
// called when a touch or click ends on the Entity
const OnTouchUp = () => {};
// gets called by the engine whenever this Entity is colliding with another one
// in the CollisionDetection() function
// the COLLIDER is the other Entity
const OnCollision(COLLIDER)
// the only function that is not a hook
// return a Vector2 that indicates the direction of the Entity
// based on the rotation
const GetForward(angleOffset = 0)