RTS Attack

Get help using Construct 2

Post » Thu Aug 02, 2012 3:52 pm

   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;

I'm not sure if I'm doing it right, any help would be appreciated.

Kind Regards,
Posts: 8
Reputation: 417

Post » Fri Aug 03, 2012 2:07 am

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.
Posts: 903
Reputation: 8,452

Post » Mon Aug 06, 2012 12:17 pm

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
Posts: 8
Reputation: 417

Return to How do I....?

Who is online

Users browsing this forum: DjPoke, dreaa, Lightside, Sean Noonan and 20 guests