fix: moving

This commit is contained in:
mcolonna 2024-10-17 12:29:58 +02:00
parent 4ea2cf266b
commit d7903ec615

4
move.c
View file

@ -6,7 +6,7 @@
/* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */ /* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/15 12:47:34 by mcolonna #+# #+# */ /* Created: 2024/10/15 12:47:34 by mcolonna #+# #+# */
/* Updated: 2024/10/15 18:22:58 by mcolonna ### ########.fr */ /* Updated: 2024/10/17 12:29:23 by mcolonna ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -22,7 +22,7 @@ static int move(int factor)
(int)(g_map.player.pos.y) (int)(g_map.player.pos.y)
)->wall == EMPTY )->wall == EMPTY
) )
g_map.player.pos.x += dir.x * MOVE_SPEED; g_map.player.pos.x += dir.x * MOVE_SPEED * factor;
if (map_get_case(&g_map, if (map_get_case(&g_map,
(int)(g_map.player.pos.x), (int)(g_map.player.pos.x),
(int)(g_map.player.pos.y + dir.y * MOVE_SPEED * factor) (int)(g_map.player.pos.y + dir.y * MOVE_SPEED * factor)