aboutsummaryrefslogtreecommitdiff
path: root/src/engine/bullet.c
blob: 2016a4d9cb5dbf5b5f45d32eaef020563a717cd2 (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 shootBullet(vec2 playerPos, 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 = playerPos;
		}
	}
	else{
		if(!bullet->is_grounded){
			updateBullet(bullet , cam_pos, temp);
			drawBullet(*bullet);
		}
	}
	

}
void collision
void updateBullet(hh_entity* bullet, vec_cor cam_pos, vec2 start){
	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 drawBullet(hh_entity bullet){
	hh_s_ppu_loc_fam_entry temp = bullet.render.fam;
	hh_ppu_update_foreground(10,temp);
}