I need to create a new instance of a class from an array of class objects like this:
static Class[] spells = {Fireball.class, Iceball.class};
So when I want to call the fireball i should be able to do something like
Spell Currentspell = new spells[0](posx, posy);
Fireball and Iceball is by the way child classes of Spell.
How do i do this?
Thanks in regards.