Trouble with Paddle Mathf.Clamp

good evening guys I am currently programming a brick breaker, my concern is as you can see when my paddle receives an instantaneous block which allows it to grow / decrease it takes effect except that the mathf.clamp of my paddle keeps the same limits as the normal paddle what should I do please?

Hi,

Modify the clamp values when your paddle is “large”. You could use an enum to define paddle states such as “large” and “normal” and whatever you need. Look enums up on DotNetPerls. Depending on the state of the paddle, you use the “normal” clamp values or the “large” clamp values.

Hopefully, this helped. :slight_smile:

problem :slightly_smiling_face:

Hover your mouse over GetXPos. I assume one cannot call any methods (or non-static methods) in an enum. An enum is just a collection of “tags” so to say.

Define the min/max values or whatever this is at the top of your code and use the enum to determing in Update which minX and maxX values are supposed to get used. Do not clamp the value range because you need to define edges. In Update, you use the min/max values and clamp the position of the paddle.

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

Privacy & Terms