gma.character

Provides a character object

Package gma/entities/character
Inheritance chain gma.shapes.rectangle >> gma.moveable

Tags

shape, moveable, character

Properties

score

Holds a score counter

Type Number

Methods

jump (e)
Makes character ready for jumping
It will only set character to jumping if it’s in the STILL state
It will also set self.targetY to it’s current y plus it’s jumpHeigt
Parameters
e Event Keyboard event object
move (direction, e)

Changes character’s horizontal state

Parameters
direction gma.constant gma.constant representing whether character is going left or right
e Event Keyboard event object
collided (where, focus, focusSide, focusVector)
Collided function for character
Determines if we hit a collectable and what to do with it

Overrides gma.shapes.rectangle.collided

Parameters
where gma.constant Side of this object that was collided with
focus object Thing we collided with
focusSide gma.constant Side of the focus object that was collided with
focusVector [x,y] Amount focus is trying to move
collided__pickupCollectable (where, focus, focusSide, focusVector)

Collision function for hitting a collectable

Parameters
where gma.constant Side of this object that was collided with
focus object Thing we collided with
focusSide gma.constant Side of the focus object that was collided with
focusVector [x,y] Amount focus is trying to move

Table Of Contents

Fork me on GitHub