I'm trying to make a matchmaking interface
The player and the enemy will take turns picking soldiers(sprites) from a list of available soldier
I want the list to change its order in a way that the better pick goes first (left to right top to bottom)
I've managed to set the parameters of each sprite by adding instance variables.
I do not know how to create this dyanmic list that can modify the order of the sprites according to the conditions ill give it..
You need to use System For Each (ordered) event.
System For Each Soldier (order by Soldier.attackDamage) descending -> Soldier set position to (X=50+loopindex*100, Y=500)
This will arrange Soldiers on the screen by their attack damage, strongest first.
Hi, thanks a-lot, im still new to this so im not sure to which system you're referring too ill be extremely happy if you can elaborate thanks!!!
In the event sheet click "Add event" -> click System -> select For each (ordered)
Oh you meant that , cool ive managed thanks alot, only problem now is that my sprites leave the screen, instead of creating a list (left . to right and top to bottom) its just left to right, any solution for this?
Develop games in your browser. Powerful, performant & highly capable.
I didn't know how you wanted to arrange your soldiers.
If you want a grid with 10 soldiers in each row, you can do this:
System For Each Soldier (order by Soldier.attackDamage) descending
....Set posX to (loopindex%10)*70
....Set posY to int(loopindex/10)*70
....Soldier set position to (X= 50+posX, Y=50 +posY)
Or you can put invisible "placeholder" sprites to where you want to place your soldiers. And then set position to (X=placeholderSprite(loopindex).x, Y=placeholderSprite(loopindex).y)