RTS Attack

  • Hello,

       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.

    Kind Regards,

    Ian

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm not sure what you mean by "freaks out", but try changing the condition with the distance expression to say "less or equal" instead of "equal". It's not very likely it'll be *exactly* Unit01.Height.

  • Ops over sight on my part.

    I'm going to leave this for a while, do some simpler projects and come back to this at a later date.

    Cheers for all the help Nimtrix

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)