Click feedback issue

4.3 Godot Version

Question

I’ve created a simple clicker game and want to add feedback when players click something. My idea is to have the object scale up then back down, and while this mostly works, if a player clicks fast enough, the sprite will become massive. Any ideas on how to make this work?
image
image

Can you not just clamp the scale to the min and max values you want to allow?

shrinksprite.scale.x = max(minimum_allowed_scale, shrinksprite.scale.x)
shrinksprite.scale.x = min(maximum_allowed_scale, shrinksprite.scale.x)

or

shrinksprite.scale.x = clamp(shrinksprite.scale.x, min_value, max_value)

Or you can set a flag saying “character_is_scaling” to true, and if they click again while that is still going on, don’t allow further scaling until it has finished with an “if character_is_scaling:” test on click. You can set the flag to false once the scaling up and down is completed.

I think the clamping would work best though, but rapid clicking will keep the character large, I suppose it depends how you want the mechanic to work.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.