-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvasorVikingo.ts
More file actions
33 lines (25 loc) · 787 Bytes
/
InvasorVikingo.ts
File metadata and controls
33 lines (25 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {Nave} from "./Nave";
import { Personaje } from "./Personaje";
export class InvasorVikingo extends Personaje{
vida: number;
velocidad: number;
constructor(vida: number, velocidad: number){
super(vida, velocidad);
}
destruitePorNave(this){
var vida = this.getVida();
var valor = (this.getVelocidad()*10)/100;
var nuevaVida = vida - valor;
this.setVida(nuevaVida);
}
destruirNave(nave: Nave){
var danio = 90 * this.getVelocidad() / 100;
var nuevaVida = nave.getVida() - danio;
nave.setVida(nuevaVida);
}
chocar(nave: Nave){
var danio = 90 * this.getVelocidad() / 100;
var nuevaVida = nave.getVida() - danio;
return nave.chocate(nuevaVida);
}
}