'Cats and Mouse Game by Ken G.
'Written on Dec. 9, 2019.
'Thank you to b+ and SMcNeill from the QB64.org forum for some help!
_TITLE "Cats and Mouse Game - by Ken G. - Use mouse to get to the cheese before a cat gets you." begin:
score = 0
speed = 1
player = 20
start:
xx = 400: yy = 1000
xx2 = 0: yy2 = 1000
'Draw on your work screen.
IF mouseX
> xx
THEN xx
= xx
+ speed
IF mouseY
> yy
THEN yy
= yy
+ speed
IF mouseX
> xx2
THEN xx2
= xx2
+ speed
IF mouseX
> yy2
THEN yy2
= yy2
+ speed
IF mouseX
< xx
THEN xx
= xx
- speed
IF mouseY
< yy
THEN yy
= yy
- speed
IF mouseX
< xx2
THEN xx2
= xx2
- speed
IF mouseX
< yy2
THEN yy2
= yy2
- speed
speed = speed + .001
IF speed
> 10000 THEN speed
= 10000 'Check to see if a cat got to your mouse.
IF mouseX
+ tt
> xx
- 1 AND mouseX
+ tt
< xx
+ 101 AND mouseY
+ tt
> yy
- 1 AND mouseY
+ tt
< yy
+ 101 THEN player
= player
- 1:
LINE (xx
, yy
)-(xx
+ 100, yy
+ 100), _RGB32(255, 0, 0), BF:
SOUND 200, .2:
GOTO start:
IF mouseX
+ tt
> xx2
- 1 AND mouseX
+ tt
< xx2
+ 101 AND mouseY
+ tt
> yy2
- 1 AND mouseY
+ tt
< yy2
+ 101 THEN player
= player
- 1:
LINE (xx2
, yy2
)-(xx2
+ 100, yy2
+ 100), _RGB32(255, 0, 0), BF:
SOUND 200, .2:
GOTO start:
b = b + 1
again2:
b = 0
'Draw cheese.
LINE (bx
, by
)-(bx
+ 50, by
+ 50), _RGB32(255, 255, 127), BF
'Check to see if you got the cheese.
IF mouseX
+ tt
> bx
- 1 AND mouseX
+ tt
< bx
+ 51 AND mouseY
+ tt
> by
- 1 AND mouseY
+ tt
< by
+ 51 THEN score = score + 100
LINE (bx
, by
)-(bx
+ 50, by
+ 50), _RGB32(0, 0, 0), BF
ti$ = "Cats and Mouse Game - by Ken G. - - Score: " + score$ + " Players: " + player$
_TITLE ti$
+ " Game Over - Press Enter To Play Again" 'First Cat
'head
LINE (xx
, yy
)-(xx
+ 100, yy
+ 100), _RGB32(255, 188, 127), BF
'ears
LINE (xx
, yy
)-(xx
+ 20, yy
- 20), _RGB32(255, 188, 127) LINE (xx
+ 20, yy
- 20)-(xx
+ 40, yy
), _RGB32(255, 188, 127) LINE (xx
+ 60, yy
)-(xx
+ 80, yy
- 20), _RGB32(255, 188, 127) LINE (xx
+ 80, yy
- 20)-(xx
+ 100, yy
), _RGB32(255, 188, 127) 'eyes
CIRCLE (xx
+ 30, yy
+ 20), 15, _RGB32(255, 255, 255), , , .5 CIRCLE (xx
+ 70, yy
+ 20), 15, _RGB32(255, 255, 255), , , .5
'mouth
'nose
'whiskers
LINE (xx
+ 20, yy
+ 50)-(xx
- 20, yy
+ 30), _RGB32(255, 255, 255) LINE (xx
+ 20, yy
+ 50)-(xx
- 20, yy
+ 50), _RGB32(255, 255, 255) LINE (xx
+ 20, yy
+ 50)-(xx
- 20, yy
+ 70), _RGB32(255, 255, 255) LINE (xx
+ 80, yy
+ 50)-(xx
+ 120, yy
+ 30), _RGB32(255, 255, 255) LINE (xx
+ 80, yy
+ 50)-(xx
+ 120, yy
+ 50), _RGB32(255, 255, 255) LINE (xx
+ 80, yy
+ 50)-(xx
+ 120, yy
+ 70), _RGB32(255, 255, 255)
'Second Cat
'head
LINE (xx2
, yy2
)-(xx2
+ 100, yy2
+ 100), _RGB32(255, 188, 127), BF
'ears
LINE (xx2
, yy2
)-(xx2
+ 20, yy2
- 20), _RGB32(255, 188, 127) LINE (xx2
+ 20, yy2
- 20)-(xx2
+ 40, yy2
), _RGB32(255, 188, 127) LINE (xx2
+ 60, yy2
)-(xx2
+ 80, yy2
- 20), _RGB32(255, 188, 127) LINE (xx2
+ 80, yy2
- 20)-(xx2
+ 100, yy2
), _RGB32(255, 188, 127) 'eyes
CIRCLE (xx2
+ 30, yy2
+ 20), 15, _RGB32(255, 255, 255), , , .5 CIRCLE (xx2
+ 70, yy2
+ 20), 15, _RGB32(255, 255, 255), , , .5
'mouth
'nose
'whiskers
LINE (xx2
+ 20, yy2
+ 50)-(xx2
- 20, yy2
+ 30), _RGB32(255, 255, 255) LINE (xx2
+ 20, yy2
+ 50)-(xx2
- 20, yy2
+ 50), _RGB32(255, 255, 255) LINE (xx2
+ 20, yy2
+ 50)-(xx2
- 20, yy2
+ 70), _RGB32(255, 255, 255) LINE (xx2
+ 80, yy2
+ 50)-(xx2
+ 120, yy2
+ 30), _RGB32(255, 255, 255) LINE (xx2
+ 80, yy2
+ 50)-(xx2
+ 120, yy2
+ 50), _RGB32(255, 255, 255) LINE (xx2
+ 80, yy2
+ 50)-(xx2
+ 120, yy2
+ 70), _RGB32(255, 255, 255)
'Draw your mouse.
'body
'eye
CIRCLE (mouseX
- 25, mouseY
- 20), 5, _RGB32(255, 255, 255), , , .5 PAINT (mouseX
- 25, mouseY
- 20), _RGB32(255, 255, 255) 'nose
'mouth
CIRCLE (mouseX
- 30, mouseY
+ 15), 10, _RGB32(255, 0, 0), , , .35 'tail
LINE (mouseX
+ 49, mouseY
)-(mouseX
+ 85, mouseY
), _RGB32(172, 61, 0) 'ear
CIRCLE (mouseX
- 20, mouseY
- 31), 7, _RGB32(172, 61, 0), , , 1.75