SeedRnd MilliSecs()
music = PlayMusic( "jb.mid" )
Graphics 800,600
SetBuffer BackBuffer()
alien = LoadImage("sleigh.bmp")
boy = LoadImage("boy.bmp")
reindeer = LoadImage("reindeer.bmp")
tree = LoadImage("tree.bmp")
santa = LoadImage("santa.bmp")
A = 800
B = 300
ballx = 65
bally = 500
deerx = 200+Rnd(400)
deery = 400+Rnd(100)
santax = deerx + 100
santay = 400+Rnd(100)
thrown = False
score = 0
Repeat
Cls
Color 66,175,255
Rect 0,0,800,380
Color 255,255,255
Rect 0,380,800,220
DrawImage alien,A,B
Delay 10
A = A - 3
B = B - 1
If A<0 Or B < 0
A = 800
b = 300
EndIf
DrawImage tree,100,400
DrawImage boy,65,480
DrawImage reindeer,deerx,deery
DrawImage santa,santax,santay
Color 0,255,0
Oval ballx,bally,10,10
If thrown And (ballx > A And ballx < A + 100 And bally < B+30 And bally > B)
thrown = False
ballx = 65
bally = 500
score = score + 30
A = 800
B = 300
EndIf
If thrown And (bally > deery And bally < deery+40) And (ballx > deerx And ballx < deerx+30)
thrown = False
ballx = 65
bally = 500
deerx = 200+Rnd(500)
deery = 400+Rnd(100)
score = score + 80
EndIf
If thrown And (bally > santay And bally < santay+50) And (ballx > santax And ballx < santax+50)
thrown = False
ballx = 65
bally = 500
santax = 200+Rnd(500)
santay = 400+Rnd(100)
score = score + 50
EndIf
If (KeyDown(20) Or KeyDown(35)) And (Not thrown) And (Not throwing)
throwing = True
ballx = 65
bally = 500
v = 0
h = 10
EndIf
If throwing And KeyDown(20)
v = (v + 1) Mod 40
EndIf
If throwing And KeyDown(35)
h = h + 1
EndIf
If throwing And (Not KeyDown(20)) And (Not KeyDown(35))
throwing = False
thrown = True
EndIf
If thrown
ballx = ballx + h
bally = bally - v
v = v - 1
If ballx < 0 Or ballx > 800 Or bally <0 Or bally>600
thrown = False
ballx = 65
bally = 500
EndIf
EndIf
Color 0,0,0
Locate 750,10
Print score
Flip
Until Not ChannelPlaying(music)
; You can throw snowballs to hit the targets.
; They game ends when Jingle Bells stops playing.
; Use the T key to throw snowballs - hold the T key down longer
; to throw the snowball harder.
; I you press the H key, the snowball will fly flatter.
; You score points for each target that you hit.
;
; (1) Play the game and see whether you can manage 1000 points
; before the time runs out.
;
; (2) Find the KEYDOWN commands, and change them to use different keys.
; Hint - Every key has a number between 1 and 100.
;
; (3) Change the number of points you get for each target.
;
; (4) Make one more target - perhaps a rabbit (poor little bunny!)
; You will need a picture, and you need to add quite a few commands.
; Look at all the SANTA commands, and make similar commands for the bunny.
;=============================================================================
;
; That is probably enough work on this game - it isn't that wonderful.
; Choose one of the SAMPLE games in the HELP section of Blitz Basic.
; Run the game to find out how it works. Then try to figure out changes
; you can make. For example, you could put a picture of yourself
; in place of a picture in the game. Or change how many points you get
; for shooting something. Or make more monsters, or fewer monsters,
; or make yourself invulnerable! Have fun! (but learn something, too)
Snowball Fight
The program is for a snowball game.
The user presses the T key to throw - hold it longer to throw harder.
You score points for each target hit.
Click here to download a .zip archive
containing the program and all the
picture files and music files. Then try to make the changes suggested at the bottom of the program.