mercredi 4 mars 2015

I need help about "classes" in action script 3?


I have a basic knowledge of action script 3. Now days, I study "classes" to make a game of shooter, bullets and enemies. Actually, I have more than one question :


I know that there is many types of variables such as : Number , Array , Int , string and so on ... but Why is the type of these variable different ? I mean it's not normal for the type of a variable to be Title , Hero , ScoreBox , Enemy1 , Bullet


Why do we make some special types like those? and Will they contain numbers or strings or something else ?


Here is a sample of the code :



//assets
public var buttonstart:ButtonStart;
public var gametitle:Title;
public var hero:Hero;
public var scorebox:ScoreBox;
public var enemy1:Enemy1;
public var bullet:Bullet;
public var gameovermessage:GameOverMessage;


What is the function of the following codes ?



enemy1=new Enemy1;
addChild(enemy1);




Aucun commentaire:

Enregistrer un commentaire