-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimation.c
executable file
·39 lines (36 loc) · 1.3 KB
/
animation.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* animation.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lebojo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/14 17:36:58 by lebojo #+# #+# */
/* Updated: 2023/05/30 03:56:44 by lebojo ### ########.fr */
/* */
/* ************************************************************************** */
#include "inc/proto.h"
void anim_player(t_level *l)
{
if (l->player.vel.x > 0 || l->player.vel.y > 0)
{
if (l->tx.pf.nb < l->tx.pf.max)
l->tx.pf.nb++;
else
l->tx.pf.nb = 0;
}
else if (l->player.vel.x < 0 || l->player.vel.y < 0)
{
if (l->tx.pf.nb > 0)
l->tx.pf.nb--;
else
l->tx.pf.nb = l->tx.pf.max;
}
}
void anim_coins(t_level *l)
{
if (l->tx.cf.nb < l->tx.cf.max)
l->tx.cf.nb++;
else
l->tx.cf.nb = 0;
}