GameObject

A class representing a sprite

Variables

x - Number, sets the X position of the sprite (top-left corner)

y - Number, sets the Y position of the sprite (top-left corner)

width - Number, sets the width of the sprite

height - Number, sets the height of the sprite

char - String, sets the character the sprite is filled with

Functions

isObjectColliding

Arguments

x - Number, represents the X position of the sprite your game is testing collision against (top-left corner)

y - Number, represents the Y position of the sprite your game is testing collision against (top-left corner)

width - Number, represents the width of the sprite your game is testing collision against

height - Number, represents the height of the sprite your game is testing collision against

Returns

Boolean, true if colliding with object represented in the arguments

getCollider

Arguments

-

Returns

x - Number, represents the X position of the sprite this was called on (top-left corner)

y - Number, represents the Y position of the sprite this was called on (top-left corner)

width - Number, represents the width of the sprite this was called on

height - Number, represents the height of the sprite this was called on

Last updated