aboutsummaryrefslogtreecommitdiff
path: root/src/engine/entity.c
diff options
context:
space:
mode:
authorNielsCoding <48092678+heavydemon21@users.noreply.github.com>2023-04-04 15:25:34 +0200
committerNielsCoding <48092678+heavydemon21@users.noreply.github.com>2023-04-04 15:25:34 +0200
commit854a80001b9798d1454e4308e4efba96431e44d8 (patch)
tree8e023b13df43b3aaef5241e59bcbe5c90b1a2f8a /src/engine/entity.c
parentf6c1eb582ac44b92c86816352bd56da5a6f4f1b5 (diff)
bullet/player/enemy/gameplay
bullet only needs different directions player is done enemy needs ai(Bjorn) gameplay may need some finetuning
Diffstat (limited to 'src/engine/entity.c')
-rw-r--r--src/engine/entity.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/engine/entity.c b/src/engine/entity.c
index 43a1b73..1cb88be 100644
--- a/src/engine/entity.c
+++ b/src/engine/entity.c
@@ -212,3 +212,25 @@ void hh_hit_entity(hh_entity* object_1, int8_t* hit_timer, int8_t* direction){
}
}
+
+void hh_check_all_collisions(hh_entity* player, hh_entity* enemies, int total_enemies, hh_entity* bullets, int total_bullets, vec_cor cam_pos){
+ for(int enemy = 0; enemy < total_enemies; enemy++){
+ *player = hh_enemy_collision(*player, enemies[enemy]);
+ enemies[enemy].is_hit=false;
+ }
+
+ for(int i = 0; i < total_bullets; i++){
+ if(!bullets[i].is_grounded){
+ for (int enemy = 0; enemy < total_enemies; enemy++){
+
+ if(hh_distance_circles(bullets[i].pos,enemies[enemy].pos,bullets[i].radius,enemies[enemy].radius)){
+ enemies[enemy].is_hit=true;
+ hh_bullet_death(&bullets[i]);
+ }
+ }
+ }
+ }
+
+}
+
+