PDA

View Full Version : combat engine - Help


Max
04-11-2007, 04:48 PM
Hi, it's been a while since i've posted in the flash forums, but , ohwell.
I was wondering, for a combat engine, how do you make the following things possible:

- The higher level the character is, the more damage he can inflict
- Weapons purchasable, that have different damage inflictions
- When damage is inflicted, the number of HP lost appears over character / enemy

I would really appreciate anyone who helps me. Whoever does help, will be credited in any games i put together using a combat engine.

Malignus
04-11-2007, 06:40 PM
1 and 2 are extremely easy--all you need are variables and a couple of functions.

charLvl=1;
weaponChosen=1;
weapon1Dmg=5;
weapon2Dmg=10;
weapon3Dmg=15;

function determineDmg () {
if (weaponChosen==1) {
Dmg=weapon1Dmg+charLvl; }
if (weaponChosen==2) {
Dmg=weapon2Dmg+charLvl; }
if (weaponChosen==3) {
Dmg=weapon3Dmg+charLvl; }
}Then just call determineDmg () whenever you switch weapons.