[help] How to clamp a variable?

About advanced scenes, and the Thyme scripting language used in Algodoo.

[help] How to clamp a variable?

Postby vekenti » Mon Mar 16, 2015 11:20 pm

How would i go about clamping a variable? I want to clamp it so that it does not go past 0.4, and does not go under 0.10. Didn't see a clamp command in the Command/Variable list.
vekenti
 
Posts: 13
Joined: Sun Jul 13, 2014 4:43 am

Re: [help] How to clamp a variable?

Postby Kilinich » Tue Mar 17, 2015 4:22 pm

usage:
clamp(x, min, max)

example:
a = clamp(a+1, 0, 10)
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 15 guests

cron