Congratulations/Game Over Screens

Talk about making games.

Congratulations/Game Over Screens

Postby raminjoon » Thu Aug 18, 2011 3:46 pm

hi I was just wondering to know based on the score in the game how can I load the screen with a congratulations image or game over image. Okay I got a box which has the Congratulations text and images in it I want to be able to CreateActor it after the score is up to for i.e. 1000 but if the game score does not go up to 1000 I want to have the game over screen pop up after the game is over.
raminjoon
 
Posts: 40
Joined: Tue Jul 05, 2011 5:34 am
Location: Denver, Co.
Score: 3 Give a positive score

Re: Congratulations/Game Over Screens

Postby JamesLeonardo32 » Thu Aug 18, 2011 4:29 pm

Look for a fitting area to put the Screen, there place any image actors you want there then add a text actor- When the time comes to execute the action, something like this should happen.
Use the Moveto action to Move the view to the area of the gameover screens location. After that, make a code like this!
Code: Select all
if (score>=1000)//more than 1000 pts
{
CreateTimer("TEXTACTOR", "txtCongraturalation", 12); //Make your custom timer for 12 ms for the text actor
}
if (score<=999)
{
CreateTimer("TEXTACTOR", "txtGameover", 12);
}


so with these timers on the Text Actors, give them an action of setText.
This means you can make the first timer set the text "CONGRATULATIONS¬"
And the other with "GAMEOVER!"

I hope this Helps! Please respond if it doesn't or Does!
User avatar
JamesLeonardo32
 
Posts: 300
Joined: Wed Oct 13, 2010 4:57 pm
Score: 32 Give a positive score

Re: Congratulations/Game Over Screens

Postby raminjoon » Thu Aug 18, 2011 7:06 pm

maybe I explained it wrong bud and thanks for your info but let me explain this a little bit better. the congratulation text or game over texts are made with Adobe flash as a animation file and I loaded in GE as PNG Sequence file which makes up a animation so to make a story short my question is how and on what actor should I put your code in order to load up the animations based on their cases and score.
raminjoon
 
Posts: 40
Joined: Tue Jul 05, 2011 5:34 am
Location: Denver, Co.
Score: 3 Give a positive score

Re: Congratulations/Game Over Screens

Postby JamesLeonardo32 » Thu Aug 18, 2011 8:29 pm

Use the same sort of code but instead do a Change animation Action.
Code: Select all
if (score>=1000)//more than 1000 pts
{
ChangeAnimation("   ", "   ", FORWARD);
}
if (score<=999)
{
ChangeAnimation("   ", "    ", FORWARD);
}
User avatar
JamesLeonardo32
 
Posts: 300
Joined: Wed Oct 13, 2010 4:57 pm
Score: 32 Give a positive score

Re: Congratulations/Game Over Screens

Postby skydereign » Thu Aug 18, 2011 9:24 pm

Well, you could move the view to the other actor's location, but it'd make more sense to do as you had asked, and create the actor. Since game over is triggered by not getting 1000, I'm going to assume there is a timer to the game (if not this code can still be used if you get rid of the timer, but in a different event [such as a destroy actor event]).
time_display -> Draw Actor -> Script Editor
Code: Select all
time-=time>0; // this reduces time if it is greater than zero

if(time<=0)
{
  if(score>=1000)
  {
    CreateActor("congrats", "congrats_anim", "(none)", "(none)", view.x+view.width/2, view.y+view.height/2, true);
  }
  else
  {
    CreateActor("game_over", "game_over_anim", "(none)", "(none)", view.x+view.width/2, view.y+view.height/2, true);
  }
}
User avatar
skydereign
 
Posts: 3394
Joined: Mon Jul 28, 2008 8:29 am
Score: 565 Give a positive score

Re: Congratulations/Game Over Screens

Postby raminjoon » Fri Aug 19, 2011 2:12 am

ok sky thanks for this info but my game has no timer but I can put one on there in such case that if my character is out of the view that means it comes to the view but leaves the stage then i would put 1 sec timer and let the Congrat/Game Over scene to pop up so my question is how can I do that. how can I activate a timer after my character leaves the stage? if I can figure this out then your code works the best.
raminjoon
 
Posts: 40
Joined: Tue Jul 05, 2011 5:34 am
Location: Denver, Co.
Score: 3 Give a positive score

Re: Congratulations/Game Over Screens

Postby skydereign » Fri Aug 19, 2011 7:33 am

If your game doesn't have a timer I wouldn't put one in. There are other ways to make that code match. I just assumed a timer because that is one reason why the game would end and you didn't get enough points. I'd prefer we match the code to a real event that would take place in your code, but since you asked, if you want a timer to trigger when the player leaves the view, you can use the Out of Vision event.
player -> Out of Vision -> Script Editor
Code: Select all
// code goes here


Of course I wasn't talking about a timer as in CreateTimer. I was talking about a variable called time that was decreased every frame until it reaches 0. But since you say out of vision would be used to create a timer, might as well use the out of vision event.
player -> Out of Vision -> Script Editor
Code: Select all
if(score>=1000)
{
    CreateActor("congrats", "congrats_anim", "(none)", "(none)", view.x+view.width/2, view.y+view.height/2, true);
}
else
{
    CreateActor("game_over", "game_over_anim", "(none)", "(none)", view.x+view.width/2, view.y+view.height/2, true);
}
User avatar
skydereign
 
Posts: 3394
Joined: Mon Jul 28, 2008 8:29 am
Score: 565 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest