From 5b287c89362171175592c5eab247fb8a7b7d28ff Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 30 Mar 2020 19:45:31 +0200 Subject: Fine --- src/ft_bad_boy_actions.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/ft_bad_boy_actions.c') diff --git a/src/ft_bad_boy_actions.c b/src/ft_bad_boy_actions.c index 775e917..eada61a 100644 --- a/src/ft_bad_boy_actions.c +++ b/src/ft_bad_boy_actions.c @@ -43,16 +43,18 @@ void if (FT_OS == 2) { - r_x = (random() % 2 == 1) ? (1) : (-1); - r_y = (random() % 2 == 1) ? (1) : (-1); + r_x = random() % 3; + r_y = random() % 3; } else { - r_x = (rand() % 2 == 1) ? (1) : (-1); - r_y = (rand() % 2 == 1) ? (1) : (-1); + r_x = rand() % 3; + r_y = rand() % 3; } - sl->s_pos_x += (0.1 * r_x); - sl->s_pos_y += (0.1 * r_y); + r_x = (r_x == 2) ? (-1) : (r_x); + r_y = (r_y == 2) ? (-1) : (r_y); + sl->s_pos_x += (FT_MOVE_SPEED * 1.5 * r_x); + sl->s_pos_y += (FT_MOVE_SPEED * 1.5 * r_y); ft_bb_collision(old_y, old_x, sl, ml); ml->map[lround(old_y)][lround(old_x)] = '0'; ml->map[lround(sl->s_pos_y)][lround(sl->s_pos_x)] = 'e'; -- cgit v1.2.3