aboutsummaryrefslogtreecommitdiff
path: root/src/game_loop/gameplay.c
diff options
context:
space:
mode:
authorNielsCoding <48092678+heavydemon21@users.noreply.github.com>2023-04-03 15:24:51 +0200
committerNielsCoding <48092678+heavydemon21@users.noreply.github.com>2023-04-03 15:24:51 +0200
commit1a9c57d249c93663d3fc25490716de508d61cec3 (patch)
tree09742e511a841e4e185f89332337a19b2042fda4 /src/game_loop/gameplay.c
parent68862666219c07ee62c9e59dd6866c1c7b26cc00 (diff)
player controller update
Diffstat (limited to 'src/game_loop/gameplay.c')
-rw-r--r--src/game_loop/gameplay.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/src/game_loop/gameplay.c b/src/game_loop/gameplay.c
index 295eb5d..bc6c98d 100644
--- a/src/game_loop/gameplay.c
+++ b/src/game_loop/gameplay.c
@@ -5,6 +5,47 @@
void hh_gameplay(hh_g_all_levels game, hh_e_game_state* hh_game_state){
static hh_e_gameplay gameplay = hh_e_setup_screen;
+ static hh_entity player1={
+ .hp = 4,
+ .speed = 6,
+ .is_grounded = false,
+ .is_hit = false,
+ .radius = 8,
+ .pos = (vec2){32,32},
+ .size = (vec2){32,32},
+ .vel = (vec2){0,0},
+ .render = {
+ .frame0 = 80,
+ .palette = 3,
+ .fam = (hh_s_ppu_loc_fam_entry){
+ .horizontal_flip = false,
+ .vertical_flip = false,
+ .palette_index = 3,
+ .tilemap_index = 80,
+ }
+ }
+ };
+ // enemy gets replaced here is just for reference
+ static hh_entity enemy={
+ .hp = 4,
+ .speed = 6,
+ .is_grounded = false,
+ .is_hit = false,
+ .radius = 8,
+ .pos = (vec2){128,48},
+ .vel = (vec2){0,0},
+ // .vec = (vec2){0,0},
+ .render = {
+ .frame0 = 20,
+ .palette = 7,
+ .fam = (hh_s_ppu_loc_fam_entry){
+ .horizontal_flip = false,
+ .vertical_flip = false,
+ .palette_index = 7,
+ .tilemap_index = 1,
+ }
+ }
+ };
switch (gameplay)
{
@@ -13,10 +54,12 @@ void hh_gameplay(hh_g_all_levels game, hh_e_game_state* hh_game_state){
gameplay = hh_e_play_level;
break;
case hh_e_play_level:
- // todo: here come all the different functions for the gameplay
- hh_player_actions();
-
+ // TODO: here come all the different functions for the gameplay
+ vec_cor cam_pos;//value in tiles
+ cam_pos = hh_draw_screen(player1.pos);
+ hh_player_actions(&player1,cam_pos);
+ // enemy's