gma.character¶
Provides a character object
Package
gma/entities/character
Inheritance chain
Tags¶
shape, moveable, character
Properties¶
Inherited from gma.moveable
Inherited from gma.shapes.rectangle
points
, edges
, width
, height
, depth
, z
, x
, y
, centre
, left
, right
, top
, bottom
, yOffset
, xOffset
, type
, alive
, solid
, tags
score
Holds a score counter
Type
Number
Methods¶
Inherited from gma.moveable
getMovement
, animate
, findGround
, updatePositions
, getRotation
, kill
Inherited from gma.shapes.rectangle
setPointsAndEdges
, setCentre
, setBottomLeft
, xOf
, yOf
, toString
, collided__deathtouch
- jump (e)
- Makes character ready for jumpingIt will only set character to jumping if it’s in the STILL stateIt 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 representing whether character is going left or right
e
Event
Keyboard event object
- collided (where, focus, focusSide, focusVector)
- Collided function for characterDetermines if we hit a collectable and what to do with it
Overrides
gma.shapes.rectangle.collided
Parameters
where
Side of this object that was collided with
focus
object
Thing we collided with
focusSide
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
Side of this object that was collided with
focus
object
Thing we collided with
focusSide
Side of the focus object that was collided with
focusVector
[x,y]
Amount focus is trying to move