-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_menu.lua
116 lines (92 loc) · 4.21 KB
/
start_menu.lua
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
104
105
106
107
108
109
110
111
112
113
114
115
116
-- MODULES -------------------------------------------------------------------------------------------------------------
local my_game_settings = require("game_settings")
local my_scenes = require("scenes")
-- ATTRIBUTES ----------------------------------------------------------------------------------------------------------
local start_menu = {}
start_menu.background_color = {0/255, 0/255, 0/255}
start_menu.main_tileset = nil
start_menu.sf2_logo = {}
start_menu.sf2_logo.texture = nil
start_menu.sf2_logo.x = 0
start_menu.sf2_logo.y = 10
start_menu.hfighting_text = {}
start_menu.hfighting_text.texture = nil
start_menu.hfighting_text.x = 70
start_menu.hfighting_text.y = 133
start_menu.gstart_text = {}
start_menu.gstart_text.texture = nil
start_menu.gstart_text.x = 85
start_menu.gstart_text.y = 168
start_menu.gstart_text.isDisplay = true
start_menu.timer = love.timer.getTime()
-- FUNCTIONS -----------------------------------------------------------------------------------------------------------
function start_menu.main_tileset_load()
start_menu.main_tileset = love.graphics.newImage("img/sf2_snes_start_menu_tileset.png")
end
function start_menu.sf2_logo_load()
start_menu.sf2_logo.texture = love.graphics.newQuad(464, 282,
256, 117,
start_menu.main_tileset:getDimensions())
end
function start_menu.hfighting_text_load()
start_menu.hfighting_text.texture = love.graphics.newQuad(12, 110,
121, 10,
start_menu.main_tileset:getDimensions())
end
function start_menu.gstart_text_load()
start_menu.gstart_text.texture = love.graphics.newQuad(165, 349,
80, 8,
start_menu.main_tileset:getDimensions())
end
function start_menu.sf2_logo_draw()
love.graphics.draw(start_menu.main_tileset, start_menu.sf2_logo.texture,
start_menu.sf2_logo.x * my_game_settings.scale_factor,
start_menu.sf2_logo.y * my_game_settings.scale_factor,
nil,
my_game_settings.scale_factor, my_game_settings.scale_factor)
end
function start_menu.hfighting_text_draw()
love.graphics.draw(start_menu.main_tileset, start_menu.hfighting_text.texture,
start_menu.hfighting_text.x * my_game_settings.scale_factor,
start_menu.hfighting_text.y * my_game_settings.scale_factor,
nil,
my_game_settings.scale_factor, my_game_settings.scale_factor)
end
function start_menu.gstart_text_draw()
local interval_time = love.timer.getTime() - start_menu.timer
if interval_time > 0.7 and start_menu.gstart_text.isDisplay == true then
interval_time = 0
start_menu.timer = love.timer.getTime()
start_menu.gstart_text.isDisplay = false
end
if interval_time > 0.7 and start_menu.gstart_text.isDisplay == false then
interval_time = 0
start_menu.timer = love.timer.getTime()
start_menu.gstart_text.isDisplay = true
end
if start_menu.gstart_text.isDisplay == true then
love.graphics.draw(start_menu.main_tileset, start_menu.gstart_text.texture,
start_menu.gstart_text.x * my_game_settings.scale_factor,
start_menu.gstart_text.y * my_game_settings.scale_factor,
nil,
my_game_settings.scale_factor, my_game_settings.scale_factor)
end
end
function start_menu.start_game()
if love.keyboard.isDown("return") then
my_scenes.selected = 2
end
end
-- CALLBACKS -----------------------------------------------------------------------------------------------------------
function start_menu.load()
start_menu.main_tileset_load()
start_menu.sf2_logo_load()
start_menu.hfighting_text_load()
start_menu.gstart_text_load()
end
function start_menu.draw()
start_menu.sf2_logo_draw()
start_menu.hfighting_text_draw()
start_menu.gstart_text_draw()
end
return start_menu