Moving players instance problem

0 favourites
  • 3 posts
  • 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.

    <img src="https://dl.dropbox.com/u/93923432/Untitled.png" border="0">

    Moving Players CAPX

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Thanks R0j0! You have actually helped my understanding of picking instances alot too. Your way is so much easier. Cheers!

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