Tabs or vector in GMS

  • Thread starter pierrelouis.gaucher@gmail
  • Start date
P

pierrelouis.gaucher@gmail

Guest
Hello,

I would like to create in GMS something which looks like a vector in C++ or a tab/boards in C. I have to store some variables of each of my rooms and I currently don't know how, is there any function that gives me this opportunity ?
Something which allows me to do a piece of code like this in C++ to catch a value like this : previousRoom = room[ i ] ?

Thanks all and sorry for my english :) trying my best I promise
 
P

pierrelouis.gaucher@gmail

Guest
What's an array ?
I find my previous room like this : in each room I have a warp which teleport my player in another room, and when he stands on the warp, the player receive : the next room ( on which he's going to be tp ), the coordonates on which he's going to be tp, the name of his current room and the coordonnates where he starts the current room.

I use this because in my plateformer i want my player to come to the previous room when he dies but imagine i'm in room 5, i die : my player is back to room 4 but when now i die in room 4, my player stays in room 4 because i don't have a vector as in C++ which allows me to store all previous from each rooms
 
P

pierrelouis.gaucher@gmail

Guest
Ok I searched on internet it looks like what I need is arrays so I'm going to learn how to use them, thanks !
 

kburkhart84

Firehammer Games
If I remember correctly, an std::vector is the same thing as a ds_list. GM has various data structures such as lists, grids, and maps. Arrays here are similar to arrays in C++ in many ways, but they don't have the same features as the data structures do.
 

Nidoking

Member
Much closer to a ds_list would be std::list. std::vector is pretty much exactly a GML array, since GML arrays dynamically resize as you set values outside the range.
 
Top