Reloading levels
by Brendan Coleiro · in Game Design and Creative Issues · 11/16/2010 (7:09 am) · 1 replies
Hey guys,
I've just got a question when it comes to reloading levels. I am currently using a retry button that just reloads the level from the file.
like this :
but i am planning on having 25+levels and i dont want to have 25+ sceperate buttons just for retry.
is there a getLevel function i can use so that i can reload the current level?
i have looked in the documentation and couldnt find anything.
thanks
Brendan
I've just got a question when it comes to reloading levels. I am currently using a retry button that just reloads the level from the file.
like this :
function menuButtonClass::onMouseUp(%this, %modifier, %worldPosition, %clicks)
{
if(%this.buttonNumber == 0)
{
sceneWindow2D.schedule(999, endLevel);
sceneWindow2D.schedule(1000, loadLevel, expandFileName("~/data/levels/puzzle_buster_main_menu.t2d"));
}
else if(%this.buttonNumber == 4)
{
sceneWindow2D.schedule(999, endLevel);
sceneWindow2D.schedule(1000, loadLevel, expandFileName("~/data/levels/puzzle_buster_level1.t2d"));
}but i am planning on having 25+levels and i dont want to have 25+ sceperate buttons just for retry.
is there a getLevel function i can use so that i can reload the current level?
i have looked in the documentation and couldnt find anything.
thanks
Brendan
Brendan Coleiro
the solution was to have a dynamic field on player called level and then put that into the code where the @ signs are
else if(%this.buttonNumber == 4) { $touches = 0; blackFadeOut.fadeIn(); sceneWindow2D.schedule(999, endLevel); sceneWindow2D.schedule(1000, loadLevel, expandFileName("~/data/levels/puzzle_buster_level" @ player.level @ ".t2d")); }thanks anyways to anyone who looks at this post in the future :)
-Brendan