2 This script is the main script. It requires the code.lua file,
3 which is where one really wants to do work.
7 done
= false --used for the main game loop
8 ticks
= 0 --clock ticks (frames since start of level)
12 instr_log("cursor off", "input")
14 --initialize the event manager
15 -- set up ESC key exit default
16 evman
= EventManager
:new()
17 evman
.keyboard
.pressed
[Keys
.ESCAPE
] = function() done
= true end
18 evman
.quit
= function() done
= true end
19 instr_log("created evman", "input", "gameplay")
22 require("scripts/code")
23 instr_log("included real code", "gameplay")
26 fps
= FPSManager
:new()
27 fps
:set_fps(target_fps
)
28 instr_log("set fps","gameplay","video")
30 --random number generator stuff
31 -- reseeds the random number generator periodically
35 if c
== target_fps
*100 then
37 math
.randomseed(os
.time())
45 titlescreen
= get_image("images/title.png")
46 instr_log("+title screen", "event")
48 instr_log("random classless event")
52 blit(titlescreen
,0,0,0,1,1)
54 if title
== false then
63 --delay to maintain proper fps
66 instr_log("-title screen", "event")
68 instr_log("+main loop", "event", "gameplay")
91 --delay to maintain proper fps
95 instr_log("-main loop", "event", "gameplay")
97 instr_print_log("event")
98 instr_print_log("gameplay")
99 instr_print_log("input")
100 instr_print_log("input","gameplay")