dthrasher90 Posted April 24, 2017 Share Posted April 24, 2017 function passPlayLeft() { // var touchBack = true; if (touchBack !== true){ var ct = game.add.sprite(newBallSpotx, 220, 'ct'); ct.scale.setTo(0.03); } else { var ct = game.add.sprite(220, 220, 'ct'); ct.scale.setTo(0.03); } Link to comment Share on other sites More sharing options...
dthrasher90 Posted April 24, 2017 Author Share Posted April 24, 2017 Im trying to write a piece of code for a football game that goes something like this. Where, you check to see if the team has scored and if they have scored on the previous play, you run the kickoff function. Here is where I am having problems. I want to use one function for the pass plays, but I am having trouble updating the ball location. The football is derived from a tween and onComplete the x value is stored in newBallSpotx. Also noted, all the players a derived around the center's location . So like wr1 = ct.x + 150 (or whatever). My question is how can I check the center's value to see if he needs to start a new drive at the 20 yard line or if there is a drive in progress to use the last position logged. And I dont want to use phaser's update function. Any help would be great. Link to comment Share on other sites More sharing options...
Recommended Posts