I am trying to click a rectangle and have it go to a new scene, when I click I get the error main.lua:22: attempt to index global ‘composer’ (a nil value) stack traceback: main.lua:22: in function <main.lua:21>?: in function <?:221>
my code is: local function tappedRect(event)
composer.gotoScene(“levels”)
end
local playrect = display.newRect(320,400,400,100)
playrect:setFillColor(255,255,0)
playrect.strokeWidth = 8
local playtext = display.newText(“PLAY!”,320,400, “Consolas”, 95)
playtext:setFillColor(0,0,0)
local instructionsrect = display.newRect(320,800,400,100)
instructionsrect:setFillColor(255,255,0)
instructionsrect.strokeWidth = 8
local howtoplaytext = display.newText(“HOW TO PLAY”,320,800, “Consolas”, 60)
howtoplaytext:setFillColor(0,0,0)
playrect:addEventListener (“tap”, tappedRect)
if anybody knows what i could do with my code to make it go to a new scene that would be very helpful thanks!!