Hey guys. My problem is that, well this code does work. But when I click the main trigger I see the newly rendered lane Sprite, but the problem is, the old button/menu screen is still being rendered! Why is this?
function setup()
Aiming = false
Frame = "Menu"
pinInfo = {}
menuDraw = {
Text = {"text",WIDTH / 2 + 100,680,color(27, 255, 0, 255),"Bowling!!",40};
Rect = {"rect",WIDTH / 2,500,color(70, 255, 0, 255),200,50,4,color(0, 47, 255, 255)};
}
menuTriggers = {
playGame = {WIDTH / 2, WIDTH / 2 + 200};
}
gameDraw = {
Sprite = {"sprite","Project:lane",50,50,50,50};
}
X,Y = 0,0
end
function drawFrame(data)
local frameData
frameData = (data == "Menu" and menuDraw or data == "Game" and gameDraw)
for i,v in pairs(frameData) do
local Type = v[1]
if Type == "text" then
fontSize(v[6])
fill(v[4])
text(v[5],v[2],v[3])
elseif Type == "rect" then
strokeWidth(v[7])
stroke(v[8])
fill(v[4])
rect(v[2],v[3],v[5],v[6])
elseif Type == "sprite" then
sprite(v[2],v[3],v[4],v[5],v[6])
end
end
end
function touched(t)
X = t.x
Y = t.y
end
function draw()
drawFrame(Frame)
if X > menuTriggers.playGame[1] and X < menuTriggers.playGame[2] and Y > 500 and Y < 500 + 50 and Frame == "Menu" then
Frame = "Game"
end
end