Multiple Unit Movement

Get help using Construct 2

Post » Sun Jun 17, 2012 5:36 pm

Hi.

I'm playing with some RTS concepts. I am able to individually select different units and move them about the screen one at a time. However, the following example is giving me fits:

I click a unit and click on the far right side of the screen. While that first unit is moving, I click a second unit and move it as well to another location. It begins to move as well. However, the first unit will no longer stop unit the second unit stops. I tried to record the clicked target locations first and then use a For Loop to check for each unit to fix the problem but that makes it so units move in the direction of a click but then stops immediately. Can anyone help with this? I have both movement problem available in the capx file. Toggle/Untoggle the lines to see both movement problems.

Here is the link to my capx file

RTS testing


Thank you in advance for any help
B
15
S
6
Posts: 17
Reputation: 1,927

Post » Sun Jun 17, 2012 6:24 pm

I would use instance variables to keep track of where you want the units to go, and booleans to control selection and toggle movement.

Here is a quick example I made, hope it helps: MultipleUnitMovement.capx
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Jun 17, 2012 7:38 pm

Thank you very much Nixtrix. You not only solved my problem but added some nice features like the opacity to know a unit is selected and multiple selections at once.

I don't see a way to give you reps so here's this instead:
B
15
S
6
Posts: 17
Reputation: 1,927


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 21 guests