1
$\begingroup$

This is a game development question related to math. Apologies if I shouldn't be asking this here, but I'm not good at math and need help with increasing the speed of my game.

I have one number responsible for the speed at which the screen appears to be moving horizontally. It's 80 (screen points).

The other number is 1 (second), and it dictates the time it takes an object to move a set vertical distance.

Increasing the 80 number will increase the horizontal speed, and decreasing the 1 number will increase the object's vertical speed.

After each level, I'd like to increment 80 and decrement 1.

Is there a number that I can increment 80 by, and a number I can decrement 1 by, so that both speeds remain the same, relative to each other? If not, what would be the best numbers I could use so that it isn't too apparent that the 2 speeds have gone out of sync? If this is the case, the vertical speed would need to be getting faster than the horizontal.

Ideally, I'd like to get as close as possible to incrementing by 1 and decrementing by 0.01.

Thank you for any help you can give.

Edit: I'll go into more detail. The vertically moving object moves up and down indefinitely. Obstacles are spawned at a regular interval that move past the object at the horizontal speed (80). I have the two speeds set up so that the object moves up and down a certain amount of times between each obstacle, so that the player can fairly navigate the gaps in the obstacles.

So both speeds need to increase in harmony. Or the horizontal speed will get too fast for how quickly the object moves up and down, making it impossible to navigate the obstacles. Or the vertical-moving object will move too fast compared to the rate obstacles are moving past it, making the game easier. The latter being the preferred option, with 1 decrementing more than 80 is incrementing.

$\endgroup$
  • $\begingroup$ I'm a little confused - what do you mean when you say you want the speeds to remain the same relative to each other? $\endgroup$ – Peter Woolfitt Mar 30 '16 at 3:30
  • $\begingroup$ What are the speeds corresponding to 80+x and 1-y? $\endgroup$ – steven gregory Apr 11 '18 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.