Advanced Help fast. Variables with if, else action

Hey yall
I need some help, Here’s my prob.
I am making a game. Its a shooting game. Here are my materials: score(dynamic Text box)
ammo(dynamic text box)
Now when you shoot one of the little creatures, i want to take one off of ammo, ( which will start off at 4) and add one to score, BUT if you don’t have ammo, you can’t add one to the score. Here’s what i tried,on (press) {
if (ammo!=0) {
tellTarget ("/") {
ammo = ammo-1; // subtracting the ammo
}
}
}
on (press) {
if (ammo!=0) {
gotoAndPlay (2); // thats the blow up effect, if hit
tellTarget ("/") {
score = score1; // adding the score
}
if (ammo=0) {
gotoAndPlay (1);
}
}
}
the if (ammo=0) gotoandPlay (1); is that it just keeps going if you dont have ammo.
now this is what it does. IT takes away one of the ammo, and it adds one to the score, but when the ammo gets to 0 . It wont stop going down, and it wont stop
adding a score. What did i do wrong? everything worked until i added the ammo. Help me Kirupa, or users!

Krautammi

Hello Krautammi,
I’m sorry, but I don’t know what the problem might be. I’m still trying to learn ActionScript, and I’m not that good with it yet. Try posting at Flashkit’s ActionScript forum. The URL is: board.flashkit.com/board/…forumid=30