PDA

View Full Version : Variables


agnusdei
08-28-2001, 03:18 PM
Hi
Im making a small turnbased game, in wich you shoot at your opponent with small cannons.. After the target MC is hit, it goes one step further in its timeline plus reducing points from the opponents score. The animating stuff is not a problem (just a simple tell target), but I need to make the MC understand not to reduce points from the opponents score when it has reached the last frame in its timeline (at this point its just a hole in the ground). I aksed before, and got the answer to simply set a variable on the last frame in the MC´s timeline.. The problem is that i already knew this but didnt know how.. I´ve tried so many ways, just to realize that Im more of an artisticly talented person, and not so much talented in the arts and ways of programming.. Could someone please help me with this probably simple problem? What should I write? Where should I write it? What is the purpose of life and what does it all mean? Cheers!

Jesse
08-29-2001, 02:41 AM
put this code on the last frame of the MC:
_root.lastFrame = true;
then, when the thing is hit:
if (!_root.lastFrame) {
// not on the last frame, so reduce the score
}
// else do nothing coz it's dea already
of course if you have 20 targest they will each need a unique variable name. you could make the variable a local variable (stored in each individual MC) which wuold mean they could all have the same name because they'd all have different paths so no conflicts would arise. I trust you've read the first 4 beginner level tutorials here.

agnusdei
08-29-2001, 11:59 AM
Wehey! Its alive, its alive!
Cheers, Im very grateful.