blitzxion / Tanks.js

Using Javascript and HTML5, watch the AI build up their army and battle each other!
12 stars 4 forks source link

New TankStateEnum states... #21

Closed blitzxion closed 12 years ago

blitzxion commented 12 years ago

Instead of hacking apart and causing new bugs/confusion with what state can eject what, maybe we should introduce new states and a method that can properly move units in an out of states.

Here's our current states:

var TankStateEnum = {
    IDLE : 0,
    MOVE : 1,
    TARGET_AQUIRED : 2,
    TARGET_IN_RANGE : 3,
    CRASH_AND_BURN : 4,
    EVASIVE_ACTION : 5, // New : Moving units can take evasive actions to retreat and heal
    STOP : 6 // New : Makes the units stop at their position, can start move again if attacked
}

We should add something like the following:


/*EVASIVE_ACTION*/
EVADE; // Replaces EVASION_ACTION. Obtain nearest base, go to it (obtains random point)
EVADE_AND_ATTACK; // While evading back to base, if attacked, attack nearby peeps
/* STOP */
STOP_AND_GUARD; // Replaces STOP. While at the base and healing for example, scan and attack for nearby units, but don't move out of position

Stuff like that!