Be a Supporter!
Linked Lists Posted April 12th, 2011 in Game Development

Is it possible for a node in a linked list to point to more than one node

Also, is it possible for a node to have more than one node pointing to it?

Response to: explosion like lemmings Posted March 26th, 2011 in Game Development

I think the easiest way to do that would be to create a mask in the shape of the explosion on the background image in the same co-ordinate as the thing that exploded.

This should allow the part that is covered by the mask to become transparent and look as though a chunk of the background is gone.

So I suggest researching masks and how to implement them

Response to: A moment of invinciblity... Posted March 1st, 2011 in Game Development

you need to clearInterval(); when you're done being invincible

Response to: Sound runtime error Posted February 17th, 2011 in Game Development

Well, that's another weird thing.

I have had it working fine for the past few months and during that time I never had to embed the sound.

I recently changed the "how to play" section and that's all I changed. That section has nothing to do with sound, nor does it interact with the play game code.

Sound runtime error Posted February 17th, 2011 in Game Development

I have a game that, when trying to load in a browser, gives me this error:

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.

I must push "Dismiss All" in the pop up box that gave me this error and when I do my menu comes up as it's supposed to with the sound running but I can't click the button that starts the game but I can click the button that starts the "how to play" (the how to play section has no sound in it so I think that's why)

What's weird, though, is that when I test just the .swf or Test Movie in the .fla this error doesn't appear and the game works perfectly.

I have no idea why this error is happening nor where to find the code that is the problem.

Response to: Index in for loops [AS2] Posted February 15th, 2011 in Game Development

I'm a little confused about what the problem you're having is. Looking at the code, however, I notice that you seem to be checking if a bunch of enemies have been hit. According to your explanation you have only 2 enemies and yet you have the code looking for 100 enemies.

So the code right now seems to look at _root.enemy[0] and see if it's hit then looks at _root.enemy[1] and do the same but then looks at _root.enemy[2] to _root.enemy[99] and those enemies do not exist.

To fix this (if this was your problem) just change the 100 to 2

If this was not the problem please clearly explain what the problem is.

Response to: Completely external flash game Posted February 7th, 2011 in Game Development

One thing you can do to make the .fla smaller is go to:

File-Save and Compact

this will save your original .fla file with it now using much less space. This might lower the bytes on the .swf I'm not sure.

If it doesn't you should tell us why it's so big so maybe we can help with more specific advice.

Response to: Trouble with arrays Posted February 7th, 2011 in Game Development

This stuff is way too general to be asking for help on here. It seems like you want us to write the code for you. Most people will not do that.

So here are some tutorials instead:

arrays (not sure if this is as2 but the syntax isn't much different for arrays)

collision detection

These tutorials don't cover everything that you asked for so whatever they don't just go to google and type in "array tutorials actionscript 2 (or as2)" and "collision detection actionscript 2"

Response to: Loading movie in browser Posted January 4th, 2011 in Game Development

I only have the preloader in the first frame. In fact, I used the newgrounds preloader to test with something that I know works, but it still doesn't

Response to: AttachMovie Positioning issue... Posted January 3rd, 2011 in Game Development

Oh! I didn't realize that the projectile was inside the character movie clip. Of course it's going to move with the character :P as far as actionscript is concerned they're the same movie clip. What you need to do is make a separate movie clip of the projectile outside of the character movie clip

Response to: AttachMovie Positioning issue... Posted January 3rd, 2011 in Game Development

Like I said previously:

You only make XOrigin and YOrigin equal to the character origin when the throw button is pushed. So say you have a function that controls what happens when the throw button is pushed: (keep in mind this is pseudocode and is closer to AS3 syntax anyway so don't just copy and paste)

var speed = 10;

function throw(){ //this happens when you push the throw button
     XOrigin = characterX;
     YOrigin = characterY;
}

function projectileMove(){
     projectileX += XOrigin;
     projectileY += YOrigin;
     for(i=0; i<50;i++){
          projectileX +=  speed;
     }
}

so! if the character is at x = 300 y = 500 and the throw function is called then the XOrigin and YOrigin would become 300 and 500 respectively.

Then in the projectileMove function the projectileX becomes 300 and the projectileY becomes 500 then in the for loop projectileX becomes 310 then in the next loop it becomes 320 etc for 50 times

so with that it is not using the character's coordinates for anything except to determine where to start the projectile.

Response to: AttachMovie Positioning issue... Posted January 3rd, 2011 in Game Development

You have 2 variables for XOrigin and YOrigin that you make equal to the character's x and y position at the moment of the button push and you do that in the function that occurs when the button is being pushed so that they don't change unless you push the button again.

Then you make the projectile's x and y co-ordinates equal to the XOrigin and YOrigin + the speed of the projectile

Response to: Bullet At Orgin Of Rotating Gun As2 Posted January 3rd, 2011 in Game Development

the bullets' origin co-ordinates need to be at the bulk of the gun instead of the dog's center

Loading movie in browser Posted January 3rd, 2011 in Game Development

I have a flex website in which I have embedded a flash game. The game works perfectly on the site however there is a large period of time that the game does not play. I am assuming that this is because it's loading the game so I put a preloader at the beginning of the game.

Unfortunately the preloader doesn't show up until the actual game has loaded and obviously by then it's pointless.

I don't know what I need to do to make the preloader show up before the game loads.

Any help with this is greatly appreciated

Response to: Tile based problem Posted January 3rd, 2011 in Game Development

I would suggest, in the WALL section, that you use "if" instead of "while" as I assume (because you didn't say so specifically) that he zooms off stage when you hit a wall.

Response to: As3 Help! Posted January 3rd, 2011 in Game Development

I'm not positive about this because it's usually more complex than this but try putting MoiveClip(root). in front of removeChild(this)

Response to: AttachMovie Positioning issue... Posted January 3rd, 2011 in Game Development

I would use a different method for determining the position of the projectile. Right now you have the projectile always using the co-ordinates of the character to determine it's position.

What you should do is have the projectile separate from the character completely and only make the projectile's starting position the same as the character when you hit the "throw" button.

So in bullet form what you'd want to do is:

-User hits throw button (or however you're telling the character to throw)
-projectile starting co-ordinates = character co-ordinates at moment of button push
-projectile starting co-ordinates +=speed of projectile (assuming you want it to go in a straight line)

Response to: As3 Help! Posted January 3rd, 2011 in Game Development

the "root." isn't used in AS3 it is now MovieClip(root).

also I don't think "root." was the right syntax in AS2 either, I thought it was "_root." but I could be remembering wrong

Same Code But Goes Faster? Posted December 16th, 2010 in Game Development

I have some very simple code which is shown below in it's entirety:

stop();

var speed:Number = 0;

addEventListener(Event.ENTER_FRAME, eventHandlerLoad);

function eventHandlerLoad(e:Event):void{

speed = speed + 1;

sineWaveMove(sineWaveOne_mc);
sineWaveMove(sineWaveTwo_mc);
}

function sineWaveMove(sineMC:MovieClip){
if(sineMC.x < 510){
sineMC.x += speed/100;
}else{
sineMC.x -= sineMC.width*2;
}
}

the movie clips used are already on the stage at these positions and widths:

sineWaveOne_mc.x = 320
sineWaveOne_mc.y = 308
sineWaveOne_mc.width = 530
sineWaveOne_mc.height = 49

sineWaveTwo_mc.x = -210
sineWaveTwo_mc.y = 308
sineWaveTwo_mc.width = 530
sineWaveTwo_mc.height = 49

frame rate is 60

now, for some reason the sineWaveTwo_mc occasionally moves forward faster than the sineWaveOne_mc. I have absolutely no idea how this is even possible.

Any help would be greatly appreciated

Response to: Limiting object movement Posted December 6th, 2010 in Game Development

Only allow it to move when it's within the boundaries of the stage.

so you'd have an if statement that says

if (carInstanceName.x < stage.width && carInstanceName.x > 0 && carInstanceName.y < stage.height && carInstanceName.y > 0){

//YOUR CAR'S MOVEMENT CODE

}

Response to: moving up/down along slants? Posted December 6th, 2010 in Game Development

increase his x coordinate at the same time as decreasing his y coordinate to go up and to the right

increase his x coordinate at the same time as increasing his y coordinate to go down and to the right

etc. you get the idea

Response to: Slow SWF file Posted December 6th, 2010 in Game Development

That is what I meant. I have an FPS meter and it stays the same whether it's playing in the .fla or as the .swf

Slow SWF file Posted December 6th, 2010 in Game Development

I've created a game that runs perfectly fine when playing it in the Flash program but once I try to play just the SWF file it slows down a certain animation (not all animations just enemies spawning)

The FPS rate is not changed at all and again this is only when playing the created SWF file. When using the Ctrl-Enter command to run it in Flash works as intended.

I'm at a complete loss as to why this is happening, any ideas?

Response to: quick array question as3 Posted November 17th, 2010 in Game Development

You basically have what you need, just put the for loop inside an if statement that says

if(flashTimer reaches a certain time){
your for loop with i<10 instead of i<3
}

and if you only want 5 waves put the

flashTimer.start()

into a for loop that loops 5 times

flex 4 changing image source Posted November 16th, 2010 in Game Development

I'm creating a website with flex and here is what I want to have happen:

When I roll over a certain image the source should change to a new image I have on file. This works but I also want it changing back to the original image when I roll out, the code for all of this is:

//actionscript
protected function NavHome_rollOverHandler(event:MouseEvent ):void
{
NavHome.source = "NavHomeTextRollover.png";
}

protected function NavHome_rollOutHandler(event:MouseEvent)
:void
{
NavHome.source = "NavHomeText.png";
}

//mxml
<mx:Image x="222" y="240" source="NavHomeText.png" id="NavHome" rollOver="NavHome_rollOverHandler(event)
" rollOut="NavHome_rollOutHandler(event)"/
>

this causes the image to blink very rapidly until I take the mouse away.

The problem, I think, is that when it changes the source image into the Rollover version the image disappears for a moment and the program thinks I have rolled out and puts the original image back which is told to change when rolled over and it repeats that ad infinitum.

If that is in fact the problem I don't know how to fix it. I'm somewhat new at mxml coding but am very experienced with actionscript

mxml flex 4 changing image source Posted November 16th, 2010 in Programming

I'm creating a website with flex and here is what I want to have happen:

When I roll over a certain image the source should change to a new image I have on file. This works but I also want it changing back to the original image when I roll out, the code for all of this is:

//actionscript
protected function NavHome_rollOverHandler(event:MouseEvent ):void
{
NavHome.source = "NavHomeTextRollover.png";
}

protected function NavHome_rollOutHandler(event:MouseEvent)
:void
{
NavHome.source = "NavHomeText.png";
}

//mxml
<mx:Image x="222" y="240" source="NavHomeText.png" id="NavHome" rollOver="NavHome_rollOverHandler(event)
" rollOut="NavHome_rollOutHandler(event)"/
>

this causes the image to blink very rapidly until I take the mouse away.

The problem, I think, is that when it changes the source image into the Rollover version the image disappears for a moment and the program thinks I have rolled out and puts the original image back which is told to change when rolled over and it repeats that ad infinitum.

If that is in fact the problem I don't know how to fix it. I'm somewhat new at mxml coding but am very experienced with actionscript

Response to: Math Challenge Posted October 21st, 2010 in Programming

Hmm, I can see why you'd think it was a "do my homework thing" buuut it's not :P and I'm not sure how to convince you that it isn't

it's actually a problem I came up with based on a game I'm making that does this sort of thing and I'm just curious. The way the game is set up it makes it difficult to make this happen electronically.

So I would really just like an answer I don't need to know how you do it as it's just for fun.

Oh and it being based on a game is why it's in programming, wasn't sure where else to post a math problem.

Math Challenge Posted October 21st, 2010 in Programming

This is a relatively difficult math problem and I want to know who can solve it (I'm looking for the answer so I don't know it) I hope one of you can figure it out:

There are 21 items with values of 1 - 20 and 25, there are four people collecting these items and with each item they collect they add them together to make a total (i.e. if one person gets item 1 and 4 and 7 they would have 12)

What combination of items would the people have to collect to have two or more of them with the same highest total

*notes - all items must be collected between the four of them
- not all people need to have collected items

good luck :)

Response to: dynamic variable name Posted October 19th, 2010 in Game Development

Also, I should clarify, it's to shorten this kind of code:

if (values==1) {
var ingredient1:Ingredient1 = new Ingredient1();
ingredientDrawArr[i]=ingredient1;
}

if (values==2) {
var ingredient2:Ingredient2 = new Ingredient2();
ingredientDrawArr[i]=ingredient2;
}

Response to: dynamic variable name Posted October 19th, 2010 in Game Development

yah :) buuut is the duplicating movie clip necessary?