TheNightStrider wrote...
"How do i cast 'getObjectsInRange(10, Enemy.class)' into an Enemy in a loop ?
for (Enemy a : getObjectsInRange(10, Enemy.class))
{
// code to execute
}"
I am not quite sure what exactly you are trying to do.
Using that
List<Enemy> l = getObjectsInRange(10, Enemy.class);
if(!l.isEmpty()){
for(int i=0;i<=(l.size());i++){
Enemy e = l.get(i);
//do stuff with enemy e!
}}
I think that is what you need to do.
(Hopefully I have written that out right!).
If you need any more info, check out this link HERE
This assumes a lists index starts at 0, not 1.boolean check = false; while(check) //Or if(check == true), they come to the same thing { //This code won't execute } //But this will