Parallax scrolling in direction of movement

  • Currently, I have a scrolling starfield in my space game that moves from right to left across the screen. This effect is nice, but I want something more immersive: I want the starfield to scroll in the opposite direction of the player movement.

    For example, when the player ship moves up on the screen, the starfield will scroll down at some speed (there will be a speed cap for the scrolling).

    Does anyone have ideas on how this would be done?

  • Currently, I have a scrolling starfield in my space game that moves from right to left across the screen. This effect is nice, but I want something more immersive: I want the starfield to scroll in the opposite direction of the player movement.

    For example, when the player ship moves up on the screen, the starfield will scroll down at some speed (there will be a speed cap for the scrolling).

    Does anyone have ideas on how this would be done?

    I think that would depend on how your scrolling your starfield. Lets say you set your starfield background as a bullet. If its set as a bullet you can change its bullet angle of motion to the direction of the player, then have it respawn in the same angle as the bullet angle of motion.

    Honestly, I'm not to sure either but I thought I could pop up some idea in your mind. I may try to figure out how by this weekend unless you get a better response to answer your question

  • I believe the solution is actually really simple. I just had a really long Spring Break and wasn't back into the C2 mindset of things again.

    Basically my starfield is currently scrolling in one direction. It's simply a matter of setting the scroll direction to equal the player ship angle - 180 every tick.

    However, I'm not sure if every tick is a good way to go about it. There could be performance issues with using that fast of an update.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tried using bullet, but the problem is that behavior causes the starfield to rotate when the angle of motion is changed. I replaced bullet behavior with CustomMovement and now it seems to be working.

    Now I need opinions on smoothing this out. You can play the latest version of the game here. Please let me know if the effect is too fast or too slow!

  • Trigger it on the key press that the player uses to change the ship direction, or whatever events are related to the ship changing direction...

  • The background layer, or any layer properties (top left when you select a layer) has parallax values, set them 30,30 and see what happens.

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