vb.net小游戏代码 vb游戏代码大全

vb.net做石头剪刀布小游戏我也是新手,随便做个玩玩 。把RadioButton0,1,2放一个容器里!
Public Class Form1
Dim win1 As Integer = 0
Dim win2 As Integer = 0
Dim i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str As Integer
Dim rand As New Random()
str =rand.Next(3)'随机数
If str = 0 Then
RadioButton0.Checked = True
ElseIf str = 1 Then
RadioButton1.Checked = True
ElseIf str = 2 Then
RadioButton2.Checked = True
End If
If RadioButton3.Checked = True Then
i = 0
ElseIf RadioButton4.Checked = True Then
i = 1
ElseIf RadioButton5.Checked = True Then
i = 2
Else
MsgBox("请选择要出的拳法!")
End If
If (str = 0 And i = 1) Or (str = 1 And i = 2) Or (str = 2 And i = 0) Then
win1 += 1
TextBox1.Text = "玩家胜利"
ElseIf (str = 0 And i = 2) Or (str = 1 And i = 0) Or (str = 2 And i = 1) Then
win2 += 1
TextBox1.Text = "电脑胜利"
Else
TextBox1.Text = "平手"
End If'判断胜利者
TextBox2.Text = win1
TextBox3.Text = win2
If win1 = 5 Then
MsgBox("最终胜利者是玩家!恭喜!")
win1 = 0
win2 = 0
For i = 0 To Me.Controls.Count - 1
If TypeOf (Me.Controls(i)) Is TextBox Then
Me.Controls(i).Text = ""
End If'清空过时信息
Next
ElseIf win2 = 5 Then
MsgBox("最终胜利者是电脑!")
win1 = 0
win2 = 0
For i = 0 To Me.Controls.Count - 1
If TypeOf (Me.Controls(i)) Is TextBox Then
Me.Controls(i).Text = ""
End If'清空过时信息
Next
End If
End Sub
End Class
纯属新手,高手毋笑!
VB.Net猜字小游戏源代码 。这并不难,但程序肯定很长 , 其实,只要你已经学会了VB,这个问题并不难,但只是懒惰 。,你应该自己编的,遇到问题,我们要问,请不要问 。
锤子,图片显示和隐藏的Visible属性设置为指示的出现和消失的仓鼠,您可以使用自定义鼠标 。
求跳棋游戏VB代码VB跳棋代码:
窗体代码:
Dim ChessBoard(-2 To 10, -2 To 10) As Byte ''棋盘(8竖*8棋)
Dim x(10) As Integer, y(10) As Integer''搜索的每种走法
Dim x1(10) As Integer, y1(10) As Integer''搜索的每种走法的可吃子坐标
Dim BestLocate As CHESSER
Dim CurrentPlayer As Byte''当前玩家
Dim CurrentStep As Integer''当前步
Dim 人机模式 As Boolean
Dim cSel As Byte''玩家选择了哪个棋子
Dim tTemp As Boolean
Const MAXDOWNPOINT = 7
Rem 如果Cer为1(黑方),则返回2(红方),否则返加1(黑方)
Public Function NextCer(ByVal Cer As Byte) As Byte
NextCer = 1
If Cer = 1 Then NextCer = 2
End Function
Rem 棋盘
Private Sub Initial()
Dim i As Integer, j As Integer
For i = 1 To 8: For j = 1 To 8: ChessBoard(i, j) = 0: Next j: Next i
ChessBoard(1, 2) = 201
ChessBoard(1, 4) = 201
ChessBoard(1, 6) = 201
ChessBoard(1, 8) = 201
ChessBoard(2, 1) = 201
ChessBoard(2, 3) = 201
ChessBoard(2, 5) = 201
ChessBoard(2, 7) = 201
ChessBoard(3, 2) = 201
ChessBoard(3, 4) = 201
ChessBoard(3, 6) = 201
ChessBoard(3, 8) = 201
ChessBoard(6, 1) = 101
ChessBoard(6, 3) = 101
ChessBoard(6, 5) = 101
ChessBoard(6, 7) = 101
ChessBoard(7, 2) = 101
ChessBoard(7, 4) = 101
ChessBoard(7, 6) = 101
ChessBoard(7, 8) = 101
ChessBoard(8, 1) = 101
ChessBoard(8, 3) = 101
ChessBoard(8, 5) = 101
ChessBoard(8, 7) = 101
End Sub
Rem 反显示(将屏幕显示的内容存入ChessBoard数组)
Private Sub ReDisplay()
Dim i As Integer, j As Integer, k As Integer

推荐阅读