Commits

Pedro Ferreira committed 35708c5

- fix GameMenu sometimes not opening correctly
- clear which keys are held and restarting or returning from the game menu

  • Participants
  • Parent commits 5d59695

Comments (0)

Files changed (3)

File js/game_menu.js

 {
 IS_OPENED = true;
 
-    // stop the game
-Ticker.setPaused( true );
-
     // :: Background :: //
 
 var background = new Bitmap( 'images/game_menu/game_menu_background.png' );
 STAGE.addChild( backToGame );
 
 STAGE.update();
+
+clearKeysHeld();
+
+    // fix problem when the game menu isn't shown the first time it is opened
+setTimeout( function() 
+    { 
+    //Ticker.setPaused( true ); 
+    STAGE.update();
+    }, 50 );
+
+    // stop the game
+Ticker.setPaused( true );
 };
 
 

File js/keyboard_events.js

 
 var shootHeld;  //HERE
     
+    
+function clearKeysHeld()
+{
+KEYS_HELD.left = false;
+KEYS_HELD.right = false;
+KEYS_HELD.up = false;
+KEYS_HELD.down = false;
+}
+    
 
 function handleKeyDown( event ) 
 {
     event = window.event; 
     }
     
+    
+    // don't do anything when the menu is opened
+if ( GameMenu.isOpened() )
+    {
+    return;
+    }
+    
 switch(event.keyCode) 
     {
     case EVENT_KEY.space:	//HERE use for secondary fire or something
     // make functions available outside
 window.handleKeyDown = handleKeyDown;
 window.handleKeyUp = handleKeyUp;
+window.clearKeysHeld = clearKeysHeld;
 
 window.KEYS_HELD = KEYS_HELD;
 window.EVENT_KEY = EVENT_KEY;
     
         - 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 game_menu sometimes doesn't load (the images?..)
+        - 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
         
     to doo:
     
  */
 
-    
-    // this sets the namespace for CreateJS to the window object, so you can instantiate objects without specifying 
-    // the namespace: "new Graphics()" instead of "new createjs.Graphics()"
-var createjs = window;
-
 
     // global variables
 var STAGE;
     {
     enemyType.reset();
     });
+    
+clearKeysHeld();
 }