ForumsProgramming Forum{AS3} How to make a next level.

11 7162
Axel
offline
Axel
475 posts
Nomad

I wondering how, (don't tell me its easy, I know, but I don't know how.) to make the char go to the next level when he defeats 20 enemies.
All I want the 'next level' to be is more enemies. No need to tell the player anything.

Heres the FLA file:
http://www.mediafire.com/?kcjym4yjmyt

(yeah, i'm following a guide.)

  • 11 Replies
Darkroot
offline
Darkroot
2,763 posts
Peasant

Make some counter to keep tally of the enemies the char defeats and when it equals 20 it does something like goes to the next frame with a different background and spawn more or different enemies.

plasmafish
offline
plasmafish
252 posts
Nomad

Make some counter to keep tally of the enemies the char defeats and when it equals 20 it does something like goes to the next frame with a different background and spawn more or different enemies.


It's as simple as that. If you understand how the game was programmed it should be a piece of cake.
Axel
offline
Axel
475 posts
Nomad

Ok, so I added these,

var counter:int = 0;

and

if(counter == 2){
speed == 25
}

and on here

if(hitTestObject(bulletTarget)){
//remove this from the stage if it touches a bullet
removeEventListener(Event.ENTER_FRAME, eFrame);
_root.removeChild(this);
counter += 1; <-- ADDED THIS _root.bulletContainer.removeChild(bulletTarget); bulletTarget.removeListeners();
_root.score += 10;
}

Axel
offline
Axel
475 posts
Nomad

...and it still didn't work.

Nothing really happened. Plz help?

plasmafish
offline
plasmafish
252 posts
Nomad

Put a dynamic textbox for Counter visible on the screen and visually debug it. If the number doesn't go up when you hit an enemy there is something wrong in the code and more trial and error must take place.

AbnormalIdiot
offline
AbnormalIdiot
110 posts
Nomad

Your problem is when you set the speed to 25, you use == instead of =
Try:

if(counter == 2){
speed = 25;
}

Axel
offline
Axel
475 posts
Nomad

Whats the differance between == and =?

Axel
offline
Axel
475 posts
Nomad

Oh and... (sorry for double post)

1. How to you make a dynamic textbox?
2. How to you make it so the speed of the bullet is the score / 2.5?
I have private var speed:int = 3; and the var for the score is _root.score.
3. How to you make a object move according to the mouse?

plasmafish
offline
plasmafish
252 posts
Nomad

There are 3 types of text boxes in Flash. Static, Input, and Dynamic.

plasmafish
offline
plasmafish
252 posts
Nomad

== evaluates equality, while = assigns a value.

Pingu1651
offline
Pingu1651
5 posts
Nomad

When you're in Flash and choose the text tool, there's a drop-down box that says "static" on it. Click on that, then click on "dynamic." Then make a text box. It's now dynamic text, instead of the default static.

Showing 1-11 of 11