I’ve been trying out small snippets of code just to practice with and get comfortable with making classes and small games.
Right now I am trying to make a simple combat with Orks. Where there is a Parent Class ORK with several ORK children classes like SentryOrk, MetalOrk, etc.
The Ork class basically puts in the many stats used by the ork such as health, strength, vitality, special, luck, etc. And then the children classes modify those like Sentry Ork will have less health and more luck.
I did all that fine, but the problem I have is I want there to be multiple Sentry Orks out with their own defined stats.
Right now whenever I do initiate the attack one out of three orks on the screen, they all share the same health.
I know what the problem is, I just don’t know how to go about dynamically making each class their own?
Do I have to make a whole other class to bring them onto the stage with their stats like create a new class that handles all ENEMY POP UPS? I don’t see how to do that either?:
package locationxxx
{
import com.enemyFolder.*
public class EnemyAppears
{
public function EnemyAppears():void
{
//See I have no clue about this either since how do I pass the VARIABLE of which and how many enemies pop up to make new instances of the class?
var enemy1 = new OrkSentry
}
}
}
That’s just a rough image I have of it, but still, it wouldn’t work.
Any links or help would be really appreciated.