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!
Develop games in your browser. Powerful, performant & highly capable.
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