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
|
import "./controls" for Controls
import "./config" for Config
import "audio" for AudioEngine
import "font" for Font
import "graphics" for Canvas, Color
class CreditScreen {
construct new(gameState) {
__gameState = gameState
var channel = AudioEngine.play("credit", 0.5, true)
__credits = [
{
"text": "A GAME BY",
"padding": 10,
"type": "title"
},
{
"text": "Indrajith K L",
"padding": 30
},
{
"text": "TILESETS & SPRITES",
"padding": 50,
"type": "title"
},
{
"text": "kenney.nl",
"padding": 70
},
{
"text": "MUSIC",
"padding": 90,
"type": "title"
},
{
"text": "Juhani Junkala & Eric Skiff",
"padding": 110
},
{
"text": "SFX",
"padding": 130,
"type": "title"
},
{
"text": "sfxr",
"padding": 150
},
{
"text": "For More Games",
"padding": 170,
"type": "title"
},
{
"text": "indrajithmakesgames.com",
"padding": 190,
"type": "info"
}
]
}
update() {
if(Controls.justPressed(Config.KeyboardConstants["ATTACK"])) {
__gameState.switch("menu")
}
}
draw(dt) {
var x = 0
var y = 10
for(credit in __credits) {
drawCredit(credit, x, y)
var y = y + 10
}
}
drawCredit(credit, x, y) {
x = Config.W/2 - ((credit["text"].count * 8)/2)
y = credit["padding"] + y
Canvas.print(credit["text"],x ,y , Color.white, credit["type"]=="info" ? "font_minecraft": Font.default)
if(credit["type"]=="title") {
x = x
for(i in 0...(credit["text"].count)) {
Canvas.print("-",x ,y+8 , Color.white, Font.default)
x = x + 8
}
}
}
}
|