New account registration is temporarily disabled.

KAZESUI'S PROFILE

Doing Super Programming
on Super Computers
for Super Performance
The Curse of Cpt. Lovele...
Nautical-themed cephalopod-pirate-based action-shmup.

Search

Filter

CBS Problem

So basically, what you want is to make a tactical battle system?

To make an enemy target any hero, you should "scan" the area close to the enemy for any hero events (i.e. by checking events within within certain x/y range of the enemy, the total amount of cells of difference of any event, et cetra).

at the end you're supposed to have on "target event" chosen by priority and range of the enemy event. you then take the x and y value of the target event, and the x and y value of the hero event and subtract them with each other.

if say "hero event" is (2,3) and "enemy event" is (3,5) and you subtract "hero event" with "enemy event", you're going to get (-1,-2).

now you make a loop and make the enemy move in a direction depending on these variables. if the x is -1 or less, you make him move left once, and add 1 point to the variable, and vice versa and same for the y variable. This goes on until both reach 0 or until his range variable reaches x (0 if you wanna deduct from his range, or the number of whatever his max range if you add).

obviously, it's going to be more complicated than this, when taken unpassable obstacles and lot of other stuff into consideration, but I hope with this you've at least got something to work with, rather than being clueless as to how to make 'em move.