Objects with Platform behavior change their movement speed as the camera pans

0 favourites
  • 7 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • If an object is moving one way, moving the player such that the camera pans in the opposite direction makes the object move faster. Likewise, if the camera pans in the same direction as its movement, it speeds up.

    Is there a way to prevent this, and to make it move at a constant speed regardless of the camera?

  • They don't speed up or slow down, the speed just seems different because the screen is scrolling.

    If you want them to move at constant speed relative to the screen, you can put them on a layer with zero parallax.

    By the way, if you have Platform behavior on snakes, you should use Platform actions to move them, like "Simulate control". "Move forward" and "Move at angle" are not Platform actions and may not work very well.

    Also, when moving something on every tick you should use delta time. Currently your snakes will move at different speeds on monitors with different refresh rates. If you run the game on a 240hz monitor, they will move 4x times faster.

  • Putting them on a layer with zero parallax does not seem to have worked. Additionally, if I move them with Simulate Movement, won't that mean I can't control the player independently of them?

    Here is a link to my project; the relevant layout and event sheet are labeled "InGame2".

  • To add some more details:

    I don't think it's the case that the snakes moving faster or slower are just an illusion caused by the screen panning. In my case, the snake takes less time to move across an area when the screen moves with it than when the camera is standing still.

  • Don't use zero parallax then.

    The snake movement with 100% parallax looks correct to me. It definitely moves at constant speed.

    But you must use delta-time, or "Simulate control" action!

    construct.net/en/tutorials/delta-time-framerate-71

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can confirm that the snake moves at a constant speed using a layer with 100% parallax and multiplying the Move To by delta time.

    Although I'm still not sure of how I would implement the Simulate Control action, given that the player character also has that. I'll look into the documentation to see if there's something I'm missing there.

    Regardless, thank you very much for your help!

    EDIT:

    Quick answer to my own question:

    Simulate Control works when you do the following:

    1. Uncheck "default controls" in the object's platform behavior properties.

    2. Make sure the object has not been set in the event sheet to ignore user input.

    I may have to fiddle with custom controls to make it as good-looking as Move To, but it does work!

  • "Simulate control" should work even if default controls are enabled. And it doesn't affect all objects with Platform behavior. If you use "Enemy Simulate Control", it would only move the Enemy sprite.

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