Admins sorry for making thread again but,please put tutorial that bg music works on android... because my wc3.ogg is not working.. check my attachments. thank you . my final defense is on this day :(
hey sir lifepoints is ok now.. but i dont know how if the score in drag item will get 10 it will open congratzMessage.. its deifferent in finding object true
sir how to do it when the score in dragging items gets 10 it will visible the congratz message asap
If you have an object called congratzMessage and that object is initially set to be invisible, then where you do _.scoreText.getSprite().setText(++wade.app.score); you could do this
_.scoreText.getSprite().setText(++wade.app.score);
if (wade.app.score == 10)
{
_.congratzMessage.setVisible(true);
}
Where shud i put that?
where you do _.scoreText.getSprite().setText(++wade.app.score);
On my scoreText object addtoscenefunction?
I believe you are doing that on the bin's onMouseUp function
Uhhh thats where i got wrong.. I put if statement but i didnt put the get sprite.. I screwed up in debugging 😭
if (wade.app.dragging)
{
if (wade.app.dragging.type == this.type)
{
_.scoreText.getSprite().setText(++wade.app.score);
wade.removeSceneObject(wade.app.dragging);
wade.playAudio('correct.ogg');
_.scoreText.getSprite().setText(++wade.app.score);
if (wade.app.score == 10)
{
_.congratzMessage.setVisible(true);
}
}
else
{
// the wrong type was selected - display a message?
wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
wade.removeSceneObject(wade.app.dragging);
--wade.app.lives;
_.lifeText.getSprite().setText(wade.app.lives);
if(wade.app.lives === 0)
{
wade.clearScene();
wade.loadScene('gameOver.wsc'); // I'm just clearing scene
// No lives left, end game
// restart or anything else you want
}
}
}
i think theres something wrong?
Yes
Go back to what you had before. Just replace
_.scoreText.getSprite().setText(++wade.app.score);
with the code that I posted above
Go back to what you had before. <--- i dont understand sir
You've just made a change and realized that it didn't work.
Go back to what you had before means "undo that change you've just made"
if (wade.app.dragging)
{
if (wade.app.dragging.type == this.type)
{
_.scoreText.getSprite().setText(++wade.app.score);
wade.removeSceneObject(wade.app.dragging);
wade.playAudio('correct.ogg');
}
else
{
// the wrong type was selected - display a message?
wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
wade.removeSceneObject(wade.app.dragging);
--wade.app.lives;
_.lifeText.getSprite().setText(wade.app.lives);
if(wade.app.lives === 0)
{
wade.clearScene();
wade.loadScene('gameOver.wsc'); // I'm just clearing scene
// No lives left, end game
// restart or anything else you want
}
}
}
this code works but no if wadeapp score===10 set congratzmessageVisible
Right, now you've gone back to what you had before...
Just replace
_.scoreText.getSprite().setText(++wade.app.score);
with the code that I posted above
if (wade.app.dragging)
{
if (wade.app.dragging.type == this.type)
{
_.scoreText.getSprite().setText(++wade.app.score);
if (wade.app.score == 10)
{
_.congratzMessage.setVisible(true);
}
wade.removeSceneObject(wade.app.dragging);
wade.playAudio('correct.ogg');
}
else
{
// the wrong type was selected - display a message?
wade.playAudio('its_' + wade.app.dragging.type + '.ogg');
wade.removeSceneObject(wade.app.dragging);
--wade.app.lives;
_.lifeText.getSprite().setText(wade.app.lives);
if(wade.app.lives === 0)
{
wade.clearScene();
wade.loadScene('gameOver.wsc'); // I'm just clearing scene
// No lives left, end game
// restart or anything else you want
}
}
}
correct?