GameObject
Extends:
Direct Subclass:
GameObject class that all objects in the game space should inherit. Provides standard field variables such as posX and posY, as well as standard methods to manipulate them.
A GameObject cannot be added directly; it must be inherited. setup() and tick() must be overridden.
Constructor Summary
| Public Constructor | ||
| public |
Creates a new GameObject. |
|
Member Summary
| Public Members | ||
| public |
|
|
| public |
id: * |
|
| public |
posX: * |
|
| public |
posY: * |
|
| public |
texture: * |
|
| public |
vx: * |
|
| public |
vy: * |
|
| public |
x: * |
|
| public |
y: * |
|
Method Summary
| Public Methods | ||
| public |
destroy() Destroyes the Sprite |
|
| public |
draw() Call during tick() if necessary. |
|
| public |
TEMP Moves this object to (9999, 9999) on local screen space, effectively hiding it from view. |
|
| public |
setCoordinates(newX: number, newY: number) Sets global coordinates of this player |
|
| public |
Sets global coordinates and speeds of this player |
|
| public |
setup() Override optional. |
|
| public |
Override optional. |
|
Public Constructors
public constructor(texture: PIXI.Texture, id: string, x: number, y: number, vx: number, vy: number) source
Creates a new GameObject.
Params:
| Name | Type | Attribute | Description |
| texture | PIXI.Texture | The texture associated with this sprite |
|
| id | string | Unique identifier- for example, socket ID for players, numerical ID for atoms |
|
| x | number | Global x-coordinate |
|
| y | number | Global y-coordinate |
|
| vx | number | Horizontal velocity |
|
| vy | number | Vertical velocity |
Public Members
public id: * source
public posX: * source
public posY: * source
public texture: * source
public vx: * source
public vy: * source
public x: * source
public y: * source
Public Methods
public draw() source
Call during tick() if necessary. Draws object in the correct position on the player screen.
public hide(): number source
TEMP Moves this object to (9999, 9999) on local screen space, effectively hiding it from view.
