[BUG Workaround]Physics and reseting ScrollX: weird effects

This forum is currently in read-only mode.
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • Hi all,

    I have a tiled background and 2 sprites with physics.

    I apply a force of X=100 to the sprites and set their "center on me" attribute in an unbound layer.

    Every time ScrollX reaches 100 I set sprites X to sprites X - ScrollX and TiledBackground.X = TiledBackground.X - ScrollX.

    For Tiles, no problems but the distance between the sprites is greater each time and I don't understand.

    Here is the cap http://www.box.net/shared/xsj88ea2al

    Please, help, I'm desesperate

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It seems to be an issue with setting the position of an object with the physics behavior. But it also seems to affect only the first object that has physics.

    The solution is to create a dummy object with the physics behavior and make it the first object at edittime by sending it to the back.

    Do this:

      Create another sprite to be a dummy object. Give it the physics behavior. Set the physics collision mask to none, so legitimate physics objects won't collide with it. Right click on the object and send it to back.
  • It seems to be an issue with setting the position of an object with the physics behavior. But it also seems to affect only the first object that has physics.

    The solution is to create a dummy object with the physics behavior and make it the first object at edittime by sending it to the back.

    Do this:

      Create another sprite to be a dummy object. Give it the physics behavior. Set the physics collision mask to none, so legitimate physics objects won't collide with it. Right click on the object and send it to back.

    Now that's important what you found out! It should be on the wiki, because almost everyone playing around with physics stumbled upon this one without a solution (at least I couldn't read on the forums other than "there are issues")...and it is so simple to solve. Great work ROJOhound!

  • Very good idea, I'll try that.

    Thanks a lot.

  • It works

    Should I post a defect?

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