Copy link to clipboard
Copied
I have been struggeling with this for sometime and I am totally stuck. In my flash boardgame I am trying to make players unable to land ontop of each other. The code I am currently using compares the current space of Red Player comparing it to where the other player is. What I need to know, is how do I make it compare Red Player's target space to the other player's current space.
function moveRedPiece():void
{
trace("Spin Complete");
for (var i:int = 0; i < numberOfMoves; i++){
currentSpaceRed += 1;
if (redArray[currentSpaceRed].x == p1.x && redArray[currentSpaceRed].y == p1.y && i == numberOfMoves - 1) {
currentSpaceRed +=1;
trace("RED BUMP");
}
else {
trace("not landing on blue");
}
while (currentSpaceRed >= redArray.length) {
currentSpaceRed -= redArray.length;
}
redtargetX = redArray[currentSpaceRed].x;
redtargetY = redArray[currentSpaceRed].y;
plasticUpSound.play();
var redTween:TweenMax = new TweenMax(p2, 1.5, {x:redtargetX+3,y:redtargetY+4,ease:Expo.easeInOut, onComplete:dropMeRed});
}
}
each space should have a variable that indicates if it is unoccupied or occupied by red or occupied by the other player.
Copy link to clipboard
Copied
each space should have a variable that indicates if it is unoccupied or occupied by red or occupied by the other player.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now