I'm sure many of you have already made this game, but I wanted to see if I could do it without any help.
You got 120 seconds to see how many times you can use the mouse to click the button. Plus there's the option to start over.
You got 120 seconds to see how many times you can use the mouse to click the button. Plus there's the option to start over.
Code: (Select All)
Screen _NewImage(800, 600, 32)
begin:
score = 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 350
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
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

