FFNX Sec
FFNX Sec

Reputation: 9

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

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

Upvotes: 0

Views: 556

Answers (1)

YellowAfterlife
YellowAfterlife

Reputation: 3192

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

Upvotes: 0

Related Questions