diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-13 04:23:57 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-13 04:23:57 +0100 |
commit | 6714c479c5d9bcb025212de44ec92424458261d6 (patch) | |
tree | 73b7ebbaf1f40d36bb6d453826accd90188a5b10 /src/ft_key_loop.c | |
parent | sounds (diff) | |
download | 42-cub3d-6714c479c5d9bcb025212de44ec92424458261d6.tar.gz 42-cub3d-6714c479c5d9bcb025212de44ec92424458261d6.tar.bz2 42-cub3d-6714c479c5d9bcb025212de44ec92424458261d6.tar.xz 42-cub3d-6714c479c5d9bcb025212de44ec92424458261d6.tar.zst 42-cub3d-6714c479c5d9bcb025212de44ec92424458261d6.zip |
Huge bug on death
Diffstat (limited to '')
-rw-r--r-- | src/ft_key_loop.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c index 8f9d688..a7af38e 100644 --- a/src/ft_key_loop.c +++ b/src/ft_key_loop.c @@ -49,28 +49,26 @@ static void { uint64_t x; uint64_t y; - t_player *pl; - pl = &cl->plist; - x = ft_find_x(key, pl); - y = ft_find_y(key, pl); + x = ft_find_x(key, &cl->plist); + y = ft_find_y(key, &cl->plist); if (cl->mlist.map[y][x] == 'T') { - pl->pos_x = old_x + ((old_x - x) / 3); - pl->pos_y = old_y + ((old_y - y) / 3); + cl->plist.pos_x = old_x + ((old_x - x) / 2); + cl->plist.pos_y = old_y + ((old_y - y) / 2); if (FT_OS == 1) ft_macos_suffer_animation(cl); else ft_linux_suffer_animation(cl); - x = ft_find_x(key, pl); - y = ft_find_y(key, pl); + x = ft_find_x(key, &cl->plist); + y = ft_find_y(key, &cl->plist); } if (ft_ischarset(FT_CHRST_COLLISION, cl->mlist.map[(uint64_t)old_y][x]) || cl->mlist.map[(uint64_t)old_y][x] == '\0') - pl->pos_x = old_x; + cl->plist.pos_x = old_x; if (ft_ischarset(FT_CHRST_COLLISION, cl->mlist.map[y][(uint64_t)old_x]) || cl->mlist.map[y][(uint64_t)old_x] == '\0') - pl->pos_y = old_y; + cl->plist.pos_y = old_y; } int @@ -85,7 +83,7 @@ int { cl->key_ptr[cl->key_input[i]](cl); ft_collision(old_y, old_x, cl->key_input[i], cl); - if (cl->mlist.isnlvl) + if (cl->mlist.isnlvl && !cl->plist.isdead) { if ((uint32_t)cl->plist.pos_x == cl->mlist.nlx && (uint32_t)cl->plist.pos_y == cl->mlist.nly) @@ -96,7 +94,7 @@ int } i++; } - if (cl->key_input[0] != -1) + /* if (cl->key_input[0] != -1) */ ft_draw_scene(cl); return (0); } |