diff options
Diffstat (limited to 'src/engine/player_controller.c')
-rw-r--r-- | src/engine/player_controller.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/engine/player_controller.c b/src/engine/player_controller.c index 7d2847e..cec28df 100644 --- a/src/engine/player_controller.c +++ b/src/engine/player_controller.c @@ -8,9 +8,6 @@ #include "engine/animator.h" #include "engine/bullet.h" void hh_player_actions() { - static Bullet bullet ={ - .isActive=false, - }; static hh_entity player={ .hp = 4, .speed = 6, @@ -33,6 +30,25 @@ void hh_player_actions() { } }, player_new = {0}; + static hh_entity bullet={ +// .hp = 4, + .speed = 6, + .is_grounded = true, + .is_hit = false, + .radius = 8, + .pos = (vec2){-16,-16}, + .vel = (vec2){0,0}, + .render = { + .frame0 = 84, + .palette = 3, + .fam = (hh_s_ppu_loc_fam_entry){ + .horizontal_flip = false, + .vertical_flip = false, + .palette_index = 7, + .tilemap_index = 84, + } + } + }; static hh_entity enemy={ .hp = 4, @@ -119,13 +135,6 @@ void hh_player_actions() { } else if (player.vel.y < 6){ player.vel.y += 1; //gravity } - - if(g_hh_controller_p1.button_secondary==true){ - shootBullet(player.pos,&bullet); - } - updateBullet(&bullet,5); - - /* player.vel = (vec2){.x = (-1 * g_hh_controller_p1.dpad_left) + (1 * g_hh_controller_p1.dpad_right), @@ -143,11 +152,6 @@ void hh_player_actions() { }; player_new = hh_enemy_collision(player, enemy); - - - //END OF VECTOR CHANGES - // player.vel.y = CLAMP(player.vel.y,-32,32); - // player.vel.x = CLAMP(player.vel.x,-32,32); player_new.pos = (vec2){ .x = player.pos.x + player_new.vel.x, @@ -158,11 +162,11 @@ void hh_player_actions() { player = hh_background_collision( player, player_new); vec_cor cam_pos;//value in tiles - cam_pos = hh_update_camera(player.pos,(vec2){0,0},(vec2){.x=20*16,.y=30*16});//TODO: remove magic number(s) + cam_pos = hh_draw_screen(player.pos); + hh_shoot_bullet(player.pos, cam_pos ,&bullet); uint16_t idx = 16; idx = hh_update_sprite(idx, &player, cam_pos); idx = hh_update_sprite(idx, &enemy, cam_pos); - hh_draw_screen(cam_pos); idx =16; @@ -191,7 +195,7 @@ void hh_player_actions() { // } - hh_ppu_update_foreground(4, enemy.render.fam); + // hh_ppu_update_foreground(4, enemy.render.fam); } |