-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
126 lines (99 loc) · 3.38 KB
/
main.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
117
118
119
120
121
122
123
124
125
126
--project: NerfAppTimerProject
--Adam Starbuck, Ryan Podany 2014
globals = require( "globals" ) -- make this global
coronium = require( "mod_coronium" ) -- make this global
composer = require("composer") -- make this global
widget = require ( "widget" ) -- make this global
ads = require ( "ads" ) -- make this global
display.setDefault( "background", 40/255, 66/255, 99/255, 1 )
display.setStatusBar( display.HiddenStatusBar )
-- widget.setTheme( "widget_theme_android_holo_dark" )
--== Init Coronium
coronium:init({ appId = globals.appId, apiKey = globals.apiKey })
--== Store in globals module
globals.coronium = coronium
--== Start composer
display.setStatusBar( display.HiddenStatusBar )
coronium:appOpened() --analytics
--global variables for logging in and things
--these variables are to store data based on user input and the input functions at the bottom of the scene:create function
email = "default"
username = "default"
font1 = 34
font2 = 48
font3 = 60
font4 = 70
font5 = 80
-------------------------------
-----enable back button-----
-------------------------------
function getObjectGlobal()
coronium:getObject( "testGameData", objId, function(e)
if not e.error then
gameTypeText = tostring(e.result.gameType)
teamNumText = tostring(e.result.numberTeams)
capNumText = tostring(e.result.numberCapts)
gameLengthText = tostring(e.result.gameLength)
TTSText = tostring(e.result.timeToStart)
isGameEnded = tostring(e.result.gameEnded)
adminPinText = tostring(e.result.adminPin)
end
end)
end
--a few global variables to store the input text in
gameTypeText = "default variable"
teamNumText = "2"
capNumText = "1"
gameLengthText = "30"
TTSText = "2130" -- the military time that the game starts
isGameEnded = "no" --clever, I know
--very important... object ID for the database thing
objId = "244c9c8f3a"
--retrieve the above variables and set them if they exist
--coronium:getObject( "testGameData", "ObjectID", function(e)
-- print(e.result.objectId)
-- end)
--dynamic fonts. you're welcome.
if display.contentWidth < 720 and display.contentHeight < 1080 then
font1 = font1-(font1*0.1)
font2 = font2-(font2*0.1)
font3 = font3-(font3*0.1)
font4 = font4-(font4*0.1)
font5 = font5-(font5*0.1)
end
function helpFunction()
composer:gotoScene("help")
--coronium:addEvent( "helpEvent", "Help! " .. username)
end
help = widget.newButton --another global value that we can edit the alpha of
{
id = "helpMe",
label = "?",
fontSize = 60,
onRelease = helpFunction,
shape="circle",
height = 1,
labelColor = { default={ 1, 1, 1}, over={ 232/255, 100/255, 37/255, 1 } },
fillColor = { default={ 232/255, 100/255, 37/255, 1}, over={ 1, 1, 1, .5 } },
radius = 40,
emboss = true
}
help.x = display.contentWidth-10
help.y = 10
help.anchorX = 1
help.anchorY = 0
help.alpha = 0
--splash screen, then menu
nerfImage = display.newImage( "pics/NERF_transparent.png") -- I changed the alpha to go to only .2 instead of 0 so it stays there all the time. you can edit the alpha using "nerfImage.alpha" at any point because it is a global value now
nerfImage.x = display.contentCenterX
nerfImage.y = display.contentCenterY
local function fadeout()
local options =
{
effect = "fade",
time = 1000,
}
composer.gotoScene("menu", options)
end
timer.performWithDelay( 3000, transition.to( nerfImage, {time = 1000, alpha = .2, y = 200}) )
timer.performWithDelay( 1000, fadeout)