Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function = Lunatic(x,y,grille,ageMin, ageMax, minRep){
- this.x=x;
- this.y=y;
- this.rep= r || 0,1;
- this.minAge= minAge || 10;
- this.maxAge= maxAge || 110;
- this.minRepAge= minRep || 20;
- this.age= 0;
- this.alive = true;
- this.wasBorn= false;
- this.wasKilled= false;
- this.lifeSpan= Helper.randomBetween(this.minAge, this.maxAge);
- this.map=map;
- }
- //reproduction
- if (Math.random() <=0.1) PAS DE BEBE elses BEBE
- Lunatic.prototype.epoch = function(){
- this.x+=1
- grille.isPositionACoteLibre(x,y)
- }
- //ajouter personnages
- lunatics_tab= [];
- for() {
- lunatics_tab.push(new Lunatic (...))
- }
- var lunatic = new Lunatic (0,0);
- grille [lunatic.y][lunatic.x]= lunatic;
- for (var i=0; i<this.epoch; i++){
- mihai.epoch();
- print(dessinerGrille(grille,largeur,hauteur));
- };
- //// ex de mihai pour aider? ////
- /*function Lunatic(x,y){
- this.x=x;
- this.y;
- this.age=0;
- };
- lunatic.protoype.epoch=function(){
- grille[this.y][this.x]= null;
- this.x = this.x++%largeur;
- grille[this.y][this.x]= this;
- };
- lunatics_tab= []; //pour accumuler les nouveaux personnages
- for() {
- lunatics_tab.push(new Lunatic (...))
- }
- //var mihai c un exemple de comment faire
- var mihai= new Lunatic(0,0);
- grille[mihai.y][mihai.x]=mihai;
- for (var i=0; i<this.epoch; i++){
- mihai.epoch();
- print(dessinerGrille(grille,largeur,hauteur));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement