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

Get help using Construct 2

Post » Mon Sep 14, 2015 6:54 am

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
https://drive.google.com/file/d/0B-jb1QwWydW_b3lqVmx6R1NBV28/view?usp=sharing
B
4
Posts: 3
Reputation: 206

Post » Mon Sep 14, 2015 7:09 am

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

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

...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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,374
Reputation: 58,430

Post » Mon Sep 14, 2015 7:32 am

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

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

...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.
B
4
Posts: 3
Reputation: 206

Post » Mon Sep 14, 2015 10:34 am

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.
B
4
Posts: 3
Reputation: 206


Return to How do I....?

Who is online

Users browsing this forum: elafreat, facecrime, Yahoo [Bot] and 32 guests