home *** CD-ROM | disk | FTP | other *** search
- class Flodhest extends Figur
- {
- var mc;
- var dybde;
- var iLufta;
- var skjerm_y;
- var hogrevendt;
- var nesteFrame;
- var brett_x;
- var bredde;
- var roligH = 1;
- var roligV = 10;
- var vakenH = 1;
- var vakenV = 10;
- var forsteKnockoutH = 80;
- var sisteKnockoutH = 128;
- var forsteKnockoutV = 130;
- var sisteKnockoutV = 178;
- var knock = false;
- var flat = false;
- var forsteSlaaH = 20;
- var sisteSlaaH = 41;
- var forsteSlaaV = 50;
- var sisteSlaaV = 71;
- var slaar = false;
- function Flodhest(mc, brett_x, brett_y, bredde, hogde)
- {
- super(mc,brett_x,brett_y,bredde,hogde);
- Figur.figurliste.push(this);
- this.mc.swapDepths(4200 + Figur.figurliste.length);
- this.dybde = this.mc.getDepth();
- this.iLufta = false;
- this.aks_y = 0;
- }
- function vedTreff()
- {
- if(Figur.helt.sparkar || Figur.helt.slaar || Figur.helt.stokkeslaar)
- {
- if(!Figur.helt.slaar)
- {
- this.knockout();
- }
- else
- {
- this.slag();
- }
- }
- else
- {
- Figur.helt.knockout();
- this.slag();
- }
- }
- function knockout()
- {
- if(!this.knock)
- {
- _root.knus.start();
- this.knock = true;
- if(Figur.helt.stokkeslaar)
- {
- this.skjerm_y -= 10;
- this.iLufta = true;
- }
- if(this.hogrevendt)
- {
- this.nesteFrame = this.posisjon = this.forsteKnockoutH;
- }
- else
- {
- this.nesteFrame = this.posisjon = this.forsteKnockoutV;
- }
- }
- }
- function slag()
- {
- if(!this.slaar)
- {
- this.slaar = true;
- if(this.hogrevendt)
- {
- this.nesteFrame = this.posisjon = this.forsteSlaaH;
- }
- else
- {
- this.nesteFrame = this.posisjon = this.forsteSlaaV;
- }
- }
- }
- function visRiktigFrame()
- {
- if(!this.aktiv)
- {
- this.bliUsynlig();
- }
- else
- {
- if(!this.knock)
- {
- if(this.brett_x + this.bredde / 2 > Figur.helt.brett_x + Figur.helt.bredde / 2)
- {
- this.hogrevendt = true;
- if(Math.abs(this.brett_x + this.bredde / 2 - (Figur.helt.brett_x + Figur.helt.bredde / 2)) < 135)
- {
- this.nesteFrame = this.vakenH;
- }
- else
- {
- this.nesteFrame = this.roligH;
- }
- }
- else
- {
- this.hogrevendt = false;
- if(Math.abs(this.brett_x + this.bredde / 2 - (Figur.helt.brett_x + Figur.helt.bredde / 2)) < 135)
- {
- this.nesteFrame = this.vakenV;
- }
- else
- {
- this.nesteFrame = this.roligV;
- }
- }
- }
- else if(this.hogrevendt)
- {
- if(this.mc._currentframe < this.sisteKnockoutH)
- {
- this.posisjon += 1;
- this.nesteFrame = this.posisjon;
- }
- else
- {
- this.knock = false;
- }
- }
- else if(this.mc._currentframe < this.sisteKnockoutV)
- {
- this.posisjon += 1;
- this.nesteFrame = this.posisjon;
- }
- else
- {
- this.knock = false;
- }
- if(this.slaar)
- {
- if(this.hogrevendt)
- {
- if(this.mc._currentframe < this.sisteSlaaH)
- {
- this.posisjon += 1;
- this.nesteFrame = this.posisjon;
- }
- else
- {
- this.slaar = false;
- }
- }
- else if(this.mc._currentframe < this.sisteSlaaV)
- {
- this.posisjon += 1;
- this.nesteFrame = this.posisjon;
- }
- else
- {
- this.slaar = false;
- }
- }
- }
- }
- }
-