The title really says it all. I've got a few actors that need their images to change under certain circumstances. There are multiple iterations of those actors being produced, all the time. At first, I thought to get a list of all the relevant objects in the world, and start from there...
However, the Compiler tells me I cannot cast the lists created into new instances of whatever the actor is... :( Anyway, as always, would be really grateful for an alternate method of changing the images of the Actors from within the world. Thanks for all help and feedback in advance! :)
1 2 3 4 5 6 7 8 9 10 11 12 | if (!getObjects(Truck. class ).isEmpty()){ Truck truck = (Truck) (getObjects(Truck. class )); truck.setImage( "cartoon camel.png" ); } if (!getObjects(Trees. class ).isEmpty()){ Trees trees = getClass(Trees. class ); trees.setImage( "spiky cactus.png" ); } if (!getObjects(Evergreens. class ).isEmpty()){ Evergreens evergreens = (Evergreens) (getObjects(Evergreens. class )); evergreens.setImage( "spiky cactus.png" ); } |