I'm new to vb and I'm trying to make a game where you choose yes/no questions to continue the story. Make the right choices, you win. Otherwise you die and its game over. I made a button and all events happen in there.
int ques # corresponds with a choice in the story
Public Sub BtnNextQ_Click(sender As Object, e As EventArgs) Handles BtnNextQ.Click
Ques = 1
If Ques = 1 And RadioBtnYes.Checked = True Then
Ques = 2
ElseIf Ques = 1 And RadioBtnNo.Checked = True Then
Ques = 11
ElseIf Ques = 2 And RadioBtnYes.Checked = True Then
Ques = 22
ElseIf Ques = 2 And RadioBtnNo.Checked = True Then
Ques = 3
End If
Label1.Text = Ques
If Ques = 1 Then
RchTxtBoxStory.Text = "You are walking home from work and decide to take a shortcut through an alley way. You see a bum getting beaten by a group of 5 men in shaggy clothes. One of the guys notice you. Do you help?"
End If
If Ques = 11 Then
RchTxtBoxStory.Text = "You shout out “"HEY, WHAT ARE YOU DOING TO HIM!?”" They grab you and beat you up too. GAME OVER"
End If
If Ques = 2 Then
RchTxtBoxStory.Text = "you turn around and walk the other way feeling guilty you couldn’t do anything. You’re out on the street and go home the long way. After a few blocks you notice a man in a hood following you. There’s no one else around. Do you run?"
End If
If Ques = 22 Then
RchTxtBoxStory.Text = "You begin to run and assume you lost the hooded man. Go directly home?"
End If
If Ques = 3 Then
RchTxtBoxStory.Text = "You continue walking pretending you didn’t see him. Do you go directly home? "
End If
The problem is whenever I click the button, the story never gets past the first scenario. I thought it was because every time I pressed the button it reverted int ques back to 1, but don't know how to make the ques keep going through the if statements.
Aucun commentaire:
Enregistrer un commentaire