diff options
Diffstat (limited to 'platformer/src/player.h')
| -rw-r--r-- | platformer/src/player.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/platformer/src/player.h b/platformer/src/player.h index 35e5b6a..5f8d963 100644 --- a/platformer/src/player.h +++ b/platformer/src/player.h @@ -25,6 +25,15 @@ * which matches mat4_rotate_y in math3d.h. * float forward_speed; ground speed along facing_yaw, m/s (>= 0) * PlayerState state; + * bool heightened_movement; on for PLAYER_SECOND_JUMP_WINDOW s after + * landing a normal jump, and for the whole + * second jump. While on, A gives the second + * jump. Later moves will read it too. + * float heightened_timer; s left before heightened_movement ends + * (not counted down during the second jump) + * int jump_number; which jump the player is in the air from: + * 0 = none (walked off an edge, or grounded), + * 1 = a normal jump, 2 = the second jump * } Player; * * void player_init(Player *p, Vec3 spawn); @@ -37,7 +46,8 @@ * * CONVENTIONS: Include guard: PLAYER_H. * - * NOT IN SCOPE: Health, animation, extra moves (see README roadmap). + * NOT IN SCOPE: Health, animation, extra moves beyond the second jump (see the + * README roadmap). * * DONE WHEN: main.c and render.c compile against this header alone. * ============================================================ @@ -50,7 +60,8 @@ #include "physics.h" /* SM64-style "actions". Add states here only when a new move needs one; - * see the README roadmap (double jump, long jump, wall kick, ...). */ + * see the README roadmap (triple jump, long jump, wall kick, ...). The second + * jump didn't need one: it's a JUMP with a higher launch (see jump_number). */ typedef enum PlayerState { PLAYER_IDLE, /* on ground, not moving */ PLAYER_RUN, /* on ground, moving (walk vs run is just speed) */ @@ -63,6 +74,9 @@ typedef struct Player { float facing_yaw; /* radians; facing vector = (sin(yaw), 0, cos(yaw)) */ float forward_speed; /* ground speed along facing_yaw, m/s (>= 0) */ PlayerState state; + bool heightened_movement; /* second jump available (or in progress); later moves read it too */ + float heightened_timer; /* s left before heightened_movement ends; paused during the second jump */ + int jump_number; /* airborne from: 0 = no jump (walked off an edge), 1 = normal, 2 = second */ } Player; void player_init(Player *p, Vec3 spawn); |
