-
Notifications
You must be signed in to change notification settings - Fork 0
obj_player
Brandyn Britton edited this page Aug 12, 2017
·
1 revision
obj_player
is the object for the player (the character the user controls).
In the create section of the obj_player
, several class fields are defined. These include:
-
move_speed
- The speed at which the player moves -
cur_health
andmax_health
- Current health and max health of the player -
can_interact
- This is a flag that, when true, allows the player to interact with things like npcs. If this is false, the player will be able to move but unable to interact with anything but enemies.
The step event will control the players movement by checking the input from the user and moving along the x
and y
axis accordingly. During the movement, collisions with anything that may affect movement should also be checked [1].
The step event will also reset the current room if the players health every reaches less than 0.
- Set
can_interact
to true
[1] - Although this is done using the collision event in other objects, within the player this is handled directly through code just to offer alternate ways of handling things