-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_fill_p2.c
51 lines (47 loc) · 1.42 KB
/
ft_fill_p2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_fill_p2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ikgonzal <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/08 17:24:49 by ikgonzal #+# #+# */
/* Updated: 2021/12/12 19:58:34 by ikgonzal ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void ft_set_key(t_data *mlx)
{
if (mlx->key == 'S')
mlx->p_row += 1;
if (mlx->key == 'W')
mlx->p_row -= 1;
if (mlx->key == 'A')
mlx->p_col -= 1;
if (mlx->key == 'D')
mlx->p_col += 1;
}
void ft_fill_p2(t_data *mlx)
{
int row;
int col;
static int x;
static int y;
row = 0;
y = 0;
ft_set_key(mlx);
while (row < mlx->row_len)
{
col = 0;
x = 0;
while (col < mlx->col_len)
{
if (row == mlx->p_row && col == mlx->p_col)
ft_move_player(mlx, row, col);
x = x + 50;
col++;
}
y = y + 50;
row++;
}
}