-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathowl.wl
103 lines (94 loc) · 1.94 KB
/
owl.wl
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
use "importc"
import(C) "/usr/include/stdlib.h"
import "sprite.wl"
import "sdl.wl"
import "fireball.wl"
import "halo.wl"
import "main.wl"
struct Owl
{
float x
float y
Sprite^ head
Sprite^ body
Sprite^ wingl
Sprite^ wingr
Sprite^ tail
}
int HEADX = 0
int HEADY = 20
int TAILX = 0
int TAILY = 20
int BODYX = 0
int BODYY = 0
int WINGX = 20
int WINGY = 0
int HALOX = 0
int HALOY = 0
Owl^ owl_new()
{
Owl^ o = malloc(128)
o.x = 160
o.y = 200
o.head = sprite_new("res/owlhead.png")
o.body = sprite_new("res/owlbody.png")
o.wingl = sprite_new("res/owlwingl.png")
o.wingr = sprite_new("res/owlwingr.png")
o.tail = sprite_new("res/owltail.png")
return o
}
void owl_update(Owl^ o)
{
o.head.x = o.x
o.head.y = o.y - HEADY
o.tail.x = o.x
o.tail.y = o.y + TAILY
o.body.x = o.x
o.body.y = o.y
o.wingl.x = o.x - WINGX
o.wingl.y = o.y + WINGY
o.wingr.x = o.x + WINGX
o.wingr.y = o.y + WINGY
}
void owl_draw(Owl^ o, SDL_Surface^ dst, SDL_Surface^ lit)
{
sprite_draw(dst, o.body)
sprite_draw(dst, o.head)
sprite_draw(dst, o.wingl)
sprite_draw(dst, o.wingr)
sprite_draw(dst, o.tail)
if(hunger >= 2000)
{
halo_draw(lit, 2, o.x, o.y)
} else if(hunger >= 1800)
{
halo_draw(lit, 2, o.x, o.y)
} else if(hunger >= 1600)
{
halo_draw(lit, 3, o.x, o.y)
} else if(hunger >= 1400)
{
halo_draw(lit, 3, o.x, o.y)
} else if(hunger >= 1200)
{
halo_draw(lit, 4, o.x, o.y)
} else if(hunger >= 1000)
{
halo_draw(lit, 4, o.x, o.y)
} else if(hunger >= 800)
{
halo_draw(lit, 5, o.x, o.y)
} else if(hunger >= 600)
{
halo_draw(lit, 6, o.x, o.y)
} else if(hunger >= 400)
{
halo_draw(lit, 7, o.x, o.y)
} else if(hunger >= 200)
{
halo_draw(lit, 8, o.x, o.y)
} else
{
halo_draw(lit, 9, o.x, o.y)
}
}