-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathf3.c
53 lines (48 loc) · 1.57 KB
/
f3.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
52
53
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* f3.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: atabiti <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/19 12:31:34 by atabiti #+# #+# */
/* Updated: 2022/03/23 11:19:34 by atabiti ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
int check_collectible_right(struct s_s2 *a, int h)
{
if (a->exactarray[a->y_p][a->x_p + 1] == 'C')
{
h += 1;
a->exactarray[a->y_p][a->x_p + 1] = '0';
}
return (h);
}
int check_collectible_left(struct s_s2 *a, int h)
{
if (a->exactarray[a->y_p][a->x_p - 1] == 'C')
{
h += 1;
a->exactarray[a->y_p][a->x_p - 1] = '0';
}
return (h);
}
int check_collectible_up(struct s_s2 *a, int h)
{
if (a->exactarray[a->y_p - 1][a->x_p] == 'C')
{
h += 1;
a->exactarray[a->y_p - 1][a->x_p] = '0';
}
return (h);
}
int check_collectible_down(struct s_s2 *a, int h)
{
if (a->exactarray[a->y_p + 1][a->x_p] == 'C')
{
h += 1;
a->exactarray[a->y_p + 1][a->x_p] = '0';
}
return (h);
}