Start game with space bar
My project is almost complete except for this last little thing that's been bugging me. A tutorial I followed had you start the game by clicking a button but I would like to change that to pressing the spacebar starts the game. I tried:
if(Key.isDown)(Key.SPACE))
{
_root.ship.newGame();
}
But nothing happens when I press the spacebar.
Here's the starting code with the button for my file Ship.as
function onLoad()
{
_visible = false;
_root.winMenu._visible = false;
_root.gameOverMenu._visible = false;
_root.healthMeter._visible = false;
_root.enemyHealthMeter._visible = false;
_root.playMenu.playButton.onPress = function()
{
_root.ship.newGame();
}
}
function newGame()
{
//code for the main game screen
}
