Hello, I am relatively new to Wade and Clockwork Chilli and started with the Breakout tutorial. I am trying to add features to it as part of my learning curve but seem to be stuck with adding lives. I have managed to get the ball to delete instead of going to the start screen and reduce the lives count by 1 but I cannot wrap my head around the next step which involves getting the ball to respawn and start moving again.I feel I am close but each thing I try is not working or breaks the code. I think that making the ball a template would help but the again I am having trouble with where I should go from there. I haven't seen any tutorials on adding lives to a game yet so I am reaching out for some direction. Right now the below code snipets from the app.js file is all and from the ballObject onUpdate are I have that works. The game coding is the same as the 3 tutorials minus the addition of the score coding i found elsewhere in the forums. I am hoping someone can point me in the right direction.
***app.js snippet***
this.updateLives = function(die)
{
this.lives += die;
wade.getSceneObject("livesObject").getSprite().setText(this.lives);
wade.removeSceneObject("ballObject");
};
***onUpdate - ballObject snippet***
if(pos.y-size.y < -halfHeight || pos.y+size.x > halfHeight)
{
this.setVelocity({x:this.getVelocity().x, y:this.getVelocity().y*-1});
if(pos.y+size.y > halfHeight)
{
//Game over
wade.app.updateLives(-1);
//wade.clearScene();
//wade.loadScene('scene1.wsc', true, function()
{
// the scene has been loaded, do something here
}//);
}
}