-
Notifications
You must be signed in to change notification settings - Fork 0
/
animations.c
68 lines (63 loc) · 1.81 KB
/
animations.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
** EPITECH PROJECT, 2019
** my_rpg
** File description:
** animation
*/
#include "my.h"
void coin_animation(elements_t *m)
{
m->time = sfClock_getElapsedTime(m->clock);
m->seconds = m->time.microseconds / 1000000.0;
if (m->seconds > 0.1) {
if (m->rect.left == 200) {
m->rect.left = 0;
} else
m->rect.left = m->rect.left + 40;
sfSprite_setTextureRect(m->coin, m->rect);
sfClock_restart(m->clock);
}
}
void npc_animation(npc_t *m)
{
m->time = sfClock_getElapsedTime(m->clock);
m->seconds = m->time.microseconds / 1000000.0;
if (m->seconds > 0.5) {
if (m->rect.left == 360) {
m->rect.left = 0;
} else
m->rect.left = m->rect.left + 180;
sfSprite_setTextureRect(m->hwall, m->rect);
sfSprite_setTextureRect(m->tree, m->rect);
sfSprite_setTextureRect(m->mush, m->rect);
sfClock_restart(m->clock);
}
}
void how_animation(how_to_play_t *m)
{
m->time = sfClock_getElapsedTime(m->clock);
m->seconds = m->time.microseconds / 1000000.0;
if (m->seconds > 0.5) {
if (m->rect.left == 994) {
m->rect.left = 0;
} else
m->rect.left = m->rect.left + 142;
sfSprite_setTextureRect(m->arr, m->rect);
sfClock_restart(m->clock);
}
}
void how_animation_2(how_to_play_t *m)
{
m->time1 = sfClock_getElapsedTime(m->clock1);
m->seconds1 = m->time1.microseconds / 1000000.0;
if (m->seconds1 > 0.5) {
if (m->rect1.left == 143) {
m->rect1.left = 0;
} else
m->rect1.left = m->rect1.left + 143;
sfSprite_setTextureRect(m->esc, m->rect1);
sfSprite_setTextureRect(m->space, m->rect1);
sfSprite_setTextureRect(m->i, m->rect1);
sfClock_restart(m->clock1);
}
}