PDA

View Full Version : Board game in flash



gdz1982
January 29th, 2009, 05:58 AM
newbie here.

im currently experimenting with a board game made in flash.

depends on the score dice the pawns will move by certain number of frames , also its two player game so i dont know what exactly code i need to put there. ouch i suck at explaining. o.o''

senthilmani
January 29th, 2009, 08:37 AM
two player game in the sense its multiplayer(two or more) game right... i think you should think about flash servers... something like a smartfoxserver...

[/URL][url]http://www.smartfoxserver.com (http://www.smartfox)

gdz1982
January 29th, 2009, 11:04 AM
oh what a nifty site, i am thankful for it however it is not a concern for me, right now i prefer to think about game i'd play on one computer with a friend so please let's get back to main topic

how to make pawns go depending on the dice score?

rrh
January 29th, 2009, 11:53 AM
Math.floor(Math.random()*6)+1
Random 1 to 6

If, like you said, you make each possible position its own frame, then you use gotoAndStop to set the position. If your board is going to always be completely straight and even like that, you could just set the _x value to position*spacing+offset

If you want to animate the position, you could do it with a setInterval (timer is AS3) and an array of positions to move to. Pop off one position per interval, set the pieces position, once the array is empty, clearInterval and allow the other player to move.

gdz1982
January 29th, 2009, 03:58 PM
ActionScript Code:

Math.floor(Math.random()*6)+1





uh oh... , what this exactly does and where shall i paste it? /rookie mode

rrh
January 29th, 2009, 04:06 PM
What it does is generate a random number from 1 to 6.

So you take that, combine it with:

currentframe
gotoAndStop

peartart
January 30th, 2009, 12:06 AM
I've actually made a board game in flash before, I've attached it if you want to look at it and get some ideas for code.