.
This commit is contained in:
parent
507d635433
commit
1c13514a4d
45 changed files with 2615 additions and 2014 deletions
24
src/player.c
Normal file
24
src/player.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include "game.h"
|
||||
#include "utils.h"
|
||||
|
||||
entity_t *player_init(void) {
|
||||
entity_t *e = game_new_entity(ENTITY_PLAYER);
|
||||
|
||||
e->camera = cam_init();
|
||||
e->camera.mov_speed = 3;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
void player__update(entity_t *e, float dt) {
|
||||
e->camera.mov_speed = is_key_down(SAPP_KEYCODE_LEFT_SHIFT) ? 5 : 3;
|
||||
|
||||
cam_update(&e->camera, dt);
|
||||
e->camera.pos.y = 1.6;
|
||||
}
|
||||
|
||||
void player_frame(arena_t frame_arena, entity_t *players, float dt) {
|
||||
for_each (e, players) {
|
||||
player__update(e, dt);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue