Character falls behind after each jump

HzeroHzero Member Posts: 2
edited November -1 in Working with GS (Mac)
Hi,

I'm still learning the ropes to GameSalad, and am testing out a simple run and jump scenario. I've poked around the forums, but I wasn't able to find a solution for my problem.

Problem:
Each time my running actor jumps and lands it shifts back just slightly to the left, until it eventually falls behind and out of camera view. I've tried without jumping and the runner moves fine and goes all the way to the end.

My set-up:
- I have a fixed length scene that a running actor is running along at a constant horizontal velocity on top of a ground actor.
- There's no scene gravity. I've set a downward acceleration on the runner to mimic gravity.
- The runner can jump via a mouse click, which sets a jump attribute to true, that sets the Y velocity attribute to some value. Once the runner contacts the ground again, the jump attributes returns to false.
- The runner is kept at about 1/4 of the way from left edge of the viewable screen by placing an invisible "tracking" actor on the right quarter of the screen that has camera control. This tracking actor moves at the same horizontal velocity as the runner.
- Ground and running actor have 0 restitution and 0 friction. Ground is NOT moveable.

Has anyone encounter this problem before?

Thanks for the help!

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    On your player, use a constrain behaviour.

    e.g. constrain self.playerX to 80

    That should do it.

    Cheers,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • HzeroHzero Member Posts: 2
    Thanks for the suggestion QuantumSheep!

    I'm assuming though you meant to say "set self.Position.X to 80."

    But I've actually already tried that before. I think this only works if it was the background scrolling while the running actor is essentially static. What I have is actually an actor running across a finite length of scene. If I constrain self.Position.X to 80, then camera will just shoot out ahead of the running actor.

    Thanks!
    -Hzero
Sign In or Register to comment.