Commits

Pedro Ferreira  committed e8724d2

- fix bullets not being aligned (rotated) when fired
- fix rockets not well centered (body/shape)

  • Participants
  • Parent commits 8eb6a3e

Comments (0)

Files changed (4)

File js/enemy_rotate_around.js

        
     
         // we multiply by -1 because the .rotation property seems to have the angles in the other direction
-    angleRotation *= -1;
+    //angleRotation *= -1;
       
     new Weapon1_laser( this, angleRotation );
     }
 /*
     Issues:
     
-        - sometimes, one of the enemies can't be killed...
         - the game_menu entries have to have a background color, so that we can click in the entry (instead of the text)
         - the EnemyKamikaze doesn't work too well
         - when returning from the game_menu with two keys held, top and left arrow for example, it doesn't continue going to the top left corner, but to the left only
             - sniper bullet is too fast for the shape/body to be synced
             - cant fire if mouse is outside of canvas
 
+        - use html/css for the menus
  */
 
 

File js/weapon3_rocket.js

 var rocket = new createjs.BitmapAnimation( sprite );
 
     // origin in the middle of the image
+rocket.regX = this.width / 2;
 rocket.regY = this.height / 2;
 
 rocket.gotoAndPlay("main");

File js/weapons.js

 var addX = Math.cos( radians ) * shipRadius;
 var addY = Math.sin( radians ) * shipRadius;
 
+this.rotate( angle );
 this.moveTo( x + addX, y + addY );
 }
 
 
 Weapons.prototype.updateShape = function()
 {
-//this.shape.rotation = this.body.GetAngle() * (180 / Math.PI);
+this.shape.rotation = this.body.GetAngle() * (180 / Math.PI);
 
 this.shape.x = this.body.GetWorldCenter().x * SCALE;
 this.shape.y = this.body.GetWorldCenter().y * SCALE;
 };
 
 
+
+Weapons.prototype.rotate = function( degrees )
+{
+this.shape.rotation = degrees;
+
+this.body.SetAngle( degrees * Math.PI / 180 );
+};
+
 /*
     Remove the bullet from the stage
  */