How do I change player speed based on screen location ratio

0 favourites
  • 2 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I know there's some handy algorithm i should have learned in school that will probably make this one step.

    But basically i have a side scrolling flying game, and i want the background speed to scroll faster the closer to the right hand side of the screen you move, and slower the closer to the left you are.

    on the far left, the slowest the background should ever move is 30, and the furthest to the right you can move is about 3 quarters the width of the layout, and the background should be moving is 200

    thanks math genius's!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ok i think i figured it out, and it was way simpler than i was thinking it was going to be.

    bg.speed = distance(player.x, player.y, viewportLeft(0), player.y)

    thus, the further the player is from the left hand side of the screen, the faster the bullet speed


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