gma.enemy¶
Provides a base enemy object
Package
gma/entities/enemy
Inheritance chain
Descendants
Tags¶
shape, moveable, enemy
Properties¶
Inherited from gma.moveable
Methods¶
Inherited from gma.moveable
Inherited from gma.shapes.rectangle
setPointsAndEdges
, setCentre
, setBottomLeft
, xOf
, yOf
, toString
, collided__deathtouch
- getMovement (moveAmount) -> Amount to move as [x, y]
- Enemy getMovement will first call determineState before doing super.getMovementThe enemy is the same as the character, except itdetermines it’s own next state, rather than the player
Overrides
gma.moveable.getMovement
Parameters
moveAmount
Number
The amount the character should move
- determineState (moveAmount, manager)
- Determine the state of the enemy for the next movement- Calls behaviour__jumping if it has jumping tag- Calls behaviour__patrolling if it has patrolling tag- Calls behaviour__platformer if it has platformer tag
Parameters
moveAmount
Number
amount to move; based on delta from twitch
manager
- collided (where, focus, focusSide, focusVector)
- Enemy looks for rebound and weakhead tags as well as what super.collided looks forIt will also look for deathtouch, if enemy is still alive after all other checks
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
- behaviour__jumping (moveAmount, manager)
Makes enemy jump when touching ground
Parameters
moveAmount
Number
amount to move; based on delta from twitch
manager
- behaviour__platformer (moveAmount, manager)
Makes enemy turn around when reaching the edge of the platform it is currently on
Parameters
moveAmount
Number
amount to move; based on delta from twitch
manager
- behaviour__patrolling (moveAmount, manager)
- Makes enemy patrol a rangeRequires self.limitLeft and/or self.limitRight properties
Parameters
moveAmount
Number
amount to move; based on delta from twitch
manager
- collided__rebound (where, focus, focusSide, focusVector)
Makes enemy turn around if it hits something
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__weakhead (where, focus, focusSide, focusVector)
Makes enemy die when character hit it’s top
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