• 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!

arrays

  1. W

    GML Functions: Returning an array every step VS. returning values with multiple function calls

    Is returning an array from a function each step performant? Say I wanted to have my collision checking function checkCollisions(checkX, checkY) return an array storing 2 values, x and y, each step... would this be costly? Something like: var collision = checkCollisions(true, true); At the...
  2. T

    GML Help with Arrays

    Well, in my game I am using signposts to show texts whenever my player is colliding with them. But instead of using a uniqe object for every text is it a good idea to use arrays to store different values of the signpost identity ?I was thinking of something like. if(textshow == 1 && signpost_id...
  3. aereddia

    Legacy GM Array changing when it shouldn't

    So I have two arrays that should basically be the same. They are set up the exact same way, but should store different data points at specific times. They both track if an object has been destroyed in a room, but one array is global and the other is stored on the player. When the object is...
  4. W

    GML Storing multiple things in a single 2D array grid (+bonus quad tree question)

    I have a 2D array grid that's used for collision checking. At the moment, it just stores walls as either "true" or "false". The game also has slopes which are collision checked using a with loop. I'm now looking to put those slopes (and future things) into the same grid. The slopes can be any...
  5. D

    GameMaker Need help understanding arrays

    Hey guys, If someone has a resource they can point me towards that will help me understand the way GML handles arrays that would be amazing! Unfortunately right now the more I try to use them the more confused I get. Here's some code that I'm running as tests along with the output and my...
  6. aereddia

    Legacy GM [Solved] Trouble With Arrays

    So in my game, I'm trying to get the ID of all the enemies in the room and store them in an array. Then, I check their placement to see if it matches my criteria, and if it matches, use that ID's information for the next section. The problem is, I'm not very familiar with arrays and have...
  7. MicroKiss

    Legacy GM data won't save in arrays /SOLVED/

    Hey there, I have a game where I need to save a lot a coordinates so i was thinking to do it like this : I shoot 1x1 object and when they meet the wall they use this code global.array[array_height_2d(global.array)+1,0] = x; global.array[array_height_2d(global.array)+1,1] = y; instance_destroy()...
  8. X

    Storing persistent Stats, Skills, Inv for multiple chars

    I'm making a Turn-Based Strategy RPG. In it, I have 4 (currently, will possibly increase to 5) main characters. The stats get pretty complicated -- as in, there are a lot of them! -- and so do the skills. Currently, I store all of their stats as variables within the character objects...
  9. D

    GameMaker [SOLVED][HELP][CODE AND DND WELCOME] If brush1 = true {set rest false}

    And it goes on for other brushes too OR, should I use an array for selecting which brush im using (making a game where you paint using sprites) I dont wanna do this: if(brush1 = true) { brush2 && brush3 && brush4 = false //ect... } Also, If I was to use an array to make it easier (I want...
  10. M

    Arrays overwriting other arrays

    I wrote a huge portion of code using arrays, without understanding how the pointer system worked. Now I'm left with a tangly mess that I don't know how to fix. I've narrowed my issue down to the exact line where it occurs. And that's where I overwrite an array with a new array. When I do this...
  11. Shadow64

    GameMaker [SOLVED] Markov Chains, Data Structures, and Multi-Dimensional Arrays

    Hi there, so recently I've become pretty fascinated by the idea of Markov chains and text generation in general. I've looked over multiple tutorials and methods of creating such a text generator in other languages and none of them seem possible in either version of GMS. I could just be reading...
  12. M

    GameMaker variable_instance functions not working with arrays?

    In my game I'm trying to use a obj_Game object to keep track of arrays of variables for players. Each player is defined as a macro: PLAYER1 is 0, PLAYER2 is 1 (this allows, among other things, PLAYER1 to refer to the 0th controller port.) so obj_Game.playerScore[PLAYER1] is where player 1's...
  13. K

    Is there a way to sort 2d arrays ?

    Hi, I have a 2d array that holds information of an entire league of sports teams : globalvar base; //team 1 base[0,0] = "team 1"; //team name base[0,1] = 61; //attack base[0,2] = 65; //defense base[0,3] = 78; //kicking //team 2 base[1,0] = "team 2"; //team name base[1,1] = 59; //attack...
  14. Ednei

    GameMaker Array in GM2 - Code Error (Help)

    I tried to use this code in GM2: var display_number_x = 0; for(var i = 0 ; i < number_of_displays ; i +=1) { if !instance_exists(display_number[i]){ display_number[i] = instance_create_depth(x + display_number_x, y ,-99, obj_display_number) display_number_x -= 5 } } And I got this error...
  15. P

    [SOLVED] Arrays, instance_count and memory leak

    Hello! I've decided to dive straight to the deep end and start making an engine for a 2D procedurally generated RPG. By reading and researching I've been able to overcome all obstacles but now I don't know what to do. I can copy snippets of the code in further posts but let me first describe...
  16. Y

    Windows [SOLVED] Instance_Find Limitations?

    Thought I'd note in advance this is my first forum post, so if I mess up any of my etiquette, please let me know. Thank you. Right. So working on an RTS mining sim inspired by an oldie from my childhood. Long story short, things get mined, resources drop after a set time of accumulative...
  17. A Random Creator

    Legacy GM [Solved] Variable Index [10,0] out of range [10,-1]

    Hey everyone, I feel that I'm pretty experienced with arrays so when I seen this error I thought it would be a simple fix but I can't find the issue! Here is my error: Push :: Execution Error - Variable Index [10,0] out of range [10,-1] - -5._InventoryCraftS(100151,320000) at...
  18. D

    GML Problem with array usage in .ini files

    // SAVE: ini_write_real("game", "item_array_length", array_length_1d(game.item)); for(i = 0; i < array_length_1d(game.item); i++){ ini_write_real("game", "item[" + string(i) + "].type", game.item.type); } // LOAD: for(i = 0; i <...
  19. Fixer90

    How will this script play out exactly? (SOLVED)

    I have created a script command and I am unsure how Game Maker will make it play out. This is mostly a question to find out the science and order of operations of the program. I am currently unable to test whether it works or not. Here's the script command: (scr_example) global.example_a[0] =...
  20. C

    GML [SOLVED] Testing if array is indexed or not

    I'm trying to make an inventory with arrays, but i'd like a way to test if an array's value has already been indexed or not, is there any way to test for this?
Top