diff options
| author | Dominik Kaiser | 2024-05-09 19:25:14 +0200 |
|---|---|---|
| committer | Dominik Kaiser | 2024-05-09 19:25:14 +0200 |
| commit | 9306ce8b7950960d72a8e0871d917df181d900fa (patch) | |
| tree | f91e174eb0340a7a931311c520947d1f4a5bab01 /src/loop.c | |
| parent | e2c309d1bec9fb18e39d453a1dfdccfa877f5633 (diff) | |
| download | so_long-9306ce8b7950960d72a8e0871d917df181d900fa.tar.gz so_long-9306ce8b7950960d72a8e0871d917df181d900fa.zip | |
Add player image
Diffstat (limited to 'src/loop.c')
| -rw-r--r-- | src/loop.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -6,7 +6,7 @@ /* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/09 15:09:24 by dkaiser #+# #+# */ -/* Updated: 2024/05/09 18:03:03 by dkaiser ### ########.fr */ +/* Updated: 2024/05/09 19:08:51 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,15 +16,14 @@ int loop(t_game *game) { - mlx_clear_window(game->mlx, game->window); game->player.direction.x = ((game->input_direction & RIGHT) != 0) - ((game->input_direction & LEFT) != 0); game->player.direction.y = ((game->input_direction & DOWN) != 0) - ((game->input_direction & UP) != 0); - game->player.position.x += game->player.direction.x; - game->player.position.y += game->player.direction.y; + game->player.position.x += game->player.direction.x * PLAYER_MOVE_SPEED; + game->player.position.y += game->player.direction.y * PLAYER_MOVE_SPEED; draw(game); return (0); |
