jdejde
jdejde

Reputation: 45

Use image_xscale to slow down speed GameMaker Studio

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?

Upvotes: 2

Views: 516

Answers (1)

Dmi7ry
Dmi7ry

Reputation: 1777

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);

Upvotes: 1

Related Questions