forked from MarkHenryC/Stroople
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.lua
119 lines (94 loc) · 2.27 KB
/
info.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
-- Mark H Carolan
--
-- Stroople project
-- © 2010 Mark H Carolan, Gregory S Hooper
module(..., package.seeall)
require "globals"
--
-- Set from main via init() only once
--
local returnFunction
local background
local images
local homeButton
local modulator = 4
local modCounter = 0
local transCounter = 0
local transDirection = 0.04
local startArrow
local function enterFrame(event)
images[2].alpha = transCounter
-- images.logo.xScale = 0.5 + transCounter
-- images.logo.yScale = 0.5 + transCounter
transCounter = transCounter + transDirection
if transCounter > 1.0 then
transCounter = 1.0
transDirection = -0.04
elseif transCounter < 0.5 then
transCounter = 0.5
transDirection = 0.04
end
-- if images.arrow.y < startArrow-6 then
-- images.arrow.y = startArrow
-- elseif modCounter % modulator == 0 then
-- images.arrow.y = images.arrow.y-1
-- end
modCounter = modCounter + 1
end
local function onMainMenu(event, param)
Runtime:removeEventListener("enterFrame", enterFrame)
background:removeSelf()
background = nil
images:removeSelf()
images = nil
homeButton:removeSelf()
homeButton = nil
returnFunction()
end
local function brainImage()
if not images then images = display.newGroup() end
local brain = display.newImage("brain.png")
local brainH = display.newImage("brainH.png")
images:insert(brain)
images:insert(brainH)
local arrow = display.newImage("yellow_arrow_small.png")
arrow.x = globals.W2 + globals.W16
arrow.y = globals.H24*9
arrow.rotation = -90
arrow.xScale = 0.5
arrow.yScale = 0.5
startArrow = arrow.y
local logo = display.newImage("entryLogo.png")
logo.x = globals.W2 + globals.W16
logo.y = globals.H24*15
images.logo = logo
images:insert(arrow)
images.arrow = arrow
images:insert(logo)
images.x = globals.W16*2
transCounter = 0
transDirection = 0.01
Runtime:addEventListener("enterFrame", enterFrame)
end
--
-- These functions accessible from outside:
--
function showInfo()
if not background then
background = display.newImage("background.png")
end
if not homeButton then
homeButton = ui.newButton
{
default = "home.png",
over = "homeH.png",
onRelease = onMainMenu,
x = globals.W2,
y = display.contentHeight - 30
}
end
brainImage()
end
function init(returnFunc)
returnFunction = returnFunc
end