Game maker studio 2 disable animation loop

broken image

Persistent object: you can make your object obj_Global_Variables persistent.Otherwise, you can put an instance in charge of declaring them in its Create Event, and make sure such code script is executed only once. You can declare them in the Game Start Event of the very first instance created in the very first room ran in your game. This way, they will be accessible by any instance of your application, and won't be reinitialized until you close and reopen your game manually, or the function game_restart() is executed. Global variables: instead of having your food, stamina, and other variables declared in the Create Event of obj_Global_Variables, you can make them variables of the special object global.

broken image

If you don't want such variables to be reinitialized every time the room starts, you can try two different approaches: That means, as it occurred to you, that every time the object is instantiated, its instance variables are set to their default value.

broken image
broken image

When you declare and initialize a variable in the Create Event of an object, such variable is not a global variable, but an instance one.

broken image