Additional core template features
IVAN FERNANDO CASANOVA ROJAS 160001058
UNIVERSIDAD DE LOS LLANOS
FACULTAD DE CIENCIAS BASICAS E INGENIERIA
INGENIERIA DE SISTEMAS
2009
TALLER DE METRICAS
METRICA DEHALSTEAD APLICADA A UNA CLASE DEL PROYECTO DE REDES. 2008.
CLASE TANQUE (ACTIONSCRIPT 3.0).
package {
import flash.display.*;
import flash.events.*;
public class Tanque extends MovieClip {var velocidad,resistencia,dmg:int;
var teclaArriba,teclaAbajo,teclaIzq,teclaDer:Boolean;
public function Tanque(tipo:int) {
this.stop();// queda quieto en el primer fotogramaswitch (tipo) {
case 1 :// el tanque de velocidad
this.gotoAndStop(1);
velocidad=120;
resistencia=100;
dmg=100;
break;
case 2 :// el tanque de resistenciathis.gotoAndStop(2);
velocidad=100;
resistencia=120;
dmg=100;
break;
case 3 :// el tanque de dmg
this.gotoAndStop(3);
velocidad=100;
resistencia=100;dmg=120;
break;
}
}
public function presionTecla(event:KeyboardEvent):void{
if(event.keyCode==38) //arriba
teclaArriba=true;
else if(event.keyCode==40) //abajoteclaAbajo=true;
else if(event.keyCode==39) //derecha
teclaDer=true;
else if(event.keyCode==37) //izquierda
teclaIzq=true;
}
public functionliberarTecla(event:KeyboardEvent):void{
if(event.keyCode==38) //arriba
teclaArriba=false;
else if(event.keyCode==40) //abajo
teclaAbajo=false;
else if(event.keyCode==39) //derecha
teclaDer=false;
elseif(event.keyCode==37) //izquierda
teclaIzq=false;
}
public function mover(event:Event):void{
if(teclaArriba){ //arriba
moverArriba();
}
else if(teclaDer){ //derechathis.rotation+=velocidad/20;
//this.angle=this.rotation;
}
else if(teclaIzq) //izquierda
this.rotation-=velocidad/20;
}
public function moverArriba(){
var speed:Number =...
Regístrate para leer el documento completo.