FMS various questions topic

F

FMS

Guest
hello, im very new at this, so i know i will have many questions along the way, so with this topic i'll just post a new question ito bump it instead of creating endless topics, if u guys dnt like that just edit it and i'll start opening topics lol.

So todays question, i wanna build something like this

item_1 item_2 item_3 item_4
item_5 item_6 item_7 item_8
item_9 item_10 item_11 item_12

and then with a swipe (mobile) replace all those items with new ones, over and over.

i know the best way to go about it is a 2d array, from what i can gather in the documentation and otehr sorces, issue is, i cant figure out for the life of me how to even start it. or maybe a ds_list, i sure as hell been trying and the more videos i watch the more confused i get, everyone has their special own way of implement it and i end up lost.

Care to give a hand? maybe post an old code u have laying around so i can try to figure it out? thanks.
 
Q

Quinnlan Varcoe

Guest
It's hard to help as this post is poorly worded.

Are you asking how to make an array?
 
D

Dramier

Guest
It's hard to help as this post is poorly worded.

Are you asking how to make an array?
I believe he is developing basically an inventory GUI system to be used on a mobile platform, such as a smartphone or tablet touch screen. He wants to have a grid of items and you swipe left or right on the screen to move to more pages.

FMS, if that is correct please let us know. In the meantime, have you looked at the Gamemaker Studio documentation on DS Grids? Here's a link:

https://docs.yoyogames.com/source/dadiospice/002_reference/data structures/ds grids/index.html
 
F

FMS

Guest
@Dramier, you're almost there but not quite, lets say u have a character, that char can equip diferent weapons, accessorys ets, i want to create a table with 5x items on the x, with additionaly 3 rows wich we can aply to that char,we could choose them by drag and drop, that is done, my issue is actually creating the table, the 2d array, or ds_list since its teh same(?) but more robust.
hopefully the pic says it better, yes i've looked at that and youtube videos, the more i try to understand the more confused i getexample.jpg
 
D

Dramier

Guest
Ok, I will give you a quick and dirty example for how I prototyped an inventory using this kind of system.

First I decided how many rows and columns the display would have. Then I created a ds_grid to hold the information. Something like so:

grid_inventory = ds_grid_create(7, 5);

This gave me an "inventory" that was 7 across and 5 down. Then to assign items to the slots I created an inventory object. This object would then display sprites of the inventory by using a for-loop to go through the grid which held the instance id of each item.

When I wanted to remove an item from inventory, say I clicked on the first item in the list and dragged it to the ground. I would set grid_inventory[# 0, 0] = noone. That would clear it. I didn't get to multiple pages, but the theory is the same.

Does that help at all?
 
F

FMS

Guest
yes,and no, after work im going to fiddle with it again, where the for loop gets the instance id from? doesnt need to be stored somewhere?

grid_inventory = ds_grid_create(7, 5)
ds_grid_add = then i put stuff here? this is where the for loop reads the id's from? if its say 50 items i need to list them all here?

if the above is correct still need to find the coordiantes to display it, is it done within the for loop? man im confused lol. also to create the grid, should it be on scripts or other location?
 
Top