diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-30 19:45:31 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-30 19:45:31 +0200 |
commit | 5b287c89362171175592c5eab247fb8a7b7d28ff (patch) | |
tree | 7319f00b79ee85a9e551b5ce5a89280e549fb5ca /src/ft_bad_boy_actions.c | |
parent | Pretty coolio (diff) | |
download | 42-cub3d-5b287c89362171175592c5eab247fb8a7b7d28ff.tar.gz 42-cub3d-5b287c89362171175592c5eab247fb8a7b7d28ff.tar.bz2 42-cub3d-5b287c89362171175592c5eab247fb8a7b7d28ff.tar.xz 42-cub3d-5b287c89362171175592c5eab247fb8a7b7d28ff.tar.zst 42-cub3d-5b287c89362171175592c5eab247fb8a7b7d28ff.zip |
Fine
Diffstat (limited to 'src/ft_bad_boy_actions.c')
-rw-r--r-- | src/ft_bad_boy_actions.c | 14 |
1 files changed, 8 insertions, 6 deletions
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'; |