Some Ideas for Blitz Basic Holiday Games

You can download Santa.zip to see an example of the ideas described here.

 == Printing Text ==

Printing text is a bit more complicated than we expect.  
The following prints the "Game Over" message  ==>

  Color 0,0,0
SetFont LoadFont("Arial",40,0,0,0)
Text 400,300,"Game Over",1,1
SetFont LoadFont("Arial",20,0,0,0)
Text 400,350,"(Press Enter)",1,1

The number 40 in LoadFont tells the SIZE of the font.
The 0 numbers tell whether it should be bold, italic, or
underlined -  change the 0 to a 1 to get that effect.

img1.gif

The TEXT command is simple - the first two numbers tell the position, followed by the message.  The following 1,1 numbers tell it to center the text (usually a good idea).

Don't forget to choose a sensible color.  At the beginning, the default color is black and the screen is black, so if you print a message at the beginning, you won't see it.

== Transparent Images ==

If you have a rounded image, you may see an ugly square surrounding background.  To get rid of this, use Paint Shop Pro to fill the surrounding area with black (color 0,0,0) and save the pictures as a Windows Bitmap (.bmp).  If your image has some black parts in it, you need to fill these with a slightly different color, e.g. color 4,4,4.  This still looks black to the viewer, but BlitzBasic will not make that part transparent.  For example:

  If Santa looks like this img1.gif , then it will look like this in BlitzBasic : img4.gif

  1. Use Paint Shop Pro to fill his boots and belt with a slightly different black, like color 4,4,4, to prevent them from being transparent
       
  2. Fill the light green areas with perfect black - color 0,0,0 - to make the surroundings transparent
       
  3. Then it looks like this: img2.gif        Now in BlitzBasic, it will look like this :   img3.gif

Remember to save as a Windows Bitmap (.bmp).

== Changing Directions ==

You might want your "player" to changing directions - e.g. face to the right when he is moving right, but face left when he is moving left.  You can do this by loading a different image.  For example, instead of just changing  x = x - 3, you also change the image:  santa = santaLeft.  
Then you need to do 2 extra LoadImage commands at the beginning of the program -
one for santaLeft    img5.gif    and one for santaRight  img6.gif

Moving only

Moving and Changing the Image

... at the beginning ....

santa = LoadImage("santa.bmp") 
 ....  inside the game loop ...

If KeyDown(30) Then x = x-3
 If x < 0 Then  x = 0
   If KeyDown(32) Then x = x + 3
  If x > 750 Then x = 750
   ....... later .....
   DrawImage santa, x , y
... at the beginning ....
santa = LoadImage("santaleft.bmp")

santaLeft = LoadImage("santaleft.bmp")
santaRight = LoadImage("santaright.bmp")

x = 300
y = 500

.... inside the game loop ....
   If KeyDown(30) Then
x = x-3
santa = santaLeft
EndIf
 If x < 0 Then  x = 0
   If KeyDown(32) Then 
x = x + 3
santa = santaRight
EndIf
  If x > 750 Then x = 750
   ....  later  ....
   DrawImage santa, x , y

Of course, you will need to use Paint Shop Pro to make two different santa pictures before using them in the program.  You might also want an upSanta and a downSanta if he moves in those directions.

== Music ==

You can play music in the background.  It only takes one command at the beginning of the program:

   PlayMusic( "jbrock.mp3" ) 

Blitz Basic seems to play most normal music file formats:  .wav, .mid, .mp3
You won't be able to download mp3 files at school (they are blocked),
but .wav and .mid files are okay.  Try the following sites (if you can't find something better):

    http://www.wavplanet.com/      http://www.indianchild.com/Songs/funny_songs.htm

You can also play sound-effects when something happens.  Put the PlayMusic command
after an if ImagesOverlap...  command.  You can get some sound effects from:

    http://www.slinkycity.com/audio/  

You won't want to use BOTH sound effects AND background music,
because they will play at the same time.

== Restart ==

You can restart your program (after winning) by doing the following:

== Levels ==

To make levels, you just write one program following another.
(But don't copy everything - see details below)
Then start each new level with a label:

      .Level1        at the beginning
      .Level2        before the second level
      .Level3        before the third level

Now to start the second level, use the command:
      GoTo  Level2

It might be a good idea to write each level as a separate program, fix all the errors,
and then copy the various levels together into one program.  It is very difficult to find
and fix errors in a really big program.

** Don't Copy the Following **

Don't copy functions.
Don't copy the global command.
Don't copy the type command(s).

If you run the program and it says "Duplicate identifier", then you have copied something that you shouldn't.  You will need to delete the copy.  Get help from the teacher if you can't get this to work.