Moving players instance problem

Get help using Construct 2

Post » Sat Aug 11, 2012 5:49 am

Hi guys,

I am getting some weird results with instances of sprites.

In my CAPX The player can be moved to a new location by dragging and dropping his blue touch-circle.

Once the blue touch-circle is dropped the players yellow destination circle is set there and the player is made to move to it.

Once the yellow circle overlaps the player we know he has arrived at his destination and the player movement is stopped. Every tick the yellow circle is being checked to see if it is overlapping the player if not then the player is made to the yellow circle until he is.

My problem is sometimes when I have a player moving to his yellow destination circle and I start moving another player that previous player will sometimes follow the newest players yellow circle as well or I get other weird difficult to explain movement. Is it the way I am selecting instances... Any help here would be greatly appreciated.




Moving Players CAPX
B
6
Posts: 16
Reputation: 882

Post » Sun Aug 12, 2012 10:58 pm

The "is overlapping" conditions are what's causing the trouble. It compares all the picked "destination" and "walk" objects together. It's kind of hard to visualize how it behaves sometimes so if you can reduce what objects are picked it makes it simpler.

For example you can condense the conditions in event 7 and 8 to this:
system: for each destination
walk: selected = destination.selected
destination: is overlapping walk

That way you select each pair in turn and "is overlapping" has one of each object to compare when it's reached.
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Mon Aug 13, 2012 10:35 am

Thanks R0j0! You have actually helped my understanding of picking instances alot too. Your way is so much easier. Cheers!
B
6
Posts: 16
Reputation: 882


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, michaelverdi and 18 guests