I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: MatthewRPG on October 18, 2016, 03:07:58 PM

Title: "clamp" code not working?
Post by: MatthewRPG on October 18, 2016, 03:07:58 PM
(httpss://puu.sh/rNpMb/9eca2b5cf0.png)
this is so strange to me because this code was working, but whenever i moved to a new pc it suddenly stopped working. any ideas for help?
EDIT: since no one is responding, can someone just give me code to replace clamp?
Title: Re: "clamp" code not working?
Post by: Lulu49_ on April 28, 2018, 12:28:02 PM
(httpss://puu.sh/rNpMb/9eca2b5cf0.png)
this is so strange to me because this code was working, but whenever i moved to a new pc it suddenly stopped working. any ideas for help?
EDIT: since no one is responding, can someone just give me code to replace clamp?

If you have gamemaker 8.1 or gamemaker 8.0, the "clamp" code does not work... but you can still make a code to replace it, here is the code :

Code: [Select]
min = 0 //remplace 0 by the minimum value
max = 10 //remplace 10 by te maximum value
val = speed //remplace speed by the value you want to clamp

if val < min
{
      val = min
}

if val > max
{
      val = max
}