03-24-2025, 02:03 AM
(03-24-2025, 01:44 AM)SierraKen Wrote: Here is a much more fun version. Every time you click the button, the game speeds up by 10 _LIMIT numbers. I've tried it once so far and got a score of 45.![]()
Try it out!
Code: (Select All)
Screen _NewImage(800, 600, 32)
begin:
score = 0
speed = 0
buttonx = 370
buttony = 300
text$ = "Click"
_Title "Click The Button Game by SierraKen"
c = 10
For bb = 0 To 30
c = c + 10
Line (buttonx + bb, buttony + bb)-(buttonx2 - bb, buttony2 - bb), _RGB32(100 + c, 100 + c, 100 + c), B
Next bb
Color _RGB32(0, 0, 0)
_PrintString (buttonx + 32, buttony + 17), text$
dir = 1
t = Timer
Do
_Limit 300 + speed
buttonx2 = buttonx + 100
buttony2 = buttony + 50
ti = Timer - t
c = 10
For bb = 0 To 30
c = c + 10
Line (buttonx + bb, buttony + bb)-(buttonx2 - bb, buttony2 - bb), _RGB32(100 + c, 100 + c, 100 + c), B
Next bb
Color _RGB32(0, 0, 0), _RGB32(255, 255, 255)
_PrintString (buttonx + 32, buttony + 17), text$
Color _RGB32(255, 255, 255), _RGB32(0, 0, 0)
Locate 1, 1: Print "Score: "; score
Locate 2, 1: Print "Time Left: "; Int(120 - ti)
If Int(120 - ti) < 1 Then
Locate 30, 50
Print "The End"
Locate 34, 50
Input "Again (Y/N)"; ag$
If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo begin:
End
End If
While _MouseInput: Wend
mousex = _MouseX
mousey = _MouseY
mouseLeftButton = _MouseButton(1)
If mouseLeftButton Then
Clear_MB 1
If mousex > buttonx And mousex < buttonx2 And mousey > buttony And mousey < buttony2 Then
c = 110
_AutoDisplay
For bb = 0 To 30
c = c - 10
Line (buttonx + bb, buttony + bb)-(buttonx2 - bb, buttony2 - bb), _RGB32(100 + c, 100 + c, 100 + c), B
Next bb
_Delay .1
For bb = 0 To 30
c = c + 10
Line (buttonx + bb, buttony + bb)-(buttonx2 - bb, buttony2 - bb), _RGB32(100 + c, 100 + c, 100 + c), B
Next bb
_Delay .05
c = 10
For bb = 0 To 30
c = c + 10
Line (buttonx + bb, buttony + bb)-(buttonx2 - bb, buttony2 - bb), _RGB32(100 + c, 100 + c, 100 + c), B
Next bb
_Delay .1
Color _RGB32(0, 0, 0), _RGB32(255, 255, 255)
_PrintString (buttonx + 32, buttony + 17), text$
Sound 900, 1, , , 6
score = score + 1
Color _RGB32(255, 255, 255), _RGB32(0, 0, 0)
Locate 1, 1: Print "Score: "; score
buttonx = Int(Rnd * 650) + 49
buttony = Int(Rnd * 500) + 19
speed = speed + 10
End If
End If
changedir = Int(Rnd * 100) + 1
If changedir > 95 Then
dir = Int(Rnd * 8) + 1
End If
If dir = 1 Then buttony = buttony + 1
If dir = 2 Then buttony = buttony - 1
If dir = 3 Then buttonx = buttonx + 1
If dir = 4 Then buttonx = buttonx - 1
If dir = 5 Then buttony = buttony + 1: buttonx = buttonx + 1
If dir = 6 Then buttony = buttony - 1: buttonx = buttonx - 1
If dir = 7 Then buttonx = buttonx + 1: buttony = buttony + 1
If dir = 8 Then buttonx = buttonx - 1: buttony = buttony - 1
If buttonx > 700 And dir = 3 Then dir = 4
If buttonx > 700 And dir = 7 Then dir = 8
If buttonx < 50 And dir = 4 Then dir = 3
If buttonx < 50 And dir = 8 Then dir = 7
If buttony > 520 And dir = 1 Then dir = 2
If buttony > 520 And dir = 5 Then dir = 6
If buttony < 50 And dir = 2 Then dir = 1
If buttony < 50 And dir = 8 Then dir = 7
_Display
Cls , _RGB32(0, 0, 0)
Loop Until InKey$ = Chr$(27)
Sub Clear_MB (var As Integer)
Do Until Not _MouseButton(var)
While _MouseInput: Wend
Loop
End Sub 'Clear_MB
Nice! Quite challenging to score (for me) .
I found I can "cheat" by holding mouse button down, moving to button, then release and click
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) 
Please visit my Website at: http://oldendayskids.blogspot.com/

Please visit my Website at: http://oldendayskids.blogspot.com/

