KAZESUI'S PROFILE
Search
Filter
CBS Problem
moving the hero is much of the same principle.
you'll of course need to have some kind of cursor and way of choosing the individual hero. once chosen you should simply select another coordinate. then subtract this coordinate with the ones of the hero in question, multiply any coordinates with negative numbers with -1 and add the x and y coordinate. This way you get the total amount of cells needed to reach the destination. if this is above the max range of the hero, play a failure tune or something, and let the player select a new coordinate.
when given in a coordinate within the range of the hero, set the coordinates again, subtract with each other, and move in accordance with the difference as stated in the previous post.
same thing here, bit more complicated than just that, since there's probably going to be unpassable obstacles here as well and other possible problems, but this is more or less the gist of it.
you can probably feel free to pm about other problems or more spesific solutions about this, and depending on my mood and time to spare I'd probably try to answer to the best of my capabillities
you'll of course need to have some kind of cursor and way of choosing the individual hero. once chosen you should simply select another coordinate. then subtract this coordinate with the ones of the hero in question, multiply any coordinates with negative numbers with -1 and add the x and y coordinate. This way you get the total amount of cells needed to reach the destination. if this is above the max range of the hero, play a failure tune or something, and let the player select a new coordinate.
when given in a coordinate within the range of the hero, set the coordinates again, subtract with each other, and move in accordance with the difference as stated in the previous post.
same thing here, bit more complicated than just that, since there's probably going to be unpassable obstacles here as well and other possible problems, but this is more or less the gist of it.
you can probably feel free to pm about other problems or more spesific solutions about this, and depending on my mood and time to spare I'd probably try to answer to the best of my capabillities
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.
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.













