Login
Hammer Mouse
Title:Hammer Mouse
Category:Game/Action
Release Date:
Language:English
Size:16K
Machine:PAL & NTSC
Code Type:Basic
Distribution:Freeware
Game ending type:(n/a)
Code by:bszggg
Notes:A game to test the Mouse Extension from the same author.
No votes yet.
Hammer Mouse Title Screenshot

Hammer Mouse Screenshot


Effects
PartEffect nameParametersNotes
Mouse Support Uses Mouse Extension.


Description
Hit the bubbles with your mouse!

Once the game has started, use the mouse on the whole game area.
Try to hit the mouse, represented by a bubble character, by clicking on it with the mouse key.
The game needs 5 hits to be solved. Once the mouse has been hit 5 times, the game is over.
The player must aim to the lower time spent to achieve the 5 hits.

#---Variables meaning ------------------------------------

xa X actual, the bubble actual x position
ya Y actual, the bubble actual y position
st$ start time
po number of point
pr previous button state (need to handle the click action)
t$ the program saved time
ti$ default system time
x mouse x
y mouse y
b mouse button state

#---code with comment ------------------------------------

# disply the intro
10 scnclr
20 char,13,2,"mouse hammer"
30 char,2,4,"hit the bubbles with mouse"
40 char,2,5,"need 5 point!"
50 char,13,7,"press any key"
60 char,12,8," or mouse button"
70 char,19,9," to begin!"

# simple detect the keyboard, and mouse buttons for input
80 geta$
90 if(peek(1072)=0andlen(a$)=0)then80

# start the play
100 scnclr:gosub 420

# initialize the variables
110 xa=0:ya=0:st$=ti$:po=0:pr=0:t$=ti$

# start of game cycle
120 pr=b

# if it is a new second, handle the bubblemoving
130 if t$<>ti$ then goto230

# read the mouse coordinates, and buttons
140 x=peek(1070):y=peek(1071)
150 b=peek(1072)

# if the bubble coordinate and the mouse cordinate same, and previous mouse state is 0 and this bouse is left click
160 ifx=xa and y=ya and b=128 and pr=0 then280
170 goto 120

# screen handling (clear prev bubble, random a new, and display it in the new position)
180 poke 3072+ya*40+xa,32
190 ya=int(rnd(1)*10):xa=int(rnd(1)*10)
200 poke 3072+ya*40+xa,81
210 return

# ha-ha.. this doesn't need, I just left it.
220 goto 120

# handle the passage of time
230 gosub 180
240 t$=ti$

# display the sec, and the actual point at the bottom
250 char,1,24,str$(val(ti$)-val(st$))
260 char,10,24,str$(po)
270 goto 120

# success click, handle the point increse, and check the point max
280 poke 3072+ya*40+xa,32
290 po=po+1
300 ifpo<>5then120

# waitng a little
310 fori=0to500:nexti

# display the result
320 print"{clear}{down}result":print"points:";po
330 print"time:";val(ti$)-val(st$);"sec"
340 print"{down}again? y/n or left/right"

# witing key, and click to handle the next game
350 geta$:b=peek(1072)
360 if(b=0andlen(a$)=0)then350

# handling the user result
370 ifa$="y"then10
380 ifa$="n"thenend
390 ifb=128then10
400 ifb=32thenend
410 goto 320

# display the border of gameplay territory
420 fori=0to9:char,10,i,"x":nexti
430 char,0,10,"xxxxxxxxxxx"
440 return

#--- code ------------------------------------

10 scnclr
20 char,13,2,"mouse hammer"
30 char,2,4,"hit the bubbles with mouse"
40 char,2,5,"need 5 point!"
50 char,13,7,"press any key"
60 char,12,8," or mouse button"
70 char,19,9," to begin!"
80 geta$
90 if(peek(1072)=0andlen(a$)=0)then80
100 scnclr:gosub 420
110 xa=0:ya=0:st$=ti$:po=0:pr=0:t$=ti$
120 pr=b
130 if t$<>ti$ then goto230
140 x=peek(1070):y=peek(1071)
150 b=peek(1072)
160 ifx=xaandy=yaandb=128andpr=0then280
170 goto 120
180 poke 3072+ya*40+xa,32
190 ya=int(rnd(1)*10):xa=int(rnd(1)*10)
200 poke 3072+ya*40+xa,81
210 return
230 gosub 180
240 t$=ti$
250 char,1,24,str$(val(ti$)-val(st$))
260 char,10,24,str$(po)
270 goto 120
280 poke 3072+ya*40+xa,32
290 po=po+1
300 ifpo<>5then120
310 fori=0to500:nexti
320 print"{clear}{down}result":print"points:";po
330 print"time:";val(ti$)-val(st$);"sec"
340 print"{down}again? y/n or left/right"
350 geta$:b=peek(1072)
360 if(b=0andlen(a$)=0)then350
370 ifa$="y"then10
380 ifa$="n"thenend
390 ifb=128then10
400 ifb=32thenend
410 goto 320
420 fori=0to9:char,10,i,"x":nexti
430 char,0,10,"xxxxxxxxxxx"
440 return



Copyright © Plus/4 World Team, 2001-2025. Support Plus/4 World on Patreon