addchild(enemy) returning null. Solved, final quick effeciency question page 2

29 posts

Flag Post

By base class I was referring to what you want to extend.

So what were you extending in the first place?

 
Flag Post

a movieclip. I may not be understanding what you’re asking

 
Flag Post
Originally posted by BluePriest:
@Aesica- IVe never done anything aside from classes extending a specific movieclip. How would the coding work for this? public class enemyclass extends ????? ? Im not sure what I would have it extend. And then have the specific enemy ships be public class enemyship5 extends enemyclass Im guessing that the specific enemies would extend the enemyclass.

It’d pretty much work like this:

public class EnemyShipTemplate extends MovieClip
{
// code and properties common to every enemy ship goes here
}

And, for specific enemies

public class RedEnemyShip extends EnemyShipTemplate
{
// code specific to ships that blow up go here
}

You’d do the same for any other enemy ships. Anything in EnemyShipTemplate that you didn’t declare as private is automatically accessible to things that extend it, just as functions like addChild are automatically accessible to anything that extends MovieClip.

 
Flag Post
Originally posted by BluePriest:

a movieclip.

Then why are you unsure about what you should extend now?