How do I use collisions correctly?

0 favourites
  • 7 posts
  • Hi!

    I´m new to Construct, and have a problem with collisions. I have followed the basic platform tutorial, with an enemy who are colliding with some edge markers (https://www.scirra.com/tutorials/253/ho ... ame/page-7). When this happens, the enemy should be mirrored and the simulate control should go in the opposite direction.

    Problem is that the enemy is colliding with the edgemarker multiple times, instead of just one time as it should. And therefore the direction goes left/right the same amount of times. It seems randomly how many times it triggers, but usually two times (which then doesent change the direction).

    I´ve been playing around with the speed, acceleration and deceleration which seems to affect the result, but it is not reliable.

    So what am I doing wrong? <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    Thanks in advance!

  • Can you share the capx? If you implemented it exactly how it is in the Tutorial, this shouldn't happen, since it's a "On collision" event, which means it only happens once, when colliding.

  • Thanks alot for the fast answer!

    You can find the project here:

    Take a look at the enemy sprite called 'Pvagt'

    Thanks!

  • I'll take a look. Meanwhile, I had already made a capx, so, check it...

    https://www.dropbox.com/s/1mnzfh2o9sfe3 ... .capx?dl=0

    Cheers.

  • Hey farsen!

    Just so you know... The problem with your code is that you're telling the sprite to mirror and simulate direction press without changing the "action" variable. You should only change the "action" variable, as shown in the image below:

    hope this clarifies the issue. Cheers!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Doh, sorry! Of course!

    Thanks alot for helping with my blindness

  • Glad to help! Good luck!

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