-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgeneric.lua
More file actions
44 lines (33 loc) · 887 Bytes
/
generic.lua
File metadata and controls
44 lines (33 loc) · 887 Bytes
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
-- Mark H Carolan
--
-- Stroople project
-- © 2010 Mark H Carolan, Gregory S Hooper
module(..., package.seeall)
require "globals"
require "word"
function newWordGroup(params)
local wordGroup = display.newGroup()
if not params.colorNames then
error("Must supply colorName table")
end
wordGroup.colorNames = params.colorNames
wordGroup.fontName = params.fontName
wordGroup.textHeight = params.textHeight or 32
wordGroup.wordCount = params.wordCount or 4
function wordGroup:init()
for i = 1, self.wordCount do
local r = word.newWord("system", self.fontName, self.textHeight, self.colorNames)
r.isVisible = false
self:insert(r)
end
for i = 1, self.numChildren do
self[i]:setRandomColor(#self.colorNames)
end
end
function wordGroup:cleanup()
for i = self.numChildren, 1, -1 do
self[i]:removeSelf()
end
end
return wordGroup
end