-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbigchest.cpp
More file actions
52 lines (45 loc) · 747 Bytes
/
bigchest.cpp
File metadata and controls
52 lines (45 loc) · 747 Bytes
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
#include "bigchest.h"
#include "orb.h"
BigChest::BigChest()
: Object(big_chest)
{
}
void BigChest::init()
{
state = 0;
hitbox.w = 16;
}
void BigChest::update()
{
// empty
}
void BigChest::draw()
{
if (state == 0)
{
Object * hit = collide(player, 0, 8);
if (hit && hit->is_solid(0, 1))
{
pause_player = true;
hit->spd.x = 0;
hit->spd.y = 0;
state = 1;
timer = 60;
}
drawSprite(96, x, y);
drawSprite(97, x + 8, y);
}
else if (state == 1)
{
timer--;
if (timer < 0)
{
state = 2;
Orb * orb = new Orb;
init_object(orb, x, y);
pause_player = false;
}
}
drawSprite(112, x, y + 8);
drawSprite(113, x + 8, y + 8);
}