diff options
Diffstat (limited to 'src/game_loop')
-rw-r--r-- | src/game_loop/gameplay.c | 40 | ||||
-rw-r--r-- | src/game_loop/shop.c | 12 | ||||
-rw-r--r-- | src/game_loop/shop.h | 4 |
3 files changed, 28 insertions, 28 deletions
diff --git a/src/game_loop/gameplay.c b/src/game_loop/gameplay.c index a7ce5b6..384ce40 100644 --- a/src/game_loop/gameplay.c +++ b/src/game_loop/gameplay.c @@ -12,9 +12,9 @@ void hh_gameplay(hh_g_all_levels* game, hh_e_game_state* hh_game_state){ .speed = 6, .is_grounded = false, .is_hit = false, - .radius = 16, - .pos = (vec2){32,32}, - .size = (vec2){32,32}, + .radius = 8, + .pos = (vec2){32,200}, + .size = (vec2){16,32}, .vel = (vec2){0,0}, .render = { .frame0 = HH_TM_GOZER_OFFSET, @@ -41,16 +41,16 @@ void hh_gameplay(hh_g_all_levels* game, hh_e_game_state* hh_game_state){ // .vec = (vec2){0,0}, .render = { .frame0 = HH_TM_SLIME_OFFSET, - .palette = 7, + .palette = 2, .fam = (hh_s_ppu_loc_fam_entry){ .horizontal_flip = false, .vertical_flip = false, - .palette_index = 7, + .palette_index = 2, .tilemap_index = HH_TM_SLIME_OFFSET, } } }; - static int total_bullets = 5; + static int total_bullets = 15; switch (gameplay) { case hh_e_setup_screen: @@ -79,15 +79,15 @@ void hh_gameplay(hh_g_all_levels* game, hh_e_game_state* hh_game_state){ } break; case hh_e_level_complete: - // TODO: from complete to shop or game_over - if(game->current_level < 3){ - game->current_level+=1; - gameplay = hh_e_setup_screen; - } - else { + // // TODO: from complete to shop or game_over + // if(game->current_level < 3){ + // game->current_level+=1; + // gameplay = hh_e_setup_screen; + // } + // else { - gameplay = hh_e_game_over; - } + // gameplay = hh_e_game_over; + // } break; case hh_e_game_over: // todo make reset levels @@ -108,16 +108,16 @@ void hh_reset_levels(hh_entity* player){ .is_hit = false, .radius = 16, .pos = (vec2){32,32}, - .size = (vec2){32,32}, + .size = (vec2){16,32}, .vel = (vec2){0,0}, .render = { - .frame0 = 3, + .frame0 = HH_TM_GOZER_OFFSET, .palette = 3, .fam = (hh_s_ppu_loc_fam_entry){ .horizontal_flip = false, .vertical_flip = false, .palette_index = 3, - .tilemap_index = 80, + .tilemap_index = HH_TM_GOZER_OFFSET, } } }; @@ -127,12 +127,12 @@ void hh_reset_levels(hh_entity* player){ void hh_render_all_entities(hh_entity* player, hh_entity* bullets, hh_entity* enemies, int bullet_size, int enemy_size, vec_cor cam_pos){ int index = 0; - hh_update_sprite(0 , player, cam_pos); + hh_update_sprite(&index , player, cam_pos); for (int i = 0; i < bullet_size; i++) { - hh_update_sprite(i+5,&bullets[i],cam_pos); + hh_update_sprite(&index,&bullets[i],cam_pos); } for (int i = 0; i < enemy_size; i++) { - hh_update_sprite(i+5+bullet_size,&enemies[i],cam_pos); + hh_update_sprite(&index,&enemies[i],cam_pos); } } diff --git a/src/game_loop/shop.c b/src/game_loop/shop.c index eb41248..da27524 100644 --- a/src/game_loop/shop.c +++ b/src/game_loop/shop.c @@ -2,7 +2,7 @@ #include "engine/maths.h" #include "ppu/ppu.h" -void hh_shop(hh_e_game_state* hh_game_state){ +void hh_shop(hh_e_game_state* hh_game_state, hh_level_entity* level_shop){ static hh_e_shop_states hh_e_shop = hh_e_shop_show; static hh_e_upgrades upgrades[HH_SHOP_UPG_DISPLAY] = {0}; static uint8_t selected = 0; @@ -11,11 +11,11 @@ void hh_shop(hh_e_game_state* hh_game_state){ switch (hh_e_shop) { case hh_e_shop_show: - hh_clear_screen(); - hh_clear_sprite(); + // hh_clear_screen(); + // hh_clear_sprite(); // TODO: make function to show shop - // hh_setup_screen(); //hh_setup_shop(); + hh_setup_screen(*level_shop); hh_shop_init(&upgrades); selected = HH_SHOP_UPG_DISPLAY/2; hh_shop_display(selected, &upgrades); @@ -33,7 +33,7 @@ void hh_shop(hh_e_game_state* hh_game_state){ } if(g_hh_controller_p1.button_primary){ //apply selected upgrade - hh_e_shop = hh_e_shop_end; + // hh_e_shop = hh_e_shop_end; } if(g_hh_controller_p1.button_secondary){//Quick exit hh_e_shop = hh_e_shop_end; @@ -60,7 +60,7 @@ void hh_shop_init(hh_e_upgrades* in) { } void hh_shop_display(uint8_t selected, hh_e_upgrades* upgrades) { - const vec_cor start = {48,16}; + const vec_cor start = {104,144+16}; const uint8_t up = 8, space = 24+8; diff --git a/src/game_loop/shop.h b/src/game_loop/shop.h index 642bcc3..6f8f5a7 100644 --- a/src/game_loop/shop.h +++ b/src/game_loop/shop.h @@ -17,7 +17,7 @@ typedef enum { /** @brief amount of upgrade types */ #define HH_SHOP_UPG_COUNT 5 /** @brief count of visible upgrades in shop */ -#define HH_SHOP_UPG_DISPLAY 5 +#define HH_SHOP_UPG_DISPLAY 4 /** @brief all possible upgrades */ typedef enum { hh_e_upg_jump, @@ -34,4 +34,4 @@ void hh_shop_display(uint8_t selected, hh_e_upgrades* upgrades); /** @brief moves 'cursor' through selection field */ void hh_shift_selected(uint8_t* pos, bool dir, uint8_t min, uint8_t max); -void hh_shop(hh_e_game_state*); +void hh_shop(hh_e_game_state* ,hh_level_entity* ); |