boxes n walls n movement etcgit status
This commit is contained in:
parent
9763040c99
commit
2772ec2563
10 changed files with 318 additions and 45 deletions
22
color.lua
22
color.lua
|
|
@ -3,18 +3,22 @@
|
|||
|
||||
Color = class("Color")
|
||||
|
||||
Color.static.list = {
|
||||
red = {r = 255, g = 0, b = 0, a = 255},
|
||||
green = {r = 0, g = 255, b = 0, a = 255},
|
||||
blue = {r = 0, g = 0, b = 255, a = 255}
|
||||
}
|
||||
|
||||
function Color:initialize(inColor)
|
||||
local r, g, b, a
|
||||
if inColor == "red" then
|
||||
r, g, b, a = 255, 0, 0, 255
|
||||
elseif inColor == "green" then
|
||||
r, g, b, a = 0, 255, 0, 255
|
||||
elseif inColor == "blue" then
|
||||
r, g, b, a = 0, 0, 255, 255
|
||||
end
|
||||
self.r, self.g, self.b, self.a = r, g, b, a
|
||||
local c = Color.list[inColor]
|
||||
self.r, self.g, self.b, self.a = c.r, c.g, c.b, c.a
|
||||
end
|
||||
|
||||
function Color:set()
|
||||
return self.r, self.g, self.b, self.a
|
||||
end
|
||||
|
||||
function randomColor()
|
||||
local colors = {"red", "green", "blue"}
|
||||
return colors[math.random(1, 3)]
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue