How do I fix unwanted left/right movement in my Platformer?

0 favourites
  • 4 posts
From the Asset Store
Contains 601 dynamic, unique, tradecraft movement and transition sounds including morphs, whooshes, swishes, & much more
  • I'm making a game that requires the player (a bird character) to be able to push boxes around and pick up the boxes and fly around with them.

    I've created what i need using a combination of physics and pinning. The physics make it a breeze to allow the the player to push boxes around. To fly with a box the player lands on the box then immediately jumps to pin the box to them. If they press left or right whilst still on the ground the box will immediately unpin. This allows the player to walk along the top of boxes without moving them. If you continuously press jump along with the left and right arrows you can fly around with the box.

    However, if you look at my example capx file you'll see that it's possible to jump onto a box, and, as you land, pushing the left or right arrow you can still become pinned to the box. Worse still the box and the player will start moving along the ground and keep moving, even if you don't press any player controls.

    I've tried numerous different methods to get my player control system to work but they all fall apart because of this odd behavior where landing on another movable object will cause both the player and the object to move off in a direction randomly, sometimes even rendering the game controls disabled.

    Am I missing some setting somewhere or is my code not quite right? I'd really appreciate some help. I've spent weeks on this and just can't seem to crack the problem.

    Link to my capx file

    drive.google.com/file/d/0B-jb1QwWydW_b3lqVmx6R1NBV28/view

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It is well known that issues occur when you mix behaviors that are not designed to work together, for instance, from the manual:

    [quote:2n7ilcl1]Physics won't respond to objects with the Solid or Jumpthru behaviors. These behaviors are totally redundant when using Physics and have no effect. Instead, use the Immovable property.

    Also

    [quote:2n7ilcl1]...setting an object's position or angle will cause Construct 2 to teleport the corresponding object in the physics simulation to the object's new position, which does not always properly take in to account collisions. The same is true of using other Construct 2 behaviors at the same time as Physics.

  • It is well known that issues occur when you mix behaviors that are not designed to work together, for instance, from the manual:

    [quote:2e77ghnx]Physics won't respond to objects with the Solid or Jumpthru behaviors. These behaviors are totally redundant when using Physics and have no effect. Instead, use the Immovable property.

    Also

    [quote:2e77ghnx]...setting an object's position or angle will cause Construct 2 to teleport the corresponding object in the physics simulation to the object's new position, which does not always properly take in to account collisions. The same is true of using other Construct 2 behaviors at the same time as Physics.

    Thanks for the reply. I'm fairly certain it's not an issue related to physics combined with jumpthru behaviors. I've tried versions of the control system that don't use physics at all and still get this random movement that appears to be related somehow to both the player and the boxes having platform behaviors (that's my best guess anyhow).

    It's like, once pinned the box inherits some movement from the player which can't be turned off.

  • Note that the problem that I'm having is still present if you remove all the physics from my capx file. The only reason for the physics is so I don't have to do any coding to give the player the ability to push the boxes around.

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