-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmiami_moon.p8
80 lines (62 loc) · 1.09 KB
/
miami_moon.p8
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
-- Be sure to see accompanying explanations at gamestate.org
-- gwl 2020
function _init()
astro={1,2,3,4}
deathstar={40,1}
shadow=17
moony=113
screenwide=128
anim_speed=21
move_speed=14
cel_idx = 1
framecount = 1
astro_x = 0
end
function _update()
framecount = framecount + 1
astro_y = moony
local t1 = timer(anim_speed)
if (t1 == true) then
cel_idx = cel_idx + 1
if (cel_idx > #astro) then
cel_idx = 1
end
end
local t2 = timer(move_speed)
if (t2 == true) then
astro_x = astro_x + 1
if (astro_x > screenwide) then
astro_x = - 8
end
end
end
function _draw()
cls(0)
show_moonsurface()
show_deathstar()
show_astro()
end
function timer(fs)
local alarm = false
local t = framecount % fs
if (t == 0) then
alarm = true
end
return alarm
end
function show_moonsurface()
map(0,4,0,0,16,16)
end
function show_deathstar()
local col=deathstar[1]
local row=deathstar[2]
local x=90
local y=9
map(col, row, x, y, 2, 2)
end
function show_astro()
local shadowy=astro_y+7
spr(shadow, astro_x, shadowy)
local cel = astro[cel_idx]
spr(cel, astro_x, astro_y)
end