2

Using the image_xscale that increases every time an object collides with a certain object, how can I make its speed go down using the increasing image_xscale? An example would be in agar.io, where circles slow down as they get bigger. What equation using the image_xscale would I use for this?

I've tried things like this:

speed = image_xscale * -speed

but that doesn't work. Any ideas?

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
jdejde
  • 45
  • 6

1 Answers1

1

You can use something like:

speed = start_speed - image_xscale * k;

where start_speed is your normal speed, without slowing.

and k is value which will define slowing factor.

Also you can add max() for define minimal possible speed (for speed can't equal to 0):

speed = max(1, start_speed - image_xscale * k);
speed = max(1, 10 - image_xscale * 0.5);
Dmi7ry
  • 1,777
  • 1
  • 13
  • 25