vb制作, 我用vb制作了一个小游戏 打怪升级类

来源:百度知道 编辑:UC知道 时间:2024/06/17 09:12:46
血为1000 蓝为500 对手攻击力100 血400 我每次攻击耗蓝20 每个人血为0时输 蓝为0时 无法攻击 点击command1 进行攻击 无法攻击时弹出对话框为
“无法攻击”
因为我是菜鸟
所以 各位大虾 要把代码发过来 有没有解说无所谓 我可以自己研究

'插入3个text,一个command
Private Sub form_load()
Text1.Text = "1000" '血量
Text2.Text = "500" '魔
Text3.Text = "400" '对手
End Sub

Private Sub command1_click()
If Text1.Text = "0" Or Text2.Text = "0" Then
MsgBox "无法攻击!"
Else:
Do
Text1.Text = Text1.Text - 100
Text2.Text = Text2.Text - 20
Text3.Text = Text3.Text - 200 '你的攻击力暂定为200
Loop Until Text3.Text = "0"
MsgBox "本轮进攻胜利!"
End If
Text3.Text = "400"
End Sub

if语句里面判断情况,然后msgbox弹出对话框。