-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSpriteBossLaserBall.c
65 lines (50 loc) · 1.29 KB
/
SpriteBossLaserBall.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
#include "Banks/SetBank2.h"
#include "Keys.h"
#include "SpriteManager.h"
#include "Scroll.h"
#include "ZGBMain.h" // get access to sprite types, delta_time
#include "Sound.h"
#include "Trig.h"
const UINT8 anim_Laser[] = {1, 0};
struct LaserInfo
{
UINT8 angle;
UINT8 laserDelay;
};
fixed laserAccum_x;
fixed laserAccum_y;
INT16 laserSpeed_x;
INT16 laserSpeed_y;
void Start_SpriteBossLaserBall() {
THIS->coll_x = 3;
THIS->coll_y = 3;
THIS->coll_w = 10;
THIS->coll_h = 10;
THIS->lim_x = 0xff;
THIS->lim_y = 0xff;
SetSpriteAnim(THIS,anim_Laser, 15);
}
void Update_SpriteBossLaserBall() {
struct LaserInfo* data = (struct LaserInfo*)THIS->custom_data;
if (data->laserDelay == 0)
{
laserSpeed_x = SIN(data->angle) << 2;
laserSpeed_y = COS(data->angle) << 2;
laserAccum_x.w += laserSpeed_x << delta_time;
laserAccum_y.w += laserSpeed_y << delta_time;
if (TranslateSprite(THIS, laserAccum_x.b.h, laserAccum_y.b.h))
{
PlayFx(CHANNEL_4, 4, 0x0c, 0x41, 0x30, 0xc0);
SpriteManagerRemoveSprite(THIS);
}
data->laserDelay = 1;
}
else
{
data->laserDelay--;
}
laserAccum_x.b.h = 0;
laserAccum_y.b.h = 0;
}
void Destroy_SpriteBossLaserBall() {
}