我是编码新手,有一个我无法解决的问题。我正在制作口袋妖怪的战斗场景,在击败其他玩家之后,游戏将重置。由于某种原因,如果对手拥有59点生命,并且使用了30点生命值的移动,则表示您赢了,因为现在的值是30以下。
这是我的代码的一部分
`lblComputerHealth.Text = prgcomputer.Value & "/ " & prgcomputer.Maximum
If btnPlayerChoice.Text = "blastoise" Then
If prgPlayer.Value <= 262 And prgPlayer.Value >= 183 Then
prgPlayer.ForeColor = Color.Green
ElseIf prgPlayer.Value <= 182 And prgPlayer.Value >= 131 Then
prgPlayer.ForeColor = Color.Yellow
ElseIf prgPlayer.Value <= 130 And prgPlayer.Value >= 66 Then
prgPlayer.ForeColor = Color.Orange
ElseIf prgPlayer.Value <= 65 Then
prgPlayer.ForeColor = Color.Red
End If
If frmSplash.btnComputer.Text = "blastoise" Then
If prgcomputer.Value <= 262 And prgcomputer.Value >= 183 Then
prgcomputer.ForeColor = Color.Green
ElseIf prgcomputer.Value <= 182 And prgcomputer.Value >= 131 Then
prgcomputer.ForeColor = Color.Yellow
ElseIf prgcomputer.Value <= 130 And prgcomputer.Value >= 66 Then
prgcomputer.ForeColor = Color.Orange
ElseIf prgcomputer.Value <= 65 Then
prgcomputer.ForeColor = Color.Red
End If
End If
If prgcomputer.Value <= 30 Then
'ADD A DO YOU WISH TO PLAY AGAIN BUTTON
MessageBox.Show("YOU WON")
intWins += 1
frmSplash.btnPlayerChoiceone.Text = ""
intwhy = 1
strplayerchoice = ""
intCompAttack = 0
intwhyone = 0
strcool = ""
frmSplash.btnComputer.Text = ""
frmSplash.btnPlayerChoiceone.Text = ""
picPlayer.Image = Nothing
picComputer.Image = Nothing
btnChoosePlayer.Visible = True
btnMoveOne.Visible = False
btnMoveTwo.Visible = False
btnMoveThree.Visible = False
btnMoveFour.Visible = False
prgPlayer.Value = 262
prgcomputer.Value = 262
lblWins.Text = intWins
prgcomputer.ForeColor = Color.ForestGreen
prgPlayer.ForeColor = Color.Green
Else
prgcomputer.Value = prgcomputer.Value - 30
End If
End If
If frmSplash.btnComputer.Text = "blastoise" Then
MessageBox.Show("Oponent thinking of move")
Threading.Thread.Sleep(1000)
intCompAttack = rand.Next(2) 'you will have to make this 3 some day
Select Case intCompAttack
Case 0
prgPlayer.Value -= 20
lblPlayerHealth.Text = prgPlayer.Value & "/ " & prgPlayer.Maximum
MessageBox.Show("Opponent used Tackle and delt 20 damage")
'use a loop in the animation
Case 1
prgPlayer.Value -= 30
lblPlayerHealth.Text = prgPlayer.Value & "/ " & prgPlayer.Maximum
MessageBox.Show("opponent used Water Gun and delt 30 damage")
End Select
End If'
这是我认为不起作用的部分
'If prgcomputer.Value <= 30 Then
'ADD A DO YOU WISH TO PLAY AGAIN BUTTON
MessageBox.Show("YOU WON")
intWins += 1
frmSplash.btnPlayerChoiceone.Text = ""
intwhy = 1
strplayerchoice = ""
intCompAttack = 0
intwhyone = 0
strcool = ""
frmSplash.btnComputer.Text = ""
frmSplash.btnPlayerChoiceone.Text = ""
picPlayer.Image = Nothing
picComputer.Image = Nothing
btnChoosePlayer.Visible = True
btnMoveOne.Visible = False
btnMoveTwo.Visible = False
btnMoveThree.Visible = False
btnMoveFour.Visible = False
prgPlayer.Value = 262
prgcomputer.Value = 262
lblWins.Text = intWins
prgcomputer.ForeColor = Color.ForestGreen
prgPlayer.ForeColor = Color.Green
Else
prgcomputer.Value = prgcomputer.Value - 30
End If `
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。