Fangames > Programming Questions

"clamp" code not working?

(1/1)

MatthewRPG:

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?

Lulu49_:

--- Quote from: MatthewRPG on October 18, 2016, 03:07:58 PM ---
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?

--- End quote ---

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: ---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
}

--- End code ---

Navigation

[0] Message Index

Go to full version