I am creating a top down soccer game and the user plays as the ball . There are two players that play as the computers that chase the ball around . But I want them to star off at different places(I did this) and to chase the ball from different sides . When the players go after the ball , they follow each other in the same path . Can someone help me change this ? Thanks
function scene:create(event) local screenGroup = self.view local background = display.newImageRect("terrain.jpg",display.contentWidth,display.contentHeight) background.x = display.contentCenterX background.y = display.contentCenterY screenGroup:insert(background) ball = display.newImage("ball1.png") ball.x = 400 ball.y = 160 ball.myName = "ball" physics.addBody(ball, "dynamic", {density=.1, bounce=0.1, friction=.2, radius=12}) screenGroup:insert(ball) player = display.newImage( "player1.png") player.x = 100 player.y = 300 physics.addBody(player, "static", {density=.1, bounce=0.1, friction=.2, radius=12}) screenGroup:insert(player) playerr = display.newImage( "player2.png") playerr.x = 200 playerr.y = 200 physics.addBody(playerr, "static", {density=.1, bounce=0.1, friction=.2, radius=12}) screenGroup:insert(playerr)
local function movePlayer( event ) transition.to(player, {time=1880, x=ball.x, y=ball.y }) transition.to(playerr, {time=1600, x=ball.x, y=ball.y, onComplete=movePlayer }) end movePlayer()