Game Development Community

Make Highscore and screen movement

by Liam Shalon · in iTorque 2D · 07/16/2012 (5:16 pm) · 4 replies

Ok,
So I'm making this app, and in the app a character flies. There are land blocks that try to hold the character back. The screen moves and once the character can't fly any more, he dies.

So here are my questions:
Can someone show me how to right a code to make the screen gradually increase?
Can someone show me how to create a highscore where the score is by the amount of time that you can stay in? And if you beat the highscore it takes you to a screen that saids "you have beat your highscore!" And show the score, and if they don't beat it, then it just shows the score?
Lastly, how do I make the character's speen gradually increase?


Thanks!

#1
07/30/2012 (6:33 am)
Quote:
1. Can someone show me how to right a code to make the screen gradually increase?
2. Can someone show me how to create a highscore where the score is by the amount of time that you can stay in? And if you beat the highscore it takes you to a screen that saids "you have beat your highscore!" And show the score, and if they don't beat it, then it just shows the score?
3. Lastly, how do I make the character's speen gradually increase?
1. Create a sprite bigger than the screen, and in scripting in Torque call it MyScreen. In code set these $screenX = 0; $screenY = 320; (or the height of the sprite - the height of the screen so you start at the bottom) When placing it on the screen use this code fragment...
MyScreen.setPositionX($screenX);
MyScreen.setPositionY($screenY);
$screenY -= 0.01;
2. Store high score as $hiScore = 1000; and $bonusAmountPerMillisecond = 0.1; Store $firstTimeCheck = getTime(); In Torque editor add a sprite that is full screen that is the high score beaten screen, call it HighScoreBeatScreen, and hide it under Scene Object setting (set Visible to false). Create another for just your score and call it YourScoreScreen and hide it. Add a text object called ScoreFinal and hide it. Then do this during game.
$myScore += (getTime() - $firstTimeCheck) * $bonusAmountPerMillisecond;
On completing the game check this.
if ($myScore > $hiScore)
{
   $hiScore = $myScore;
   HighScoreBeatScreen.setVisible( true );
   ScoreFinal.setVisible( true );
   ScoreFinal.setValue("you have beat your highscore!" @ $myScore );
}
else
{
   YourScoreScreen.setVisible( true );
   ScoreFinal.setVisible( true );
   ScoreFinal.setValue( "Score:" @ $myScore );
}
3. Set your character speed to 0.1; $mySpeed = 0.1; Then use this code over time. Store current time before starting as $firstTimeCheck = getTime();
$mySpeed += (getTime() - $firstTimeCheck) * 0.1;
Adjust the 0.1; to whatever suits.

Hope this helps.
#2
07/30/2012 (8:20 am)
Finally! Thanks so much for this this helped a TON !
#3
07/30/2012 (8:54 am)
Post back here if you need some more help making this work.
#4
07/30/2012 (4:10 pm)
Ya, I will thanks so much for this.