There’s a bug that I can’t figure out where in the Ballon:resert() function, on the if col == BLUE then line it says that there is an un-expected symbol near if when the function is called. When the ballons are created it selects a random color which is the parameter colour (how the english spell color). Any guesses?
EDIT: The color system worked fine before I implemented the colors in the reset function.
Ballon = class()
RED = 0
BLUE = 1
YELLOW = 2
FIRST = RED
LAST = YELLOW
function Ballon:init(x,colour)
colour = self.col
if self.col == RED then
self.ballonColor = vec4(198, 53, 25, 123)
self.ballonSpeed = 10
elseif self.col == BLUE then
self.ballonColor = vec4(43, 33, 223, 123)
self.ballonSpeed = 2
elseif self.col == YELLOW then
self.ballonColor = vec4(202, 223, 33, 123)
self.ballonSpeed = 5
end
self.ballonX = x
self.ballonY = 10
self.ballonHeight = 150
self.ballonWidth = 100
end
function Ballon:reset()
if self.col == RED then
ballonSpeed = 8
elseif
if self.col == BLUE then
ballonSpeed = 8
elseif
if self.col == YELLOW then
ballonSpeed = 5
elseif
print("Ballon does'nt have a color")
ballonSpeed = 0
end
self.ballonX = math.random(200, WIDTH - 50)
end