Returns a value clamped between the specified minimum and maximum.


GML Code Example

clamp(val, min, max)

Argument Description
val The value to clamp.
min The minimum value to clamp between.
max The maximum value to clamp between.

Returns: Real.


With this function you can maintain an input value between a specified range.


GML Code Example

speed = clamp(speed, 1, 10);

The above code will clamp the speed so that it never falls below 1 or goes over 10.

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here