class and object in games

Page 5 of 5
SOME OTHER LITTLE THINGS
Some things to tell you.
- I've got two other function. Those one are placed before the MyShip class.
Stage.scaleMode = "noScale"; //user cannot resize the movie.
/*************************************/
/******FONTIONS GENERALES*************/
/*************************************/
/*************************************/
function initvar () {
present = 0; //number of still here missile
newtime = 0; //newtime
oldtime = 0; //oldtime
tempsTir = 400; //time between each fire
_root.createEmptyMovieClip("Suiveur", -1); //clip which contain all the clip which have to follow the SpaceShip
}
/*************************************/
//This function is use both by missile and Spaceship.
function checkcolision (porteur, objet, MonDecor) {
//check all the wall in the active part of the scnenery
for(h=1; h<=MonDecor["L"+porteur.ligne+"_"+porteur.colonne]["maxmur_"+porteur.ligne+"_"+porteur.colonne]; h++) {
if (objet.hitTest(MonDecor["L"+porteur.ligne+"_"+porteur.colonne]["mur"+h])) {
// if the object touched a wall go to the label explose
objet.gotoAndStop("explose");
// the object isn't "alive".
objet.Vivant = false;
}
}
};
- You can see that I put at the begining of the scene a var named niveau which give me the last depth. In that case I avoid deleting some MC.
- You can see that i have a little preloader after the call of the function LoadDecor. This is to wait for the var of the text file, because if the script continue to play, some properties of the objetc created with the MyShip class will be wrong.
- You have to init your objetc, like this
//Init the global var
initvar();
//Init the var of the vaisseau, with parameter.
vaisseau.Init(38, 37, 39, 78, 32, 300,300,0,8);
//Init the var of the vaisseau but for the weapon system
vaisseau.InitArmes(-1,0,10,0,0);
//Swap the depth of the different object. All be in place now!
decor.swapDepths(-5);
vaisseau .swapDepths(-4);
menu.swapDepths(-3);
carte.swapDepths(-2);
grille.swapDepths(-1);
stop();
THAT'S ALL
If you have some remark, or feedback plz mail me to

