|
-
Oct 19th, 2008, 12:19 AM
#1
Thread Starter
New Member
[RESOLVED] HELP! Paper, Scissor, Rocks game
I'm trying to make the classic paper scissor rocks game for my school assignment, but i'm having some problems...
I have 3 commands (Paper, Scissor, Rock) each that triggers an image to appear when their clicked.
I then have a command button that says Result and if I press that the computer should choose an option and then depending on my choice resulting that he wins or loses
Anyone have any help plz?
Heres's a picture of the form

Here's the code:
Code:
Dim winner, tie, lose As Boolean
Dim game As Integer
Private Sub cmdAbout_Click()
MsgBox ("The objective of this game is to beat your opponent using any of the 3 objects: Rock, Paper or Scissors. The game works as follow: Rock > Scissors, Rock < Paper,Scissors > Paper, if you have the same object then it's a draw.")
End Sub
Private Sub cmdMainMenu_Click()
Form1.Visible = True
Form3.Visible = False
End Sub
Private Sub cmdPaper_Click()
imgGrid.Picture = imgPaper.Picture
Label2.Caption = "Paper"
End Sub
Private Sub cmdPlayAgain_Click()
Label2.Caption = ""
imgGrid.Picture = Image7.Picture
imgGridPC.Picture = Image7.Picture
End Sub
Private Sub cmdResult_Click()
Randomize
game = Int(Rnd * 3 + 1)
imgPaper.Visible = False
imgScissor.Visible = False
imgRock.Visible = False
imgPaper.Picture = Paper
imgScissor.Picture = Scissor
imgRock.Picture = Rock
Paper = 1
Scissor = 2
Rock = 3
'Paper
If game = 1 And imgGrid.Picture = imgPaper.Picture Then
tie = True
Else
If game = 1 And imgGrid.Picture = imgScissor.Picture Then
winner = True
Else
If game = 1 And imgGrid.Picture = imgRock.Picture Then
lose = True
Else
'Scissor
If game = 2 And imgGrid.Picture = imgPaper.Picture Then
lose = True
Else
If game = 2 And imgGrid.Picture = imgScissor.Picture Then
tie = True
Else
If game = 2 And imgGrid.Picture = imgRock.Picture Then
winner = True
Else
'Rock
If game = 3 And imgGrid.Picture = imgPaper.Picture Then
winner = True
Else
If game = 3 And imgGrid.Picture = imgScissor.Picture Then
lose = True
Else
If game = 3 And imgGrid.Picture = imgRock.Picture Then
tie = True
If tie = True Then
Label2.Caption = "Game Tied, Try again"
End If
If winner = True Then
Label2.Caption = "Congratulations! You've won!"
End If
If lose = True Then
Label2.Caption = "Sorry, you lost"
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
Private Sub cmdRock_Click()
imgGrid.Picture = imgRock.Picture
Label2.Caption = "Rock"
End Sub
Private Sub cmdScissor_Click()
imgGrid.Picture = imgScissor.Picture
Label2.Caption = "Scissor"
End Sub
Private Sub Timer1_Timer()
If winner = True Then
Image1.Visible = True
Image4.Visible = False
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
If winner = True Then
Image2.Visible = True
Image1.Visible = False
Timer2.Enabled = False
Timer3.Enabled = True
End If
End Sub
Private Sub Timer3_Timer()
If winner = True Then
Image3.Visible = True
Image2.Visible = False
Timer3.Enabled = False
Timer4.Enabled = True
End If
End Sub
Private Sub Timer4_Timer()
If winner = True Then
Image4.Visible = True
Image3.Visible = False
Timer4.Enabled = False
Timer1.Enabled = True
End If
End Sub
-
Oct 19th, 2008, 01:49 AM
#2
Thread Starter
New Member
Re: HELP! Paper, Scissor, Rocks game
-
Oct 19th, 2008, 04:23 PM
#3
Hyperactive Member
Re: HELP! Paper, Scissor, Rocks game
Well you didn't even tell us what your issue is... but I see that your IF THEN structure is wrong. It needs to look like this:
Code:
If condition Then
'do this
ElseIf OtherCondition Then
'do this
ElseIf blahblah Then
'etc
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|