blob: e6ca6dfae6fc0d9fed9adf0eb5d7b79602170ba2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "bullet.h"
// TODO: use hh_entity as bullet struct
void hh_shoot_bullet(vec2 player, vec_cor cam_pos, hh_entity* bullet){
vec2 temp;
if(g_hh_controller_p1.button_secondary){
if(bullet->is_grounded){
bullet->is_grounded=false;
bullet->pos = player;
}
}
else{
if(!bullet->is_grounded){
hh_update_bullet(bullet , cam_pos);
hh_draw_bullet(*bullet);
}
}
}
void hh_update_bullet(hh_entity* bullet, vec_cor cam_pos){
bullet->pos.x += 1;
// update bullet sprite on ppu
bullet->render.fam.position_x = (bullet->pos.x-cam_pos.x);
bullet->render.fam.position_y = (bullet->pos.y-cam_pos.y);
}
void hh_draw_bullet(hh_entity bullet){
hh_s_ppu_loc_fam_entry temp = bullet.render.fam;
hh_ppu_update_foreground(10,temp);
}
|