From 1a9c57d249c93663d3fc25490716de508d61cec3 Mon Sep 17 00:00:00 2001 From: NielsCoding <48092678+heavydemon21@users.noreply.github.com> Date: Mon, 3 Apr 2023 15:24:51 +0200 Subject: player controller update --- src/game_loop/gameplay.c | 49 ++++++++++++++++++++++++++++++++++++++--- src/game_loop/starting_screen.c | 4 ++-- 2 files changed, 48 insertions(+), 5 deletions(-) (limited to 'src/game_loop') 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 diff --git a/src/game_loop/starting_screen.c b/src/game_loop/starting_screen.c index 6ab0278..c11e4fc 100644 --- a/src/game_loop/starting_screen.c +++ b/src/game_loop/starting_screen.c @@ -1,8 +1,8 @@ -#include "starting_screen.h"" +#include "starting_screen.h" #include "input.h" #include "engine/title_screen.h" #include "engine/draw_screen.h" -// #include "engine/player_controller.h" +#include "engine/player_controller.h" bool hh_show_starting_screen(){ static hh_e_screen_states hh_e_starting_screen = hh_e_state_show; -- cgit v1.2.3