-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
54 lines (50 loc) · 1.75 KB
/
main.lua
File metadata and controls
54 lines (50 loc) · 1.75 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
48
49
50
51
52
53
54
--
require 'flatmoon.engine'
require 'flatmoon.director'
require 'flatmoon.tweener'
--make some usually stuff global
Thing = flatmoon.engine.Thing
yield = flatmoon.engine.yield
wait = flatmoon.engine.wait
listener = flatmoon.listener
stween = flatmoon.tweener.stween
ptween = flatmoon.tweener.ptween
director = flatmoon.director
--load all the file
require 'multimatch.content'
require 'multimatch.Saved'
require 'multimatch.Background'
require 'multimatch.stuffs.GUI'
require 'multimatch.stuffs.AnAL'
require 'multimatch.stuffs.lanes'
require 'multimatch.scenes.menu'
require 'multimatch.scenes.play'
require 'multimatch.scenes.how'
require 'multimatch.scenes.highs'
require 'multimatch.scenes.settings'
require 'multimatch.scenes.play.Board'
require 'multimatch.scenes.play.Gem'
require 'multimatch.scenes.play.LevelManager'
require 'multimatch.scenes.play.getBestMoves'
--game's first function
function gmain()
--load content first, it may be take a little secs, so show the progress
local progress = Thing.new()
local screenWidth, screenHeight = g.getWidth(), g.getHeight()
progress.draw = function (self)
--draw a progress bar that show what percent is the loading progress are going
g.setColor(255, 255, 255)
g.setLineWidth(4)
g.rectangle('line', screenWidth/2 - 105, screenHeight/2 - 25, 210, 50)
--content.getPercent() return value 0..1 represent the ratio of the loading progress (1 is all are loaded)
g.rectangle('fill', screenWidth/2 - 100, screenHeight/2 - 20, 200 * content.getPercent(), 40)
end
--call the content to be load
content.load(function () --finish callback, wil be call when all resource are loaded
progress:destroy() --kill the progress bar
--real game start
Saved.new()
Background.new()
director.changeScene('menu')
end)
end