-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.lua
126 lines (104 loc) · 2.81 KB
/
about.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
-----------------------------------------------------------------------------------------
--
-- about.lua
--
-- The About (credits) screen for the Mars App.
-----------------------------------------------------------------------------------------
-- Get local reference to the game globals
local game = globalGame
-- Corona modules needed
local widget = require( "widget" )
-- Create the act object
local act = game.newAct()
-- File local variables
local clipBox -- clipping container for the credits
local creditsGroup -- display group containing scrolling credits
local creditsText -- multi-line text object for credits
-- The credits string (multi-line)
local creditsString =
[[Mars Explorer is a student project from
the Computer Science department at
Sierra College in Rocklin, California
Programming:
Scott Alesci
Ryan Bains-Jordan
Joe Cracchiolo
Mike Friebel
Cord Lamphere
Elias Mote
Dave Parker
Matt Taurone
Art:
Joe Cracchiolo
Dani Joy Grimes
Sound:
Erik Danielson
Writing:
Cody Spjut
Jennifer Trovato]]
-- Handle press of the back button
local function onBackButton()
game.gotoScene( "menu", { effect = "slideRight", time = 200 } )
end
-- Init the act
function act:init()
-- Background and title bar for the view
act:grayBackground( 0.2 )
act:makeTitleBar( "About", onBackButton )
-- Clipping container for credits to scroll inside
clipBox = display.newContainer( act.group, act.width, act.height - act.dyTitleBar - 2 )
clipBox.x = act.xCenter
clipBox.y = act.yCenter + act.dyTitleBar / 2
-- Credits display group inside the box container
creditsGroup = act:newGroup( clipBox )
-- Game title
local title = display.newText{
parent = creditsGroup,
x = 0,
y = 0,
font = native.systemFontBold,
fontSize = 32,
align = "center",
text = "Mars Explorer",
}
title.anchorY = 0
-- Version number
local version = display.newText{
parent = creditsGroup,
x = 0,
y = 45,
font = native.systemFontBold,
fontSize = 16,
align = "center",
text = "Version 0.2",
}
version.anchorY = 0
-- Credits text
creditsText = display.newText{
parent = creditsGroup,
x = 0,
y = 80,
width = act.width * 0.8,
height = 0, -- auto size
fontSize = 14,
align = "center",
text = creditsString,
}
creditsText.anchorY = 0 -- top center starts at act center
end
-- Prepare the act
function act:prepare()
creditsGroup.y = 0 -- start the beginning of text in the center of the act
end
-- Scroll the text slowly upwards each frame
function act:enterFrame()
-- Scroll credits upward
creditsGroup.y = creditsGroup.y - 1
-- Wrap just off the bottom when it goes just off the top
local yBottom = creditsText.y + creditsText.height
if creditsGroup.y < -(clipBox.height / 2 + yBottom) then
creditsGroup.y = clipBox.height / 2
end
end
-- Corona needs the scene object returned from the act file
return act.scene