At 10/14/07 02:52 PM, zooominsh wrote:
i understand thanks, but it is with levels, but how to make it like swords and sandals , when you put points in strenght you get better attack.
Simple. Have a two-dimensional array of the mins and maxes of the attacks. The first element is the min, second is the max.
var playerWeapons:Array = new Array
(
[0, 30], // fist
[10, 50], // sword
[100, 500] // gun
);
Then, call them like this.
var playerWeapon:Number = 1; // sword
_root.enemyHealth -= Math.floor (Math.random () * playerWeapons [playerWeapon] [1] + (playerWeapons [playerWeapon] [0] + 1));
So the attack power of a sword would be 10-50, gun 100-500, fist 1-30, etc. have fun!