Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Help With Flash Game


hi,

i need to know the actionscript to make a movie clip rotate in the same spot. my movie clip's instance is sky. i wanna know how would i make it rotate on keypress <left>

thanx in advance......I really need to know how to make it rotate in one spot




FlashKit > Flash Help > Flash ActionScript
Posted on: 11-28-2001, 09:23 PM


View Complete Forum Thread with Replies

Sponsored Links:

Was This Game Made From Flash ? (Zadarider) Download The Game
Was this game made using flash 8 because it seems to run very well even when i have made up to 10000 lines.

View Replies !    View Related
Flash Game Help The Game Runs Too Slow In A Browser
lo there!
I'am so frustrated!

I have made a plattformgame in flash, and after I had published it I tested it (local) when it was embedded in a browser, and it hacks and laggs! But when I play it in the flash player it works just fine.
What should I do?

I removed all the heavy graphics, lowerd the fps to 30fps and removed all the code so now its just the bassis left (gravity, collision, key checking etc. and yes u should bounce on the walls giving a wall jump effect).

Anyone please! I am in big need of help!
Is it my code? Did I publish it wrong?

here are the links:

http://smh03.lbs.se/smh03niklas/prof...ofilbollen.swf
http://smh03.lbs.se/smh03niklas/prof...ofilbollen.fla
http://smh03.lbs.se/smh03niklas/prof...filbollen.html


//Qui

View Replies !    View Related
[F8] Game Studio Needs Flash Game Programmer
Hi -

I've been working on cartoon Flash interfaces for awhile. Now my clients want games, so I'm looking for one or two Flash game actionscripters who can help out and maybe start a studio. Since it's a startup, I'm looking for someone who's good, but not yet making millions - hoping we can do that ourselves eventually. Someone dependable, easy-going and easy to get along with. Would be great to find someone relatively local, but not absolutely necessary.

We'll be creating custom Flash games for an existing client.

Hoping to check out people's games first.

J.

View Replies !    View Related
Needs EXPERT Help: 1. Save Game For Replay, 2. Reset Game
I'm rather new to Action Script, but doing not bad. I have searched the Board, found a link to a tutorial on ActionScript[Org], titled: "save a local copy of file". But that was yet not clear enough for me.

2 Questions at the moment (files attached):

1. Save Game for Replay: How can I save the set to a file in the Same Folder so it could reload for further play from that point on?

2. Reset Game: How can I Reset the Game for a NEW Attemp? I need to remove all Actors at once, to start a new game, without closing this SWF and reopenning it.

If you'd be so kind as to explain very clearly, and add Action Script, taking into consideration that I still get confused by trying to deal with Arrays and so. I promise to study your lesson carefully - this GameTest attached is the fruit of this week studies.

THANKS A LOT
Nit Kalish

View Replies !    View Related
How To Disply Time In Game And How To Stop After The Game..
Hi all,

i need help on drag and drop game...

i have done the drag and drop function, for this game timer has to be shown, after user finishes the drag & match, it should give finish alert and time taken for this game (please tell me also how to stop time after he finish the game) is to be sent to some external file or some database...

can it be done?
i have attached the .fla file also..

View Replies !    View Related
[F8] How Can I Make A Game With Levels And A Game That Restarts?
I know this sounds stupid, but I just can't figure it out. I need to make a platform game. I'm fine with making a points system and a scrolling background and it functions but I don't know how to get the player to touch an object, or reach a goal and then transport to another level...I don't want to make the user have to click something to go to a new level.

Also, when the character hits an enemy, I can make it die, but I don't know how to make a button or something appear saying 'Game Over - Try again', so they can pretty much restart the level.

Hopefully someone can help me.
Regards,
Andrea

View Replies !    View Related
Help With A Game.. Game Is Running Slow In Browser..
I am working on this game for work and for now all i have is placeholder art for the most part and nothing very heavy on the graphics end yet my game is running very slow.. i bumped the FPS to 60 since at 30 i was getting image tearing or a double vision effect.. the upped FPS fixed that but the game is still running very slow. To give you an idea of what's going on i have different intervals running so different things can happen at different times.. there are 2 constant onEnterframes for the 2 enemies flying around the screen.. there is 1 for the main loop, 1 for the character, 1 for whenever tickets generate which removes itself and deletes the enterframe when they disappear, 1 for the wrecks that occur on level 2 which also remove themselves and delete enterframes for themselves, and 1 for a holder that handles all the money flying in which removes themselves as they collide with the player or leave the screen. All enterframes that run during gameplay delete themselves at the end of each level and re-initialize at the beginning of the next.

I can't figure it out.. please take a look at the fla and html files attached. Could it be just the sheer size of the game screen.. should i make it about half the size?? I appreciate any help and thank you.

Also the game's scripted animations seem to be running a little choppy if you watch their movement closely like there is a little glitchy jump every second or so.. is this fixable?

View Replies !    View Related
AS Help Needed In Game(i Will Give Credit In Game If You Help)
ok so basicly this is my game so far
23.swf

my probelm is that i want to make my charcter a flame and the tips of his head will move depending on the direction you are going.
So here is basicly this what its like

Moving left-Flames bend to right
Moving left and down-Flames bend at an angle between the left and down
Moving Down-Shorter Flames
Moving Up-Stretched Flames
etc...

ill put borders on after i get the flames down

View Replies !    View Related
Flash Media Server Can Use For Multiplayer Online Game With Flash
Dear all,
Hi I'm newbie.I'm so confuse about to develop the MMORPG game in flash.
Is it really can do with Media Server and Flash only?I have to develop multiplayer online game like as each player can move their avatar by using arrow keys.Is it really can be?
ႈWhen I just googelling, I saw most of the forum said MMORPG for xml socket server, but I can't find any tutorial with Media server.

So can anyone help me to point the examples, or Links?Now I'm in dark with that problem.pls help me

Thanks and Regards,
Vennasa

View Replies !    View Related
How To Convert Flash Game To Flash Lite Mobile Games?
Hi

can anyone tell me how to convert flash game to flash lite mobile game and hot to test it its working or not??

View Replies !    View Related
Flash Media Server Can Use For Multiplayer Online Game With Flash?
Dear all,
Hi I'm newbie.I'm so confuse about to develop the MMORPG game in flash.
Is it really can do with Media Server and Flash only?I have to develop multiplayer online game like as each player can move their avatar by using arrow keys.Is it really can be?
ႈWhen I just googelling, I saw most of the forum said MMORPG for xml socket server, but I can't find any tutorial with Media server.

So can anyone help me to point the examples, or Links?Now I'm in dark with that problem.pls help me SOS.

Thanks and Regards,
Ap.

View Replies !    View Related
Flash Game Help
I really need help with a game I am making. I want to add a power bar, lives, power ups, and bosses. The thing is............I DONT KNOW HOW! Any help would be greatly appreciated.

Thanks,
theflashinginferno

View Replies !    View Related
Flash Game
Im making a game in flash and i have all the movement, shooting and collision detection done. I just need to create a variable that can prevent the movie clip from going off of the flash screen along with a way to createa variable for lifes when a collision occurs. If any one has any ideas its mucho appreciated.


Thanks,
Shawn J.

View Replies !    View Related
New Flash Game
Hi all

this is a new flash game that i added on my site
worth a look.


www.flashcircle.com/game.php


please tell me how it is

View Replies !    View Related
Flash Game
Hi folks

Here is a question.

Do you know url where I could find some materials (preferably almost ready for my project ) ) on how to build a flash game.

Description of a game:
there is a guy (player), I would call it fpp - you see with eyes of main character
there is a view - some people show and hide in various positions ( x and y)
the task of a player is to using mouse click exactly "on" a shown individual in order to throw a cake ))

is it hard?
please help me
I'm rather advanced user of flash.

Thanks and greetz to everybody.

-----------------------------------
http://organicbrain.com

View Replies !    View Related
Q & A, Flash Game.
How do I go about creating a question and answer game that totals your score at the end? Can any one help?

Many thanks,

SC.

View Replies !    View Related
Flash Game Help Please
Please, i've hit a deadline, and i can't meet it. I have to create a Jeopardy style flash game, all the graphics are complete, but the actionscripting is not... im not sure how to get it all to work...
i need it so when you click a category it goes to the answer, and lists the questions, you click a question if its right you're score goes up, if your wrong you get no points and goes back to the categories, and the one you clicked on before is gone... and when you get all the categories done with, it shows you the score.
thats all i need... i just can't figure it out to make it work... if anyone can help or mock up a cheesy version of this so i can understand the actionscripts i am willing to even pay for some help.
email me at maxmcleod@insightbb.com

View Replies !    View Related
Flash Game
hi i would like to make a flash games
i would like it to be a platform game like mario land
i am a total beginner and i need a step by step guide on how to make it.
thanks for all your help

View Replies !    View Related
Flash Game
Hi..all

I want to learn flash game , anyone can give me site address which I could download the source for learning....


many thanks

View Replies !    View Related
Flash Game
I have to redesign an old executable game into flash, but I've never really used flash before. Basically what the game entails is that an image of a train is shown, and once you click on a button, the train will move towards another image (a train station). The thing is, when the image of the train comes out the other side of the train station, it could've change colours. The user will then have to decide if the train was the same after it came out of the train station, before it came in. This goes on 4 times for just one train carraige, 4 times for two train carriages, all the way up to 4 times for 6 trains. The results have to be scored on a small scoreboard. This game just has to be functional. Can anyone help, or does anyone know who could do it for me? I have a copy of the executable file if anyone wants to like (it doesn't contain any virus)

View Replies !    View Related
Flash Game
A friend of mine and I are trying to design a flash game for a client. The flash game is supposed to allow users to manipulate the single strip you see at the top left of the attached picture. Using that indivdual block, users should be able to take that one strip and create such complex structures as you see at the bottom of the picture.

I am racking my brain trying to find a way to create this game. It would be good if there was a way to have this game in 3D. If such a game already exists if you can point me in the right direction.

If someone can do this in a relatively short time, I would be willing to pay for it. Let me know what price you would charge as well

Let me know.

Thanks

View Replies !    View Related
Looking For A Flash Game
Hello,

there is a famous game which works like this:
There is an image divided in several squares. One of the squares is empty, so it creates an empty space. So u can move around the squares until u can solve the puzzle and put all squares in the right position so u can form the image.

Do u know the name of this game?
Can someone indicate a flash example of this game?

Thank You,
Miguel

View Replies !    View Related
Flash Game
http://www.flashkit.com/tutorials/Ga...Br-2/index.php

in this page they say how to create that game in flash 4, but i have Flash MX, and even if i try to change the scripts etc. accordingly, the game wount work... (((
this is my .fla (http://www.hot.ee/mclaud/game.fla)
could somebody PLEAZE make thing right in there... and send it back to me.
THANX!

View Replies !    View Related
My First Ever Flash Game
Hi Everyone,

This is my first ever game and I was wondering if I could have feedback from you all.

I have included an quick shortcut to level 2 if you find level 1 too hard - obviously it will not be there in the final game!

I'm gonna do a pre-loader as well shortly.

http://www.jamesferguson.pwp.blueyo...uk/galaxyquest/

Cheers!

View Replies !    View Related
Flash Game/ Tic Tac Toe
i have to do this game tic tac toe! copy it sort of.
www.flash-games.net under classic


its a prodject we are doing at school so please help me i dont know where to start..how do i start building it. the easyest and the best way?

can i do in whit only action script? and in that case how? where do i start?

/andreas

View Replies !    View Related
Flash Game
would this be considered a flash game??

its pretty fun

shoot saddam

View Replies !    View Related
Flash RPG Game
Hi, i am a student from Singapore.
For my school assignment, i decide to do a flash RPG game, something like Final Fantasy but not tat professional.

It should have the function of playing with multiplayers online, able to play with friends thru the net.

Able to have it's own simple AI and soem animation for every move.

I need consulation as in : Will this flash game be hard to accomplished by a intermediate?

I juz wanna noe the difficulty of such network multiplayer flash game.
Pls reply if u have any comment.
Thanks A lot.

View Replies !    View Related
Flash Game
Can you tell me what you think about
THIS game?

I made it a whila ago.

View Replies !    View Related
Flash Game
I'm interested in createing a game that will allow two users to inneract with each other over an internet connection. Has anybody seen a tutorial or an article that may help me better understand how that communication might work??


Thanks in advance.

View Replies !    View Related
Flash Game On Web
I would really appreciate some help urgently,

I have uploaded some flash games to my site, it all worked locally on my machine, but now it doesnt on the web,

The game doesnt show up?

my site is here www.websponge.co.uk just click on any of the games, I dont understand why it doesnt work?

I have allowed view source on the pages...

Please help, thanks

View Replies !    View Related
Help With Flash Game
Hey people,
I'm having some trouble with a game im creating. Being a multiple choice game, based on the game seen here. I want to have two result boxes. One for a response, and the other for the score that the person acquires with their guess, and keep that score onto the next scene. THEN, in the next scene, add it onto the score from the previous scene. Here's my code for one choice.


on (release) {
field1 = "WRONG! How Could You Be Such A Troglodyte?";
first1 = 0;
}


How would I type these actions in, and have them carry on through the game?

Thanks in advance.

View Replies !    View Related
AS Help For Flash Game
Hi all, I'm making an Elevator action type game, there are doors on the L+R which represent the stair cases (take you up/down one floor at a time) and an elevator in the middle (takes you up/down as many as desired). Anyways, I'm running into problems as how to handle moving between floors on the AS side.

There are 16 stairway doors and 8 elevator doors so checking conditions on the onClipEvent(enterFrame) in each door mc is out of the question, will take way too much processing. I've been trying to add a listenter that listens for when the character hits (hitTest) one of these doors... only problem is each door has a different instance name, Door1, Door2, Door3, (all instances of the root mc Door) is there a way to check for this on the character without something like... if(this.hitTest(_root.Door1 || _root.Door2 || etc.))?

function stairs(floor){
if(Key.isDown(Key.UP)){
floor++;
_root.Dude._x = _root["Door"+floor]._x;
_root.Dude._y = _root["Door"+floor]._y;}
else if(Key.isDown(Key.DOWN)){
floor--;
_root.Dude._x = _root["Door"+floor]._x;
_root.Dude._y = _root["Door"+floor]._y;}}

So when hitTest is true, it calls stairs and inputs current floor, BUT because it's if(Key.isDown) method, he will jump several floors because floor++ or floor-- is incrementing too quickly.

Any suggestions?

View Replies !    View Related
Cant End Flash Game
I am making a flash game for School. I currently Have everything I want done except for the end. I have tried using HitTest to make my main character (shorts) hit the end area and stopall. This isnt working I dont know what Im doing wrong and would really like some input this is the end of the project for me and I just really am at a stand still and need some help. I just want it to end and then I would but an if then statement onto that action and slap some little victory thing on. Id really like to know why my HitTest thing isnt working. It seems like it should. Any help would be appreciatted thanks!

View Replies !    View Related
Flash 8 Game Help
I am relatively new to flash. I am using flash 8. My game is simple, firing a Cannon ball to hit an object. I will implant the hit on target after I fix firing of the cannon ball problem. When I fired the cannon it starts in middle of page and not from cannon.

Can some help me figure out why?

Helen
http://newmedia.purchase.edu/~hcross...annonball.html

View Replies !    View Related
Help With Flash Game
Hi,

I've creating a flash memory game. The problem is, when it becomes game over, i want it so that they get a response depending on whether they have reached a specific score. Attached to the movie i have this code at the end:

gotoAndPlay("gameover");
initGame();

I have a variable called scoreDisplay, and i basically want to put in code along the lines of

If scoreDisplay > "30"
goto frame "gameover", play movieclip "gameover" in the frame labeled "more"
else
instead of more, go to frame labelled less,

anyone give me any tips as to how i'd actually write this?

Thanks very much.

View Replies !    View Related
Flash MX Game Help Please
Hi everyone,
I have just made a flash game using some very simple codes, and it works nicely on my computer. However, when I sent it to my colleagues, the flash movie just displays partial graphics on threir computer (although they can still play the game)

The game is a simple clicking game, where the player has to click on 15 flowers to water them and is rewarded with a rainbow in the end. Here is a copy of the code below:

onClipEvent (enterFrame) {
if (_root.count==15) {
_root.gotoAndPlay("goodjob");
}

Can anyone please help me with this? I have attached the flash game in .fla and .swf.

View Replies !    View Related
Help With Ny Flash Game
Well i have his game that catches eggs, and i need to know how to catch em with my crosshairs. My crosshair is a basket and what i want is when the egg comes down from the top, for me to put my crosshair over the egg and it disapears without clicking it. Anyone help?

View Replies !    View Related
New Flash Game...
Hey Guys,
Well everyone here has helped out so much since i started posting here a few years ago - so i thought id give somehtign back and show you guys the latest game ive created for a company in Australia.

http://www.beerwinespirits.com.au/da...s-cricket.html

Check it out...
Highest score ive seen so far is 116.

View Replies !    View Related
Flash Game
I'm creating a game based off the throwing of paper airplanes for a computer imaging class. I've figured out the basic gravity and throw functions but don't know how to reset the plane after the first throw so that the player gets only 3 trys. I am also wondering if there is a way to calculate the distance of the plane thrown?

I have looked into duplicating the plane movie clip to reset it but am not sure thats the best way. I'm attaching the file I've been working in.

Any suggestions would be greatly appreciated. Thanks Kristin

View Replies !    View Related
My Flash Game
Hi my flash game is at:

http://henry.sandi.net/students/2007...st%20sem/games

the one im having problems with is spaceship, and was wonder if someone could download the fla and take a look at it, the only thing i was curious about was how to make a mc explosion for an enemy ship, show up where a different mc(the enemy's movement, not scripted). some of the enemy's explosion works because the mc's path is scripted and not drawn. so mainly just look at each level and tell me how to make to explosion show up where the enemy got shot.

View Replies !    View Related
Flash Game
hi i just had a question about my game
when i put the explosion MC in the enemy MC, it allows you to shoot it again before the explosion finishes then the exlposion starts all over(you can shoot the same ship multiple times) i was wondering if anyone knew of a script to fix this bug? the new game upload is at http://henry.sandi.net/students/200.../spaceship.html if you click the grey box it skips you to the lastest thing, metal tuxedo is the only ship working and if you use that ship that part of the game will represent the bug the best, just try hitting the ship(hold down spacebar and move you ship parrellel to the opponent.
P.S. that glitch works on all the levels but only when the opponent gets close because the other explosions are smaller and shorter in length

View Replies !    View Related
[F8] Help With A Flash Game
Hey, Im wanting to create a basic game to continue my learning with Flash 8. Now my idea is basically to have two movie clips, the first being a ball for example that randomly moves around the work space. The second movie clip would be moved by the up, down, left and right cursor keys on the keyboard. Once the second movie clip has collided with the ball I want a clock to detect and then display how long it has taken for the ball to have been touched with the second movie clip.

Im not entirely sure on how to get the collission detection and the random movement of the ball. If anyone could help or, point me in the direction of a nice tutorial i'd be super happy!

Thanks in advance!

View Replies !    View Related
Flash Game Help
Hi all,

Thanks for any help here. I have a piggy bank game I am trying to build. I need to be able to drag and drop multiple coins/dollars into the bank that add up to a random generated number. If the correct amount of change is put in you go to the next random number up to 20 times. My first problem is I can't figure out how to get multiple coins in the bank and add them together.

I have all my change on separate layers that are buttons inside movie clips. Here is the code I am using to for the penny object. Thanks for any help, looks like a great forum for newbies.

Using flash mx 2004 pro

on(press) {
var penny:Number = .01;
var pennyTotal:Number = .00;
startDrag(this);

}

on(release) {
stopDrag();
if (this._droptarget == "/target") {
pennyTotal = pennyTotal + .01;
_root.result = _root.result + _root.pennyTotal;
_root.result_txt.text = pennyTotal;
this._x = 115;
this._y = 200;
}
else{
//this._x = 350;
//this._y = 300;
}
//while(pennyTotal < 15)
}

View Replies !    View Related
Flash Game Help
I am making one of these flash games where You dress up a character, and I need to make button menu like this one

http://www.deviantart.com/deviation/...scale%3A5&qo=1

How can I do this? Help please?

View Replies !    View Related
Flash Game Help
...
Alrighty, so i've made a fairly simple Rock Paper Scissors Game using a couple Scenes and Lots of if else Statements, but when i go to keep score the score gets multiplied, and i've found out why... i think. i'm using a simple

Key.addListener(this.Object);

and everytime i try to play the game over again, doesn't matter who wins, the score equals the round

Example: Player 1 wins three rounds in a Row, so the score is 3-0, but if Player 2 wins the next round, the Score all of the Sudden becomes 3-4 in Player 2's favor.

or Player 1 wins first Score 1-0
Player 2 wins second Score 1-2

The Score seems to go up in increments : 1,3,6,10,15

Here is where the code is going wrong:


Code:
Mario = new Object();
Mario.onKeyDown = function() {
if (Key.isDown(65)) {
guy1_txt.text="Pressed";
Rock1=1;
if(Rock1==1 && Rock2==1){
answer_txt.text="Tied";
gotoAndPlay("exitb1r2");
}else if(Rock1==1 && Scissors2==1){
answer_txt.text="Player 1 Wins";
gotoAndPlay("exitb1r2");
Score1 +=1;
}else if(Rock1==1 && Paper2==1){
answer_txt.text="Player 2 Wins";
Score2 +=1;
gotoAndPlay("exitb1r2");
}

}else if (Key.isDown(83)) {
guy1_txt.text="Pressed";
Paper1=1;
if(Paper1==1 && Paper2==1){
answer_txt.text="Tied";
gotoAndPlay("exitb1r2");
}else if(Paper1==1 && Scissors2==1){
answer_txt.text="Player 2 Wins";
gotoAndPlay("exitb1r2");
Score2+=1;
}else if(Paper1==1 && Rock2==1){
answer_txt.text="Player 1 Wins";
gotoAndPlay("exitb1r2");
Score1+=1;
}

}else if (Key.isDown(68)) {
guy1_txt.text="Pressed";
Scissors1=1;
if(Scissors1==1 && Scissors2==1){
answer_txt.text="Tied";
gotoAndPlay("exitb1r2");
}else if(Scissors1==1 && Paper2==1){
answer_txt.text="Player 1 Wins";
gotoAndPlay("exitb1r2");
Score1+=1;
}else if(Scissors1==1 && Rock2==1){
answer_txt.text="Player 2 Wins";
gotoAndPlay("exitb1r2");
Score2+=1;
};
}
};


I know this is alot to help with, but i'm severely stuck and this problem is deff bugging me... there is also another Object after this for Player two... if the .fla file would be handier, please PM me and i'll send you a link for it...
...

View Replies !    View Related
2D Game Help [Flash 8]
Hi -

I have a rock and a Gem shaped basically the same. I need to hide the Gem behind the Rock. Any ideas how to do this?

My 3rd element is onClick, when you click the dynamite stick it launches to the rock (target) then reveals the Gem behind it.

Any coding help would be greatly appreciated!

Thanks.
Tn

View Replies !    View Related
[FLASH CS3]CMD - Game
I want to make a game like the CMD in windows that is based on this: http://aperturescience.com/

it should be like this:

>*blinking block as marker*

Then the player should type in login like this:

>login*blinking block as marker*

Then he is going to be asked:

username>*blinking block as marker*

And if he types the right thing he should get asked

password>*blinking block as marker*

this is just the basics. I need to know how to do because I've never used flash before. If you try the game at http://aperturescience.com/ and type login, it is so I want it to happen.

View Replies !    View Related
Flash Game
I was working at flash on the beach recently as a volenter because i wanted to get more into my 3d and flash work and i saw Keith Peters talk 'Make Flash Games. Retire Early.' which encouraged me to start to look into flash games, im a designer so im not really into my code...


Ok so this is my first game ever and ive only just started working with AS2 …

So i have a game and want to make a score board, i dont want to using any server side PHP /ASP! im told the easiest way was to use shared object classes to store the data locally… so could someone show me an example of the code or send me an example?

My game is half done im not to sure about the coding so far but as i said its my first ever game, so here is the URL if you wana check out my game

http://william-e.co.uk/NEWESTfalconwars.fla

give it a bit lolz if you will….the collision detection is lame, i have level progression 4 levels and life lines for the users ship.

a couple of other things, if people would be so kind to help… when the ship gets on the final life line the the enemy ship comes now where near the users ship? i’d also like to add another enemy which i have in the library…i know i could create a custom onenterframe for each of the enemys but im not to sure how :/


Any help will really be appreciated and maybe some beer tokens could be included

thanks

View Replies !    View Related
Flash Game Help
plz help i need to learn how to make bullets like for a space invaders game for exaple can any1 give me a tutorial or teach me them self plz

i relly want to know

View Replies !    View Related
Flash Game Help
I was given this project of making a Hangman game, or rather, continue where the last baka left off. The hangman game is a rather dynamic one, where it reads in text in a .txt file and uses them as questions and answers. The problem I'm facing now is, how do I make AS detect the " " <space> between text? The current game is working, but it can only read single words as it would designate "_"s to blank spaces as well as valid characters. Maybe you might understand more when you guys look through the code i'm given.


The code of reading in the .txt file:

Code:
//To read the question list
Readfile = function()
{
function parseCSV(raw)
{
var delim = (raw.indexOf("
") > -1) ? "
" : (raw.indexOf("
") > -1) ? "
" : "
";
var temp = raw.split(delim);
var fields = temp.shift().split("#");
QuestionNum = 0;
for(var i=0;i<temp.length;i++)
{
var row = temp[i].split("#");
if(row.length != fields.length) continue;
var tmpObj = {};
for(var j=0;j<row.length;j++)
{
tmpObj[fields[j]] = row[j];
}
data.push(tmpObj);
QuestionNum++;
wordbank.push(data[i].Answer.toUpperCase());
questionbank.push(data[i].Question);
//trace(wordbank);
//trace(questionbank);
}
}

inputVars = new LoadVars();
inputVars.load("questlist.txt");
inputVars.onData = parseCSV;
}

Readfile();
The code of the game itself:

Code:
function createbuttons() {
for (i=1;i<26;i++) {
bl = alphabet.substr(i,1);
bn = "button"+bl;
buttonA.duplicateMovieClip(bn,nl++);
_root[bn].setLabel(bl);
_root[bn].setSize(22,20);
_root[bn]._x = buttonA._x + i*25;
}
}

function startgame() {
//triesleft = 10;
//_root.result.text = "Number of Tries Left : " + triesleft;
createbuttons();
mistakes = 0;
_global.oldtotalpts = 0;
_global.newtotalpts = 0;
//_root.gotoAndStop(3);
//buttonA._visible = true;
for (i=0;i<alphabet.length;i++) {
_root["button"+alphabet.charAt(i)]._visible = true;
}
_root.nextstep = 0;
var choice = Math.floor(Math.random()* wordbank.length);
answer = wordbank[choice];
question.text = questionbank[choice];
//trace (answer);
_root.AnswerLength = _root.answer.length;
for (j=0; j<AnswerLength; j++)
{
charArray[j] = 0;
}
//trace('L :'+_root.AnswerLength);
_root.currentAnswer = makedashes(_root.AnswerLength);
_root.place.text = _root.currentAnswer;
//trace("T :"+_root.currentAnswer);
_root.result="";
maxpoints = 0;
for(count = 0; count < _root.answer.length; count++){
maxpoints = maxpoints + 1;
//trace (maxpoints);
}
}

function makedashes(dc) {
trace(dc);
var s = "";
for (i=0;i<dc;i++) {
s += "_ ";
}
return s;
}

var charArray = new Array();

function pickletter(letter)
{
//trace("you picked "+letter);
_root.component._visible = false;
notfound = true;
//trace (answer);
for (i=0; i< answer.length; i++)
{
if (answer.charAt(i)==letter)
{
//trace (_root.answer.charAt(i));
notfound = false;
charArray[i] = 1;
}
/*else{
trace("character is " + answer.charAt(i));
trace("I's value is " + i);
}*/
}
_root.currentAnswer = '';
//trace('S '+charArray);
for (j=0; j<_root.answer.length; j++)
{
if (charArray[j] == 0)
{
_root.currentAnswer = _root.currentAnswer + '_ ';
}
else
{
_root.currentAnswer = _root.currentAnswer + _root.answer.charAt(j) + ' ';
}
}
place.text = _root.currentAnswer;
//trace (charArray);
for(counter = 0; counter < answer.length; counter ++){
newtotalpts = newtotalpts + charArray[counter];
//trace (newtotalpts);
//trace (oldtotalpts);
}
if (newtotalpts == oldtotalpts){
_root.gotoAndStop(_root._currentframe + 1);
mistakes ++;
oldtotalpts = newtotalpts;
newtotalpts = 0;
}
else if (newtotalpts == maxpoints){
score =
_root.gotoAndStop(16);
}
else
{
oldtotalpts = newtotalpts;
newtotalpts = 0;
//trace (oldtotalpts);
//trace (newtotalpts);
}
score = oldtotalpts * 2 - mistakes;
//trace("Score --> " + score);
_root.score_text.text = "Your present score is : " + score;
}
The buttons containing single characters of which the player selects is duplicated by AS. The startgame function is called when I click on a component button. Each correct letter selected will increase the score by 2 points, and a wrong choice will deduct 1 from the present score. charArray() is a "true/false" array that is resized according to the word selected, with all values initally set to 0 for each letter in the word. Once the player selects a correct letter, the "0" value of where the letter should be will change to "1". When all values are "1", the player will be taken to the "you win" screen.

Hope you guys can help. Any information missing, just let me know and i'll reply. Thanks!

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved