-
Dice Game: Can you move the player
Using Actionscript 3, How does a player move based on dice result?
I'm developing a game that is based on the popular snake and ladder game as my undergraduate project. It has 36 tiles. Thus far, I'm able to roll the dice but needs the player to move with dice result. I appreciate help. Here is code:
Code:
package{
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class peaconty extends MovieClip{
//variables
public var rollBtn;
public var dieMov;
public var boardMov;
public var textResult;
public function peaconty() :void{
rollBtn.addEventListener(MouseEvent.CLICK, rollRandomNumber);
dieMov.gotoAndStop(Math.ceil(Math.random() * 6));
boardMov.gotoAndStop(Math.ceil(Math.random() * 6));
}
function rollRandomNumber(Event:MouseEvent) :void{
//trace(randNumb);
var randNumb:uint = Math.ceil(Math.random() * 6);
textResult.text = "You rolled "+randNumb;
dieMov.gotoAndStop(randNumb);
boardMov.gotoAndStop((currentFrame) +(randNumb));
}
}
}
-
.
Hi,
You need to have the grid set up for referencing the locations to move toward/from ( the base basically).
Have a look at this and rip the bones out of it, you might need to do some simply as2 > as3 conversion though, I'm sure it will help, I personally don't have the time and it is after all YOUR undergraduate project
http://www.flashkit.com/movies/Games...0889/index.php
-
Thanks for this. So many fruits on the bread. It will prove helpful. Now I must learn AS2 and AS3. LOL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|