I have a class “Projectiles”, and I want to create an object with it.
To minimise code, I want to specify the object from a string, it would clean up thins alot.
Example:
I have the string,
tempenemy.atktype = @"homing_fireball";
Now i want to create an object with the same name from Projectiles class:
Projectiles *tempenemy.atktype;
Is this possible? So the final result would be an object from Projectiles class called homing_fireball..?
Thanks!!
I doubt that this is possible. But I’m not an expert for the inner core of objective-c.
I would suggest you to store your Projectile in a NSMutableDictionary. You could store the object with a key of @”homing_fireball”. And then you can reference it with something like