Text

We need to add three different text elements to the screen: the score, the time remaining, and the bullets remaining. Since we already have variables created for all three, we’ll just have to add a line of code to display each of them. Notice how we divide the timeleft variable by 1000 so that the player will see the time remaining in seconds. We’ll also add a line of text to appear when the player has run out of bullets. Add the following code in bold:

Text 100,10,"Score: " +score#,True,False
Text 400,10,"Bullets Remaining: "+bulletcount
Text 800,10,"Time Remaining: "+TimeLeft /1000
If reload=1 Then Text GraphicsWidth()/2, GraphicsHeight()/2,"Press R to
Reload",1,1
Flip
Wend
End

Run the game now, fire 100 bullets, and you should see text appear on your screen, as in Figure 14.16.

Figure 14.16. You should see the text indicating the time and bullets remaining, along with the score. When you run out of bullets, the reload message will appear.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.177.179