Search tutorials
Should we get started? Now relax and read this clearly. I will explain everything you need to know...
Ok open Flash 2004! make the first frame a name of "setup" and add this actionscript to it:
HP = 750;
enemyHP = 500;
This will tell it to add your hp and the enemie's hp to a number. Now make another frame and put this frame as "You". Ok! Now make a "attack" button. Now put a enemy on one side and you on the other.
Above your character make a static text that reads "HP:" now put a dynamic text just right on the right side. Do the same for the other side for the enemy. Now the dynamic texts, put the enemy one a variety "var:" put that as "enemyHP" now yours is "HP" now make the attack button this actionscript:
gotoAndPlay("attack")
This will go to "attack" frame. now go make another frame and put it:
"attack" name. now from that frame make a animation of your character attacking. when your done make the last frame actionscript:
gotoAndStop("You");
Now go to the frame where your character "hit" the enemy.
Put this in THAT frame.
_root.enemyHP = _root.enemyHP-random(70);
Now it will pick a number between 0-70 as the damage.
Now put this into the frame where you can press the attack button:
stop();
Now make it like that for the enemy attacking.
so if its _root.enemyHP = _root.enemyHP-random(70);
just switch it to this on the enemy attacking u:
_root.HP = _root.HP-random(80);
Now make 2 frames in the end and put that as the winning frame. and the loosing.
So put this into the "You" frame.
if (_root.HP==0) {
gotoAndStop("lose");
}
}
if (_root.enemyHP==0) {
gotoAndStop("win");
}
}
Now name one frame the "win" frame and the "lose" frame now put something in both of them and now your done! just put this into the lose and win frame:
stop();
test it and love it!
» Level Advanced |
Added: 2005-01-18 Rating: 4.9 Votes: 84 |
» Author |
Hello it is my pleasure to help other people MASTER flash MX, 5, 6, and Pro 2004! Its my mission to get you making advanced stuff! |
» Download |
Download the files used in this tutorial. |
Download (835 kb) |
» Forums |
More help? Search our boards for quick answers! |