How to declare a variable only once in Gamemaker Step function?

466 views Asked by At

Screenshot

I want the variable maxx to only update once when calling this script and all the other lines of code every frame , please help

1

There are 1 answers

0
YellowAfterlife On

You could either:

  • Declare the variable in Create
  • Structure the script so that it is called in Create to initialize it and then in Step to use it
    (an optional argument or lack of arguments for a reasonable solution, event_type for a hack)
  • Use variable_instance_exists provided that you are not using an ancient version of GMS1