-
Notifications
You must be signed in to change notification settings - Fork 2
/
gems.cpp
57 lines (46 loc) · 1.17 KB
/
gems.cpp
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
#include "gems.h"
#include "splashkit.h"
string gem_image(gem_kind gem)
{
switch (gem)
{
case SAPPHIRE:
return "sapphire";
break;
case EMERALD:
return "emerald";
break;
case RUBY:
return "ruby";
break;
case DIAMOND:
return "diamond";
break;
default:
return "diamond";
}
}
gem_data new_gem(int x, int y)
{
gem_data result;
bitmap gem_pack = load_bitmap("gems", "gems.png");
bitmap_set_cell_details(gem_pack,32,32, 2, 2, 4);
load_animation_script("gem", "gems.txt");
result.anim = animation_script_named("gem");
result.gem_sprite = create_sprite(gem_pack, result.anim);
result.x = x;
result.y = y;
sprite_set_x(result.gem_sprite, result.x);
sprite_set_y(result.gem_sprite, result.y);
sprite_set_collision_bitmap(result.gem_sprite, gem_pack);
sprite_start_animation(result.gem_sprite, RUBY);
return result;
}
void draw_gem(const gem_data &draw)
{
draw_sprite(draw.gem_sprite);
}
void update_gem(gem_data &update, int x, int y)
{
update_sprite(update.gem_sprite);
}