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

creating a board game for players' turn

New Here ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Hi, I'm creating a board game kind of similar snake & ladder using ActionScript3.0 . My concern is when the player 1 lands on the certain box and I want the player wait for the player 2 finished roll a dice 2 times and then the player 1 turn. Can anyone please help. Thanks in advance!

 

here is my script:

 

if (player == 1) {
            step1 = step1 + number; 
            player=2;
            move_txt.text = "Player 1 gets " + String(number);
nextmove_txt.text = " From current space and moves to " + String(step1);
player_txt.text = "Player 2";
turnMC.gotoAndStop(3);
            moveIt1();
 
 
            
        } else if (player == 2) {
            step2 = step2 + number;
            player=3;
            move_txt.text = "Player 2 gets " + String(number);
nextmove_txt.text = " From current space and moves to " + String(step2);
player_txt.text = "Player 3";
turnMC.gotoAndStop(4);
            moveIt2();
 
        } else if (player == 3) {
            step3 = step3 + number;
            player=1;
            move_txt.text = "Player 3 gets " + String(number);
nextmove_txt.text = " From current space and moves to " + String(step3);
player_txt.text = "Player 1";
turnMC.gotoAndStop(2);
            moveIt3();
        }
    }
}
 
 
//PLAYER 1
function moveIt1(): void {
if (step1 == 1) {
player1.x = 35;
player1.y = 550;
} else if (step1 == 2) {
player1.x = 94;
player1.y = 550;
} else if (step1 == 3) {
player1.x = 153;
player1.y = 550;
step1 = step1 + 3;
trace (step1);
moveIt1();
} else if (step1 == 4) {
player1.x = 212;
player1.y = 550;
} else if (step1 == 5) {
player1.x = 270;
player1.y = 550;
step1 = step1 + 17;
trace (step1);
moveIt1();
} else if (step1 == 6) {
player1.x = 329;
player1.y = 550;
} else if (step1 == 7) {
player1.x = 388;
player1.y = 550;
step1 = step1 - 3;
trace (step1);
moveIt1();
} else if (step1 == 8) {
player1.x = 447;
player1.y = 550;
} else if (step1 == 9) {
player1.x = 448;
player1.y = 491;
} else if (step1 == 10) {
player1.x = 448;
player1.y = 432;
}
 
//PLAYER 2
function moveIt2(): void {
if (step2 == 1) {
player2.x = 35;
player2.y = 550;
} else if (step2 == 2) {
player2.x = 94;
player2.y = 550;
} else if (step2 == 3) {
player2.x = 153;
player2.y = 550;
step2 = step2 + 3;
trace (step2);
moveIt2();
} else if (step2 == 4) {
player2.x = 212;
player2.y = 550;
} else if (step2 == 5) {
player2.x = 270;
player2.y = 550;
step2 = step2 + 17;
trace (step2);
moveIt2();
} else if (step2 == 6) {
player2.x = 329;
player2.y = 550;
} else if (step2 == 7) {
player2.x = 388;
player2.y = 550;
step2 = step1 - 3;
trace (step2);
moveIt2();
} else if (step2 == 8) {
player2.x = 447;
player2.y = 550;
} else if (step2 == 9) {
player2.x = 448;
player2.y = 491;
} else if (step2 == 10) {
player2.x = 448;
player2.y = 432;
}
TOPICS
ActionScript , How to

Views

81

Translate

Translate

Report

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
no replies

Have something to add?

Join the conversation