VentKazemaru
Member
In pikmin, You can either throw the next pikmin you have in line. Or you can press a button to only throw a specific type. I've been having a hell of a time how to implement this.
In it's basic form. I need to figure out how to select specific and any unit in a group.
ds_queue does work initially. But then you can't sort through units. you can only select the one at the head.
ds_priority queue only works at the beginning or end. you can select unit group 1 or 3, but not 2.
Right now I'm trying to figure out how to use ds_grid to map out the units. but now I can't get the size of the group easily.
ds_list doesn't work with objects.
create event
step event
this is about as far I got with using grids. I can figure you can search for units within the grid.
But then you have to move down all the units to fill the space left. which I can't grasp.
this is just testing code for now.
What's the best way to do this?
In it's basic form. I need to figure out how to select specific and any unit in a group.
ds_queue does work initially. But then you can't sort through units. you can only select the one at the head.
ds_priority queue only works at the beginning or end. you can select unit group 1 or 3, but not 2.
Right now I'm trying to figure out how to use ds_grid to map out the units. but now I can't get the size of the group easily.
ds_list doesn't work with objects.
create event
Code:
dragonline=ds_grid_create(10,100)
for(var i=1;i<101;i++)
{
dragon=choose(oEarthdragon,oWaterdragon,oFiredragon)
this= instance_create_layer(x,y,"instances",dragon)
this.position=i
ds_grid_add(dragonline,0,i,this)
}
Code:
//throwing action
if mouse_check_button_pressed(mb_left)
{
switch(hand)
{
case 0:
//get the first dragon in the queque, doesn't matter what's there
var thisdragon =dragonline[# 0, 1]
thisdragon.action=dragon_hold
break;
case 1:
//only get earthdragons
for(var i=1;i<101;i++)
{
if dragonline[# 0,i] = oEarthdragon
{
dragonline[# 0,i].action=dragon_hold
//
}
}
break;
}
}
But then you have to move down all the units to fill the space left. which I can't grasp.
this is just testing code for now.
What's the best way to do this?