VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



THE HAPPY FACE GAME

by mahdi yassin (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 1st November 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

THE HAPPY FACE GAME

API Declarations


General

Public counter As Long
Dim s As Variant

Dim ctr As Integer
Dim str1, str2, str3, str4, str5, str6, str7, str8, str9, str10 As String
Dim sctr As Integer


Rate THE HAPPY FACE GAME




'Now we insert three Timers (Timer1, Timer2, Timer3)

'Timer1:-
 'Used for move the image matrix form button to the top and if reach to a 'specified place from the form return to the position (7000)
'interval=1500 so if the interval reach to 500 then stop program.

'Timer2:-
'this Timer used controlling the time of the game and count the number of 'images that has been clicked on it and change its place, after counting 'making a (MsgBox) that till you that you loss  the game or you the 'game
'Interval=6000 so check the Timer1 in each 6 second and decrease the interval 'by 100  

'Timer3:-

'This timer used for animation this will be done by change the  CAPTION OF THE FORM, so each time has different length 
'Interval=100






“This timer use for repeat the image for more time to up”

Private Sub Timer1_Timer ()
For i = 0 To 9
Image1(i).Top = Image1(i).Top - 500
If Image1(i).Top < 500 Then
Image1(i).Top = 7000
End If
Next i
End Sub


“This timer used for control the for the timer1 and make a MsgBox for the counter and know you if you loss or win the game”

Private Sub Timer2_Timer ()

If Timer1.Interval <= 500 Then
Timer1.Enabled = False
For i = 0 To 9
Image1(i).Visible = False
Next i

“Count the no. of happy that has been killed”
If counter >= 50 Then
MsgBox "you win the game & your bounce is:" & counter

Else

MsgBox "you loss the game & your bounce is:" & counter
End If


Else
Timer1.Interval = Timer1.Interval - 100
End If
End Sub


“This code use for make the position of image 7000 if you click on it, and count no. of them that has been changed there position”

Private Sub Image1_Click (Index as Integer)
Image1 (Index).Top = 7000
Counter = counter + 1
Label1.Caption = counter
End Sub
Private Sub form_KeyPress (KeyAscii As Integer)

'*****************************
“This code will pause the game”
'*****************************

If KeyAscii = 112 Then
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False

Label6.Visible = True
End If

'******************************
“this code make game play again”
'******************************

If KeyAscii = 13 Then
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True

Label6.Visible = False
End If

'***********************
“This code for new game”
'*********************

If Key ASCII = 110 Then

For i = 0 To 9
Image1(i).Visible = True
Image1(i).Top = 7000
Next i
Timer1.Interval = 1500
Timer1.Enabled = True
Label1.Caption = 0
counter = 0
End If

'***********************
“This code exit the game”
'***********************

If KeyAscii = 120 Then
'End
'Timer1.Enabled = False
'Timer2.Enabled = False
'Timer4.Enabled = False

s = MsgBox("do you want to exit?", 2 + 2 + 32, "exit")
 If s = 6 Then
End
End If
End If
End Sub


Private Sub Timer4_Timer ()

str1 = "HAPPY  FACE"
str2 = "H A P P Y   F A C E"
str3 = "H  A  P  P  Y    F  A  C  E"
str4 = "H   A   P   P   Y      F   A   C   E"
str5 = "H    A    P    P    Y        F    A    C    E"
str6 = "H     A     P     P     Y          F     A     C     E"
str7 = "H      A      P      P      Y            F      A      C      E"
str8 = "H       A       P      P       Y             F       A       C       E"

str9 = "H        A        P        P        Y              F        A        C        E"

str10 = "H         A         P         P         Y               F         A         C         E"

If sctr = 1 Then
Form1.Caption = str10
Else If sctr = 2 Then
Form1.Caption = str9
Else If sctr = 3 Then
Form1.Caption = str8
Else If sctr = 4 Then
Form1.Caption = str7
Else If sctr = 5 Then
Form1.Caption = str6
Else If sctr = 6 Then
Form1.Caption = str5
Else If sctr = 7 Then
Form1.Caption = str4
Else If sctr = 8 Then
Form1.Caption = str3
Else If sctr = 9 Then
Form1.Caption = str2
Else If sctr = 10 Then
Form1.Caption = str1
Sctr = 0
End If
Sctr = sctr + 1
End Sub








Download this snippet    Add to My Saved Code

THE HAPPY FACE GAME Comments

No comments have been posted about THE HAPPY FACE GAME. Why not be the first to post a comment about THE HAPPY FACE GAME.

Post your comment

Subject:
Message:
0/1000 characters