-
Notifications
You must be signed in to change notification settings - Fork 0
/
title.way
99 lines (73 loc) · 3.15 KB
/
title.way
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
global const Font ATASCII = Graphics:loadFont("atascii.png", 16)
global int MUSIC = -1
snd_load MUSIC "sounds/music.wav"
snd_action loop MUSIC -1
global const Sprite LIGHTHOUSE_SPRITE = Graphics:loadSprite("sprites/lighthouse.png")
global const Sprite CLIFF_SPRITE = Graphics:loadSprite("sprites/cliff.png")
global const Color LIGHT_OFF = Graphics:newColor(250, 200, 50, 24)
global const Color LIGHT_ON = Graphics:newColor(250, 200, 50, 128)
global List clouds = List:new()
int i = 0
while i < MAX_CLOUDS {
List:add(clouds, Cloud:new())
i++
}
{
array TITLE_SPRITE = 8
TITLE_SPRITE[0] = Graphics:loadSprite("sprites/title.png", 0, 0, 128, 32)
TITLE_SPRITE[1] = Graphics:loadSprite("sprites/title.png", 128, 0, 256, 32)
TITLE_SPRITE[2] = Graphics:loadSprite("sprites/title.png", 256, 0, 384, 32)
TITLE_SPRITE[3] = Graphics:loadSprite("sprites/title.png", 384, 0, 512, 32)
int titleCurrentFrame = 0
string text = "PRESS SPACE"
string author = "Bearsacker - 2019"
while !Input:isKeyPressed(KEY_SPACE) {
Input:flush()
Graphics:clear()
Sea:draw()
if SEA.frame == 0 {
titleCurrentFrame = (titleCurrentFrame + 1) % 4
}
if titleCurrentFrame < 2 {
Graphics:drawText(text, ZOOM * (128 - text.length * 4), ZOOM * 128, ATASCII, ZOOM / 2)
}
Graphics:drawText(author, ZOOM * (252 - author.length * 4), ZOOM * 186, ATASCII, ZOOM / 4)
int i = 0
while i < clouds.size {
Cloud:draw(clouds.elements[i])
i++
}
Graphics:drawSprite(TITLE_SPRITE[titleCurrentFrame], 0, ZOOM * 42, 0, 2 * ZOOM)
Graphics:flush()
sleep 100
}
Sprite rock1 = Graphics:loadSprite("sprites/rock1.png", 0, 0, 16, 16)
Sprite rock2 = Graphics:loadSprite("sprites/rock2.png", 0, 0, 16, 16)
Sprite rock3 = Graphics:loadSprite("sprites/rock3.png", 0, 0, 16, 16)
snd_action play KRAKEN_LAUGHING_SOUND null
int step = 64
while step > 0 {
Graphics:clear()
Sea:draw()
int i = 0
while i < clouds.size {
Cloud:draw(clouds.elements[i])
i++
}
Graphics:drawSprite(TITLE_SPRITE[titleCurrentFrame], 0, ZOOM * (-42 + step) * 2, 0, 2 * ZOOM)
Graphics:drawSprite(rock1, 0, ZOOM * (112 + step), 0, ZOOM)
Graphics:drawSprite(rock2, ZOOM * 48, ZOOM * (128 + step), 0, ZOOM)
Graphics:drawSprite(rock1, ZOOM * 160, ZOOM * (128 + step), 0, ZOOM)
Graphics:drawSprite(rock2, ZOOM * 208, ZOOM * (160 + step), 0, ZOOM)
Graphics:drawSprite(rock3, ZOOM * 224, ZOOM * (144 + step), 0, ZOOM)
Graphics:drawSprite(rock1, ZOOM * 112, ZOOM * (176 + step), 0, ZOOM)
Graphics:drawSprite(rock2, ZOOM * 128, ZOOM * (176 + step), 0, ZOOM)
Graphics:drawSprite(rock3, ZOOM * 96, ZOOM * (176 + step), 0, ZOOM)
Graphics:drawSprite(rock3, ZOOM * 144, ZOOM * (176 + step), 0, ZOOM)
Graphics:drawSprite(CLIFF_SPRITE, ZOOM * 104, ZOOM * (160 + step), 0, ZOOM)
Graphics:drawSprite(LIGHTHOUSE_SPRITE, ZOOM * 112, ZOOM * (126 + step), 0, ZOOM)
Graphics:flush()
step -= 2
sleep 25
}
}