So far my RTS game is going quite well, I have GUI, movement, Resource Gathering, and unit movement. Next I have been trying to wrap my brain around how to do combat.
Now I'm hoping someone here can talk me through the best way to do this? I have been playing around with a few events; trying to adapt the movement code in order to create attack code. This is not working to well. I've re-written it a few times.
What I've been trying to do is if the player right clicks with a selected unit on an enemy then set GotoX GotoY (like you would for movement) and turn attack on, then start to move towards it, once the unit is within certain X,Y of the enemy then subtract health and set attack to false.
Though this doesn't seem to be working. It gets to the position, then freaks out and the health of the enemy doesn't go down. Below is a screenshot of my event sheet;
<img src="http://img713.imageshack.us/img713/8917/problem01.png" border="0" />
I'm not sure if I'm doing it right, any help would be appreciated.