I am creating a game with a ball and a player and when the ball touches the player , the restart.lua scene shows up . But when the ball touches the player nothing happens . Can someone help me with this ?
game.lua :
ball = display.newImage("ball1.png") ball.x = 400 ball.y = 160 ball.myName = "ball" player = display.newImage("player.png") player.x = 100 player.y = 300 player.myName = "player" local function loopObject() local objectDown= function() transition.to(player, { time=600, y=20, onComplete=loopObject }) end transition.to(player, { time=600, y=300, onComplete=objectDown }) end loopObject() local options = { effect = "fade", time = 400 } local function onGlobalCollision( event ) if ( event.phase == "began" ) then print( "began: " .. event.object1.myName .. " and " .. event.object2.myName ) elseif ( event.phase == "ended" ) then print( "ended: " .. event.object1.myName .. " and " .. event.object2.myName ) end end