Title Screen using World Seconds

csd-unit-3-lesson-20
#1

Hello,

I am trying to add a title screen to my game. What I would like for it to do is the title screen to show for 5 seconds then for the game to start. I appear to have it however every time my game screen then appears for the main game my score starts at 2. I can’t figure out why this is the case. Very frustrating. Also if I used an else on the If that I already had would it be possible to make an end screen too.

#2

Hi Ben,

The reason your main game starts with a score of 2 is because of line 83 & 85 and 91 & 93. When the game starts enemy1 and enemy2 y-position is less than 140. This results in “score + 1” for both sprites. For your second question, it would be fun to try the “else” to see if you could create an end screen.

#3

I guess I don’t really understand why it still starts with 2. When the enemies are set on the screen their supposed to be between 150 and 250 Y so why they are not less then 140.

If I call on my setenemy function outside the draw loop that technically solves my issue however if I do much more then a few seconds when the game starts they will have already moved. I am thinking maybe this is just a limit with game lab that isn’t possible then?

I wish game lab worked like their app lab where you could set screens and stuff. I am guessing you can’t really make levels using game lab or can you?

#4

Ben,

As for the intro screen - you were on the right track (check out this post: Create a simple timer in cake defender) but then modify the given code as needed, instead of counting down… count up (or count down from 5…) and have that sprite visible or not. For the end screen you’d have an invisible sprite (endScreen) until the score is reached then make it visible.

Hope that helps!
Brad