Skip to content

Commit

Permalink
[0.22.12] - Improved Blight shooting accuraccy & added modifiably ina…
Browse files Browse the repository at this point in the history
…ccuraccy macro
  • Loading branch information
FreddyMSchubert committed Jun 28, 2024
1 parent f928b38 commit 97e4ef4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### [0.22.12] - 28.06.2024 - Freddy
- Blights not properly shooting at you if youre not looking at you fix (Calculated shooting angle based on rot not pos)
- BLIGHT_SHOOTING_INACCURACY_DEG to modify shooting accuracy of a blight

### [0.22.11] - 28.06.2024 - Freddy
- Norminettification & Unnecessities removal
- util/
Expand Down
3 changes: 2 additions & 1 deletion include/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: freddy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/28 08:45:22 by freddy #+# #+# */
/* Updated: 2024/06/28 13:17:49 by freddy ### ########.fr */
/* Updated: 2024/06/28 17:47:45 by freddy ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -78,6 +78,7 @@
# define BLIGHT_MINIUM_ROTATION_DEG 45
# define BLIGHT_MAX_SPAWN_DISTANCE 10
# define BLIGHT_SPAWN_RETURNING_DEG_VARIATION 60
# define BLIGHT_SHOOTING_INACCURACY_DEG 30

// animations

Expand Down
12 changes: 7 additions & 5 deletions src/3_game_loop/a_game_logic/entities/blight_entity.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* BLIGHT_NTTntity.c :+: :+: :+: */
/* blight_entity.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fschuber <fschuber@student.42.fr> +#+ +:+ +#+ */
/* By: freddy <freddy@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/26 21:57:58 by freddy #+# #+# */
/* Updated: 2024/06/28 10:06:03 by fschuber ### ########.fr */
/* Updated: 2024/06/28 17:48:17 by freddy ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -93,8 +93,10 @@ void tick_blight(t_entity *self)
{
if (self->frames_since_state_change > BLIGHT_ATTACK_ANIMATION_FRAMES)
{
self->transform.rot.x = self->transform.rot.x - player()->transform.rot.x;
self->transform.rot.y = self->transform.rot.y - player()->transform.rot.y;
self->transform.rot.x = player()->transform.pos.x - self->transform.pos.x;
self->transform.rot.y = player()->transform.pos.y - self->transform.pos.y;
self->transform.rot = scale_vector(self->transform.rot, 1);
self->transform.rot = deg_to_dir_vec(dir_vec_to_deg(self->transform.rot) + (random_val() * BLIGHT_SHOOTING_INACCURACY_DEG - (BLIGHT_SHOOTING_INACCURACY_DEG / 2)));
shooooot(self->transform, blight->type);
blight->state = BLIGHT_STATE_WALKING;
self->frames_since_state_change = 0;
Expand Down

0 comments on commit 97e4ef4

Please sign in to comment.