Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Flash Board Game - If a player's destination space has a player on it already, move one more space.

New Here ,
Mar 12, 2013 Mar 12, 2013

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});

          }

}

TOPICS
ActionScript
304
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 12, 2013 Mar 12, 2013

each space should have a variable that indicates if it is unoccupied or occupied by red or occupied by the other player.

Translate
Community Expert ,
Mar 12, 2013 Mar 12, 2013
LATEST

each space should have a variable that indicates if it is unoccupied or occupied by red or occupied by the other player.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines