• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

global variables

  1. H

    GameMaker Timers/Alarms, Switches or Global Variables not working (no error messages)

    I'm incredibly inexperienced with Gamemaker - the code I've used is cobbled together from tutorials and the like. I don't know what could be wrong. In the game I'm making, the player is moving into a haunted house. A ghost doesn't want them to so they're throwing furniture at them. I'm trying...
  2. edmortis

    GML I broke gravity (on my swimming engine)

    I used the Shaun Spalding tutorial so it's really simple, I've just modified it for my own purposes. The object you're controlling is supposed to jump and sink back down until it hits the "y" value of another object, but as of right now the Player Object just floats off into space. x =...
  3. Starplanet01

    SOLVED GameMaker is wanting a variable that does not exist to be set.

    A few months ago, I'd been working on a roguelike dungeon crawler sort of game. Although progress was going smoothly, I decided to take an extended break so I could focus on other personal activities. When I came back, after updating the runtime, suddenly the game doesn't want to run for an odd...
  4. R

    SOLVED Global variable not working

    I have an issue where a global variable seems to be bugged. if (global.left_door_open) = true { image_index = 1; } The global.left_door_open variable is defined in another object and is in the room that i need it to be in. The variable works, and there are no errors in other things where i...
  5. jpegsunshine

    Player Spawning issues with Checkpoint system.

    I sort of solved my problem? I need help understanding. I followed this tutorial to make a checkpoint system in my platformer game. After implementing everything word-by-word, I realized my player wasn't spawning in the spot I designated them to -- instead, they were spawning with the position...
  6. KyleRansford

    How to Skip a For Loop Check for a Player not Using a Gamepad?

    Hello, I have a Async gamepad for loop check that checks for connected gamepads and assigns them to one of four player objects. What I would like to do is for the for loop to skip checking for a gamepad if player 1 is just using a keyboard. Since if I left it the way it is, if player 1 is using...
  7. otterZ

    SOLVED Best Practice For Initializing Global Variables Whilst (almost) Simultaneously Reading Them From an INI file?

    What is the best practice for initializing global variables when also (almost simultaneously) reading them from an INI file? For example, I have an object called 'obj_first_room_controller', where I am initializing global variables at the start of the game in the Create Event. I also have code...
  8. T

    Global variable within global variable

    Hello, I would like to set a global variable in another global variable like below. I need to set different variables according to the number of the instances and store the location of each instance. Let's say there is only one instance created, global.objlocationx1 will be obj_player.x, then...
  9. flyinian

    Is there any difference between 1 object with all global variables vs. many objects with a few global variables each?

    Pretty much what the title says. 1 object with 1000 global variables initialized on game start VS. 100 objects with 10 global variables initialized on game start. Any difference?
  10. Writerstix77

    GameMaker Coding a combination lock

    I am trying to create a 6-digit combination lock, where once the player puts in the correct combination, an item appears in another room. I have a Combo_dial_obj with 10 index images (0-9). That functions fine as far as scrolling through the numbers when clicked. However, I am having issues...
  11. P

    Game not saving data with Json

    Can anyone help me? I'm about halfway through GMwolfs video and followed the steps but it is not writing any data into the save file. The only adjustments I made to the code were to use my own obj_player instead of the circle he gives in his sample and I left out the color index because I only...
  12. Zahk

    GameMaker Keeping variables between rooms - only Global Variables and Persistent Objects?

    I'm trying to do something very simple - I want to talk to an NPC, and then have them say something else after you talk to them the first time, even after you leave and return to the room they're in. Now I know I can keep track of the variable that changes this with a Global Variable or by...
  13. W

    GML Visual [HELP] Money error/glicht doesn't shows

    Hi, Im doing one of my clicker projects and i was doing small cutscene and i did it and it worked but somehow i cant add money... its really hard to explain but... (warning my names are weird) I have new object named : MONIESSS inside of it there is draw event and inside of draw event there is...
  14. Macro deVoid

    GML Passing values to new object instances

    This has been bugging me since I took up GML about a month ago, and looking for advice or suggestions on best practices. I have a spaceship game, and so far all it does it break asteroids up. The ship shoots a missile that collides with the asteroid, reduces the asteroid's health, and triggers...
  15. Nixxi

    UWP [Resolved] Having trouble creating/initializing global variables

    Hello GameMaker Community. I'm having an issue with creating global variables for sharing information between the players, game objects, and ini reading/writing. Part of the problem is that my game has a max of twenty (20) save slots, each slot has roughly 5,200 individual datapoints (for...
  16. M

    GML [solved] turn based strategy game giving me minor problems

    Each player can move two objects per turn. The first object to move can not move even when it is that players turn The second object moves just fine once that players turn comes around. This leads me to believe that the code below is not being referenced by the first object moved and only the...
  17. Pfap

    Global variables

    Is there a place to initialize global variable for debugging and testing purposes? I read some of the other posts about having an initialization room before the game starts, but right now my rooms aren't in order. If I just always start debugging from that room it messes up the order of my non...
  18. P

    Legacy GM Solved: place_meeting "object" argument scope

    Alright so how can I use place_meeting to reffer to a bunch of objects for example as I want to store a lot of objects in an array so lets say I make something like globalvar objects objects[0] = obj_npc1 objects[1] = obj_npc2 and if i have place_meeting with both objects, it should trigger the...
  19. S

    Legacy GM Global Variable Not Set Before Reading It

    I have a controller object (obj_controller), in which I initialize my global variables. In the Create event of the controller object, I have this line to initialize the global variable of global.player_color: global.player_color = "purple"; I also have a player object (obj_player) that has...
Top