I want to go into the restart screen when I touch the ball in my app but i don’t know if I need an id can anyone help me ?
local physics = require "physics" local storyboard = require( "storyboard" ) local scene = storyboard.newScene() function SetDefaultAnchor( pos ) display.setDefault("anchorX", pos.x) display.setDefault("anchorY", pos.y) end function CreateWalls(BorderWidth) -- make the math easier local OldAnchor = {x = display.getDefault(anchorX), y = display.getDefault(anchorY) } SetDefaultAnchor({x=0, y=0}) local Height = display.contentHeight -- + (2 \* BorderWidth) local Width = display.contentWidth -- + (2 \* BorderWidth) local leftWall = display.newRect(0, 0, BorderWidth, Height) local rightWall = display.newRect(Width - BorderWidth, 0, BorderWidth, Height) local ceiling = display.newRect(0, 0, Width, BorderWidth) local floor = display.newRect(0, Height-BorderWidth, Width, BorderWidth) physics.addBody (leftWall, "static", {bounce = 0.1, friction = 2}) physics.addBody (rightWall, "static", {bounce = 0.1, friction = 2}) physics.addBody (ceiling, "static", {bounce = 0.1, friction = 2}) physics.addBody (floor, "static", {bounce = 0.1, friction = 2}) -- restore previous defaults SetDefaultAnchor(OldAnchor) end physics.start() -- let's make stuff yellow display.setDefault("fillColor", 0, 1, 0) CreateWalls(1) -- create image of a ball Ball = display.newCircle(100, 100, 10) -- define physics object attached to image of ball physics.addBody(Ball, "dynamic", {friction=3}) -- give ball a shove Ball:applyLinearImpulse(-.09, .08, 0, 0) function onBallTouch( event ) if event.phase == "began" then storyboard.gotoScene("restart", "fade", 500) end end return scene