Start Screen for Games

csd-unit-3-lesson-22

#1

I would like my students to create a start screen or direction screen for their games in Lesson 22, however we are stuck on how to do this. Did we miss this in a Lesson somewhere? Can someone at least point me in the right direction where to go back and look. Or try to explain it here.

Thanks!


#2

Here is one way to look at it.
Hopefully it makes some sense.

//create all of your sprites but make only the ones you need for the start screen visible. 
// you can either make the x and y value of the sprite such that the will not appear on the screen
// or set visible = false 

//this var will tell us what screen to draw
var screen = "start" ;

function draw()
{
  
  if(screen == "start")
  {
   //This condition will be true at the start and here is where all of the code to draw the start screen 
   //is put. 
  //We also need a mechanism to change the value of screen to "playing". 
 //This could be a timer var reaching a certain value or a MousePressedOver(sprite) function as a 
 //condition to an if statement.  
 }

  else if(screen == "playing")
 {
     //here is all of the code for when the game is playing
    //we will have to first, hide all of the sprites that we don't want to see from the "start" screen again 
   //either by moving them off the screen  sprite.x  = 500 or by setting sprite.visible = false ;
 }

 else
 {
     //This could be where the end game screen code is.
 }

}//end of the draw function.

#3

Hi Sarah,

I’m working on something that might be relevant to you, and I’ll send you a private message about it. It’s not something we’re ready to publish, but if you’d like to take a look at it knowing that it could change under your feet, you can give it a try.

Elizabeth


#4

That would be great!