blob: b5509bb976d1bd4993c189738ce7f7357546aea2 (
plain)
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
|
/**
* @file fanWind.c
* @ingroup Objects
*
* @brief Fan Wind object
*/
#include "collision.h"
#include "entity.h"
#include "physics.h"
#include "map.h"
void FanWind(Entity* this) {
u8* collisionData;
if (this->action == 0) {
this->action = 1;
this->timer = 16;
this->direction = this->type << 3;
if (this->collisionLayer == 2) {
collisionData = gMapTop.collisionData;
} else {
collisionData = gMapBottom.collisionData;
}
this->child = (Entity*)collisionData;
InitializeAnimation(this, this->type);
}
this->speed = this->parent->speed;
LinearMoveUpdate(this);
if (IsTileCollision((u8*)this->child, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) {
DeleteThisEntity();
}
if (this->speed < 0x41) {
this->spriteSettings.draw ^= 1;
if (--this->timer == 0) {
DeleteThisEntity();
}
}
GetNextFrame(this);
}
|