Anyway today i am going to be teaching how to use a ds list and play
with its functions. you might be able to make a text based menu out of it using a ds list(this is kinda easy to accomplish). You
might think im just going to teach you how to make a ds list ONLY but
im really going to teach you how to use and teach you
the basics functions for a ds list. Ok here we go
Playing with numbers

The first thing you need to do is create a ds list. I will use list
but you an use anything. Create an object and name it obj_numbers
(name it what ever you want.)
Create event
list = ds_list_create()
What ds_list_create() does is create the list so we can use
it.
Now we need to add values like you would do in an array. For this you
will use the function ds_list_add()
Create event
list = ds_list_create()
for (i=1; i < 10, i+=1)
{ds_list_add(list,i)}
currentNumber = 0
Easy right? What this does is add a value up to ten. if you are
wondering why that currentNumber = 0 is there it's because
we are going to use that variable to cycle through the values!
In the object step event please put this code.
Step event
if (keyboard_check_pressed(vk_left) && currentNumber !=0)[/gml
[gml]{currentNumber-=1}
else if (keyboard_check_pressed(vk_right) && currentNumber !=

{currentNumber+=1}
if (keyboard_check_pressed(vk_space))
{ds_list_shuffle(list)}
if (keyboard_check_pressed(vk_control))
{ds_list_sort(list,1)}
What all this does is that when you press SPACE all the values will randomize or move to different positions, that is why i use ds_list_shuffle(list).What ds_list_sort(list,1) does is sort them in ascending order meaning valuse going up!.
Draw event
draw_text(room_width/2,room_height/2,ds_list_find_value(list,currentNumber))
This draws the values
this is pretty much the basics to a list or ds list. I will put an example showing a menu made with a ds list.
you can contact me via pm on this site
email: thetutorialify@yahoo.com
yoyogames: argenisxd
gmc(game maker community): argenisxd
yoyogames
gmc
Comments
Loading comments...