F
foxroar1
Guest
Hi everyone,
I need some help/suggestions for how to tackle AI for a card game.
I'm using a single card object that gets it's image_index (which is used to find it's card number and suit) from a list.
This card object can be moved to 4 different areas in the room.
I believe I want to use an AI object that can compare cards variables and then move it to the next appropriate area.
When a card is created I have its id stored in the array p2picksort[i,0] so I can access everything from the ai object.
But the problem I'm running into is sorting info for comparisons but still knowing which card id each variable belongs to.
Here's an example of my train of thought:
All I've done is add a cards variable cardnum to a list and sorted it in descending order so that first one in the list is the highest cardnum. But then how on earth would I know which card id is associated with that variable cardnum? It's like I've detached important info about the cards but don't know how to associate it back with the correct id.
I just need some ideas or help with maybe a better way to do this.
Thanks!
I need some help/suggestions for how to tackle AI for a card game.
I'm using a single card object that gets it's image_index (which is used to find it's card number and suit) from a list.
This card object can be moved to 4 different areas in the room.
I believe I want to use an AI object that can compare cards variables and then move it to the next appropriate area.
When a card is created I have its id stored in the array p2picksort[i,0] so I can access everything from the ai object.
But the problem I'm running into is sorting info for comparisons but still knowing which card id each variable belongs to.
Here's an example of my train of thought:
Code:
pick=ds_list_create()
if (p2spellpower==0) //if 0 spell power, choose highest spell power card
{
for (i=1; i<=p2pickcards; i+=1) //usually three p2pickcards but not always
{
if (p2picksort[i,0].type==2) {ds_list_add(pick, p2picksort[i,0].cardnum)} //add each card # to list if it's type is spell power. p2picksort[i,0] is the id of each card
}
ds_list_sort(pick,false) //sort in descending order
}
I just need some ideas or help with maybe a better way to do this.
Thanks!