-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcredits.rb
More file actions
48 lines (45 loc) · 1.3 KB
/
Copy pathcredits.rb
File metadata and controls
48 lines (45 loc) · 1.3 KB
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
require "ruby2d"
require "json"
$credits_values = {
"state" => false,
"x_offset" => 10,
"y_offset" => 30,
"z" => 1000000
}
$credits_line_group = []
def credits_menu()
if $credits_values["state"] == false && $game_state == "ingame" || $credits_values["state"] == false && $game_state == "ingame"
$moveable = false
$credits_values["state"] = true
$game_state = "credits"
$credits_background = Rectangle.new(
x:0,
y:0,
width: $w,
height: $h,
color: "black",
z: $credits_values["z"]-1
)
$credits = JSON.parse(File.read($install_path + "credits.json"))
$credits.each_with_index do |text, id|
line = Text.new(
text,
x: $credits_values["x_offset"],
y: id * $credits_values["y_offset"],
size: 20,
z: $credits_values["z"],
font: $install_path + "assets/fonts/Jersey10-Regular.ttf"
)
$credits_line_group << line
end
elsif $credits_values["state"] == true && $game_state == "credits"
$credits_values["state"] = false && $game_state = "menu"
$credits_line_group.each_with_index do |element, id|
$credits_line_group[id].remove
end
$credits_line_group.clear
$credits_background.remove
$moveable = false
menu()
end
end