silkz_classic.lv erstellt
[hackover2013-badge-firmware.git] / badge / jumpnrun / player.c
1 #include "player.h"
2 #include "jumpnrun.h"
3 #include <stdlib.h>
4
5 void jumpnrun_player_respawn(jumpnrun_player *self, vec2d spawn_pos) {
6 memset(&self->base, 0, sizeof(self->base));
7 self->base.hitbox = rectangle_new(spawn_pos, jumpnrun_player_extents());
8 }
9
10 void jumpnrun_player_spawn (jumpnrun_player *self, vec2d spawn_pos, uint8_t lives) {
11 memset(self, 0, sizeof(*self));
12 jumpnrun_player_respawn(self, spawn_pos);
13 self->lives = lives;
14 }
15
16 void jumpnrun_player_kill (jumpnrun_player *self) {
17 if((self->base.flags & JUMPNRUN_MOVEABLE_DYING) == 0) {
18 self->base.flags |= JUMPNRUN_MOVEABLE_DYING;
19 self->base.tick_minor = 0;
20 }
21 }
22
23 void jumpnrun_player_despawn(jumpnrun_player *self) {
24 self->base.flags |= JUMPNRUN_PLAYER_DEAD;
25 self->base.flags &= ~JUMPNRUN_MOVEABLE_DYING;
26 self->base.inertia = (vec2d) { FIXED_INT(0), FIXED_INT(0) };
27 }
28
29 void jumpnrun_player_advance_animation(jumpnrun_player *self) {
30 ++self->base.tick_minor;
31 }
This page took 0.06164 seconds and 5 git commands to generate.