I'm creating an rpg-like combat system, and I am currently attempting to make the "fastest" participants in a battle move first. To do this, I have given each entity (Both player/party and enemy characters) a "speed" variable, but I don't know how to make it so that $turn1 is equal to the enemy with the highest speed, $turn2 is equal to the enemy with the second-lowest speed, and so on, up to $turn8.
Enemy1, 2, 3, and 4 all have their numbers (enemy1, 2, 3, and 4) stored as variables under their objects, so all I need is a way to assign them to the $turn variables based on the values output by the speed calculations.
Thanks!