Comunidad de diseño web y desarrollo en internet online

Rotation, no responde bien para la izquiera...

Citar            
MensajeEscrito el 17 Ago 2007 02:36 am
Hola, necesito ayuda con este codigo, porque cuando voy a la izquierda va cortado, bueno, no se como explicarlo xD una imagen son mejor que mil palabras:

http://www.cursocdo.com.ar/Flash/nave.swf

Código :

onClipEvent (load) {
   thrust = 1;
   decay = .97;
}
onClipEvent (enterFrame) {
   if (Key.isDown(Key.RIGHT)) {
      xSpeed += thrust;
      _rotation += 10
       if (this._rotation > 45) {
         _rotation = 45
      }   
   } else {
      xSpeed *= decay;
      _rotation*= decay
   }
   if (Key.isDown(Key.LEFT)) {
      xSpeed -= thrust;
      _rotation -= 10
       if (this._rotation < 315) {
         _rotation = 315
      }
   } else {
      xSpeed *= decay;
      _rotation*= decay
   }
   if (Key.isDown(Key.UP)) {
      ySpeed += thrust;
   } else {
      ySpeed *= decay;
   }
   if (Key.isDown(Key.DOWN)) {
      ySpeed -= thrust;
   } else {
      ySpeed *= decay;
   }
   _y -= ySpeed;
   _x += xSpeed;
}


:crap:

Por ZequeZ

22 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 17 Ago 2007 04:10 am
Prueba asi

[code
if (Key.isDown(Key.LEFT)) {
xSpeed -= thrust;
_rotation -= 10
if (this._rotation < -45) {
_rotation = -45
}
[/code]

Por Wako

77 de clabLevel



 

firefox
Citar            
MensajeEscrito el 17 Ago 2007 03:34 pm
Listo, hice una combinacion de los 2 y funciono perfecto:


Código :

if (Key.isDown(Key.LEFT)) {
      xSpeed -= thrust;
      _rotation -= 6
       if (this._rotation < -45) {
         _rotation = 315
      }

Por ZequeZ

22 de clabLevel



Genero:Masculino  

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.