ActionScript 3.0 :: Turn Base Board Game - While Loop

Mar 15, 2009

I am trying to create a turn base board game. It has four player and out the the four players one is human and the rest are cpu's. The players are number 1,2..4. In the beginning of the game it ask's the user to which player will be the human player. A random number generator function picks a random number between 1-4 and that number player will go first.

There is a while loop that controls the game play something like:
var isNotEndofGame:Boolean = true;
var human:Number; //the user inputs this number.
var aPlayer:Number = getRandomNumber(1,4); //players: 1, 2, 3, 4
while(isNotEndofGame) {
if(aPlayer==human) doHumanMove();
else doCpuMove();

This reset's the player so they can keep on playing until game ends.
if(aPlayer==4) aPlayer = 1;
}
inside function doCpuMove() and doHumanMove() isNotEndofGame will become false when the game objective is met.

The problem I am having is when its the human players turn I want the loop to pause or wait so that the human player can do some interaction such as click a button or drag a movieClip. I tried adding adding mouseclick event listeners and timer neither worked.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: A Board Game - Get Classes To Putting Together A Board Game?

Mar 22, 2010

where to get classes to putting together a board game, free of course.I do not want to use them actually but get the idea of how mine would incorporate into the classes.I have a board game where I want each square on the board to know if it is occupied or not, to change its color, and to keep track of what is actually happening with it.

View 2 Replies

Game Engine :: Flash Multiplayer Turn By Turn?

Oct 7, 2011

I'll start off by saying I'm a newbie, just putting that out there. How do you make a turn by turn multiplayer flash game? I don't know if an engine is made in AS3, PHP, Javascript, or whatever,I made my game already, it's just that it isn'tmultiplayer yet. Basically, there are lines, and each player crosses out a number of lines, and the last player to cross out a line is the loser. I want it where one user crosses out some lines, then presses End Turn, then the other does their turn and then presses End Turn to allow the other player to move his cursor. But how can I get both players to see the same frame and only have one player have the ability to move the cursor during a turn? Is there some easily adaptable multiplayer engine for flash for newbies out there

View 2 Replies

ActionScript 3.0 :: Score Board For A Game Show?

Jun 7, 2011

I need to create a score board for a game show at work for staff. The score board must keep score on the left and right parts of the screen. score must start as default on 0. Then every time I press for example the left arrow key the left score must increase by the value of 1 and when I press the right arrow key the left score must decrease by 1.Same goes for the right score only with differant keys example up and down keys. This sounds very simple and I managed to get it to work when I tested with only 1 score, but failed when adding the second score to the picture.

View 5 Replies

ActionScript 1/2 :: Flash Game High Scores Board

Sep 29, 2010

I know this is a subject that gets covered a lot as i have found a ton of tutorials that show a million different ways to create a high scores board on a flash game. So I decided to go out on a limb and pick a tutorial out to try. Well I have now tried 3 different ones and have yet to get a working high scores board with my game. [URL]

That is the link to the most recent attempts to creat my high scores board. When I finished everything the way the tutorial said it seemed like everything would work and then it just didnt. After spending oh about 40 plus hours trying to make a high scores board I am getting very frustrated. My game is scripted in AS2 and I have access to mysql and can set up unlimited databases.

View 7 Replies

ActionScript 3.0 :: Score Board For BlackJack Game Points?

Oct 25, 2011

I am creating a blackjack game and almost have it all figured out besides the scoreboard. When I win the game it adds the 25 points and when I loose it subtracts the 25 points from the starting score = 200. The problem is that if you win multiple times in a row or lose multiple times in a row the score doesn't keep adding up. It only adds or subtracts the score once. I tried using a boolean code but can't get it to work right. Now I am using this set up.

[Code]...

View 4 Replies

ActionScript 3.0 :: Proper Way To Instanciate Multiple Sprites (board Game)

Dec 2, 2009

when creating a tile style gameboard in flash before i did the following:[code]when i wanted to delete tile-instances, i could reference them like [code]

View 7 Replies

Javascript :: Language To Choose For A Board Game (flash Or HTML5)?

Dec 7, 2010

I am developing a web based multi-player board game and wondering what the best language for the UI would be? Its a board game similar to Go but a lot simpler.I have two options flash or the much touted HTML5 with JS. I have to learn both though I have basic knowledge of JS.The problem with flash is I have to pay for the server component but the UI development could be easier and have a richer look and feel to it. With HTML5 + JS there is no cost involved but the UI development I feel will be clunky and not smooth. This I am not sure.

View 6 Replies

Actionscript 3 :: OOP - Make An Object Move Across A Game Board Depending On The Value Of The Dice?

Dec 8, 2011

I am creating a board game and I am using Object Oriented Programming with AS3. I created a movie clip with a circle that moves across the game board. There are 18 squares and 18 frames. I have a button that gives you a value with a dice with the random number function:

public function rollDie():void
{_dieValue = Math.ceil(Math.random()*6)
this.gotoAndStop(_dieValue);}

I have a class for the dice button, die, gameboard, and the main board. I am trying to make the circle move across the board(or go to the frame in the mc) depending on what the value I get with the dice. Here is my code so far:

[Code]....

The mc instance for the gameboard is gameBoard. Also, if anyone knows how to trigger a labeled frame depending on which square the circle lands on that would be a plus.

View 2 Replies

ActionScript 2.0 :: Make A Loop Sound Board?

Sep 16, 2010

I have spent the last four hours trying to work this out, using a number of different tutorials and always running into roadblocks in one form or another.

I'm using Flash CS3 with Action Script 2.0 enabled.

Essentially, I want to be able to make individual buttons to play in one frame on the main timeline that turn on and off simple loops that I've made.

I have a video of a man dancing, and I want to give the user the ability to press nine buttons and activate each loop to play over the video.

- I need each loop to be able to layer - so, each button controls only it's own loop - giving the user the ability to compose the music that the dancer is moving to.

The way I though I would do this would be to make a single button for each loop, that when clicked played the loop, and then when clicked again muted that single loop, and then when clicked, played it again and so forth.

- I have the nine loops cut up and in the library, but I don't know how to program this.

Additionally, I would really prefer the loops to not be playing, and for the user to have the chance to build the piece of music around the dancer.

View 0 Replies

ActionScript 3 :: Bubble Game Base Class - Sound Playing Too Late

Feb 12, 2012

Any examples of ActionScript 3.0 code that deploys any kind of sound files to be used in Flash Pro files, for final output as SWF. I am using the code (below) for the Base class of a Bubble Game (of sorts), and the problem is, that when popped, the sound plays a little too late, not spot on.

This is my code - which is linked to the Bubbles in the library of my FLA:
package {
import flash.display.*;
import flash.events.*;
import flash.media.Sound;
import flash.net.URLRequest;
public class BubbleBaseNew4 extends MovieClip {
[Code] .....

View 1 Replies

ActionScript 1/2 :: Turn Flash Game Into IPhone App?

Dec 22, 2010

I made a flash game some time ago (ActionScript 2), and I was wondering what steps would I have to take to make it into an app?

View 3 Replies

Flash :: Turn Based Strategy Game Techniques?

Feb 12, 2010

I want to make a turn base strategy game. I was just curious if anyone had any sources or books that explains the concept and architect of designing a turn based strategy game or any turn based game.

View 2 Replies

Professional :: Create A "Family Fortunes" Game Board?

Sep 29, 2010

I'm trying to create a "Family Fortunes" game board, so I have got the basics, the answers can be revealed with a click, but I can't seem to attach sound to the buttons as they disappear. The code snippet tool doesn't seem to be working, the code goes into the action keyframe, but the sound won't link up.

View 2 Replies

ActionScript 2.0 :: Movie Clip Names For Each Loop - Turn The S[z] Into Something Like S1 - S2 Or S3 ?

Jul 6, 2003

okay here's my code

Code:
onClipEvent (enterFrame) {
for (z; z<4; z++) {[code]....

how do you turn the s[z] into something like s1 - s2 or s3 ? i just want different movie clip names for each loop..

View 2 Replies

Actionscript 3 :: Convert From Base 60 To Base 10?

Jul 29, 2010

I have a method that converts an int to a base60 string (using 0-9, a-z, and A-Z chars), but can't work out how to convert it back again. Here is my method for converting base10 to base60:

public static function toBase60(value:Number):String
{
var targetBase:uint = 60;

[Code]....

Works well. But how do I get the base60 string back into a base10 int?

View 4 Replies

ActionScript 2.0 :: Convert From Base 10 To 16 And Then Base 16 To 36.?

May 17, 2007

Its been a while since i touched flash, which is funny considering i started my web/development career here.Anyway, in PHP there is a nice little function called base_convert (http:url....) which will take any number in any base (e.g. base 10, decimal) and convert it to any base (e.g. base 16, hex).So base_convert (15, 10, 16) will output F, which is convenient.I am wondering, as i cannot seem to find, if there is any similar function in actionscript. I am trying to convert from base 10 to 16 and then base 16 to 36.

View 3 Replies

ActionScript 2.0 :: Turn Into A "for" Loop?

Jul 15, 2010

How could I turn this into a usable "for" loop? I don't know quite how they work. I feel like I could optimize a lot of my code using for loops.

Here's my example:

ActionScript Code:
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success)

[Code]...

View 2 Replies

Actionscript 3 :: Set Up A Run / Game Loop In Flash?

Feb 24, 2010

Currently, I have all my variable initialization and function definitions in the timeline's first frame, my logic in the second frame, and a command to 'go to the second frame' in the third frame.

View 1 Replies

ActionScript :: Game Loop Not Running?

Feb 19, 2012

I'm developing a Flash game using ActionScript 3 and have this code in my documents class:

package com {
import flash.display.MovieClip;
import flash.display.Stage;
public function Engine() {
// Create a player instance

[Code]...

Is there a library or something I need to import to get this to work? If it's not obvious, I want to run the gameLoop method of my Engine class (the documents class) on every new frame (the document is currently set to 30fps).

View 1 Replies

ActionScript 3.0 :: Game Loop - Rounding Causes Inaccuracy

Apr 26, 2010

For my game, I've made an easy-to-use instruction list to program enemies. It works pretty well, except it's inaccurate, and the only reason I can think of is a rounding error.

Here's how my instruction list works:
list[0] = "Right:60";
list[1] = "Left:60";

The game loop calls a function on the object that decides what action to do. Right:60 means it moves right for 60 game loops, then goes to the next item on the list. This works fine, except for the inaccuracy. An object gets his xSpeed altered every game loop, depending on the current instruction. If it's "Right", xSpeed += acceleration, if it's "Left", xSpeed -= acceleration.

The game loop itself multiplies the xSpeed by a friction variable, which is 0.7 (may be changed later, currently this works best). Now what happens is, the object bounces back and forth just fine. But it after so many times it keeps going a couple of pixels further to the left than to the right. Eventually, the object falls off the screen on the left, while the instruction says it should do 60 game loops of "Left" and 60 loops of "Right".

View 1 Replies

ActionScript 3 :: Refactoring Automatic Game Loop Into Controlled One

Aug 5, 2010

I need to take control of how my base game class updates:
package {
import flash.display.Sprite;
import flash.events.KeyboardEvent;
public class Test extends Sprite {
private var sprite:Sprite;
[Code] .....

Here after every key press/release AS3 takes care of automatically drawing a sprite onto screen, but I need to do this manualy. Haw to get my hands on updating mechanism here? I need something like this - all time repeating game loop that is set to be updated/redrawn every time at its end.

View 2 Replies

Actionscript 3 :: Write Code For Flash Game Loop?

May 28, 2011

Im making a transition from Java to Flash/Actionscript and Im having sort of a hard time figuring out where to write my code for my flash game loop(or engine) due to flash having "frames" unlike Java.Am I able to put the loop inside the Document class even having like game menus in the game? I havent found a way to put it in there without it always running when the flash application begins.Or should I just have the game loop called every frame? For instance, frame 4 will be level 1 and so the engine will be called out there. And frame 5 will be level 2 and ill call a different instance of the game engine there.Im just having a difficult time due to the "frames". So where would be the best place to put the game loop?

View 4 Replies

Haxe/Flash Game Loop Slow Down Over Time?

Mar 29, 2012

I have a game loop written in Haxe/Flash. For some reason it slows down over time. At first it runs reasonably, but my laptop fan starts spinning up and it gets slower and slower. Why would this happen?

import flash.display.StageDisplayState;
import flash.display.StageScaleMode;
import flash.display.MovieClip;

[code].....

View 1 Replies

ActionScript 3.0 :: Game Loop - Detecting When Object Hits MovieClip

Jul 17, 2010

I'm trying to program this code:
public function enemiesDie(){
enemyLoop: for (var k:int = enemies.length -1;k>= 0; k--){
bulletLoop: for (var i:int = bullets.length -1; i>=0; i--){
if (enemies[k].hitTestObject(bullets[i])){
trace("hit");
[Code] ....

To detect when a bullet hits an enemy in a game I'm trying to make and I get this error:
TypeError: Error #1006: hitTestObject is not a function.
at Space_Hooligans/enemiesDie()
at Space_Hooligans/gameLoop()

View 2 Replies

ActionScript 3.0 :: Make A Simple Game Loop Using Delta Time?

Jan 14, 2012

I have looked everywhere for an example or tutorial on a delta time game loop in AS3. I found many fixed time step examples but very little helpful information on delta time game loops and how it works. I have seen examples that do the calculations in a timer and also seen examples that do the calculations inside the enter_frame event. All the examples I have seen are also incomplete and only provided me with bits and pieces.

View 3 Replies

ActionScript 2.0 :: Use LoadMovie Function Inside Loop To Load External PNG Files / When Game Is Loaded

Jan 19, 2009

I'm trying to use a loadMovie function inside a loop to load external PNG files when my game is loaded. Unfortunately, I can't get even a single loadMovie to work correctly, much less execute a bunch of them.The code is on the root time line, and is targetting an empty movie clip that is nested inside about 3 levels. There is a button, with a movie clip on it, and the empty clip I'm trying to load into on that.so the full target path is myBox_00.smallBox.myLogo(myBox_00 is the button, smallBox is the movie clip, and myLogo is the empty)[code].I even tried using a JPG image instead of a PNG and still no luck. The best I could do was number 4; and that didn't work, all it did was SOMETHING instead of NOTHING... unfortunately that something was to make the button (myBox_00) disappear entirely T_T.I've never had much luck with loading external images. What am I missing here?

View 9 Replies

Actionscript 3 - "game" Loop In Flash Virtual Pond?

Jul 5, 2011

i am having trouble on designing the "game" loop in my flash as3 virtual pond currently i have the following enter_frame loop. in my "pond" parent container, there will be arbitrary amount of "fish" objects and "food pellet" objects. currently in my loop function when two or more food is placed in near distance of the fish , the fish will not move does anyone know why this happens? the below code is in my "Fish" class, updatePosition() merely tells the fish to swim around like a fish.

public function loop(e:Event):void
{
//getDistance(this.x - i.x, this.y - i.y)

[code]....

View 1 Replies

Message Board Creation Using Flash CS3

Aug 29, 2009

I am building an ambitious site especially for someone new to the Flash.I want to create a fully functional Flash Forum.Only problem is I have not found 1 site with information on how to build one and the only thing I did find was something called the Flash Forum Engine. It is a 3rd party software suite that allows you to build a Flash Forum BUT! it costs 1000 Euro's or $2000.

View 4 Replies

Professional :: Animating A Breaking Board?

Feb 5, 2011

I am working on a project where I need to show a wooden board and have the user pick a place on the board and somewhat realistically (at least believable) simulate the board breaking and shattering at that point. The final product will need to run on a mobile platform so performance is an issue.I have already experimented a bit and have a movie clip board which is composed of predetermined pieces and I used a tween to move the pieces apart. The main problem is that the way the board breaks and where it breaks are predetermined

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved