1.vbС?小游戏源?ϷԴ??
2.vb游戏代码大全vb小游戏源代码
3.诚征vb小游戏代码
4.如何用vb做一个小游戏
vbС??ϷԴ??
代码
如下。。小游戏源用
随机函数
rnd
0-9
。小游戏源。小游戏源这样0-4为甲胜利
。小游戏源5-9为
乙胜利
如果你还不懂。小游戏源caffe源码 什么语言。小游戏源朋友
改行吧。小游戏源。小游戏源
Private
Sub
Command1_Click()
Dim
a
As
Double
a
=
Int(Rnd
*
)
If
a
<=
4
The小游戏源n
"甲胜利"
Else
"乙胜利"
End
If
End
Sub
vb游戏代码大全vb小游戏源代码
关于vb游戏代码大全,vb小游戏源代码这个很多人还不知道,小游戏源今天来为大家解答以上的小游戏源问题,现在让我们一起来看看吧!小游戏源
1、小游戏源Rem 窗体创建三个单选框按钮,小游戏源YY机器人源码定做OptionOption2、Option3 Private Sub Form_Activate() Option1.Caption = "石头" Option2.Caption = "剪刀" Option3.Caption = "布" Option1.Value = False Option2.Value = False Option3.Value = False End Sub Private Sub Option1_Click() Randomize Select Case Int(3 * Rnd) Case 0: MsgBox "对方也出石头!继续!" Case 1: MsgBox "哈哈!你赢了!对方出的是剪刀!奖励你一个苹果!java待办事项提醒源码" Case 2: MsgBox "你输了!对方出的是布哦!不好意思,苹果给对方了哈!" End Select Option1.Value = False End Sub Private Sub Option2_Click() Randomize Select Case Int(3 * Rnd) Case 0: MsgBox "你输了!对方出的是石头哦!不好意思。同花顺软件分时图源码
2、苹果给对方了哈!" Case 1: MsgBox "对方也出剪刀!继续!" Case 2: MsgBox "哈哈!你赢了!对方出的2022三方支付源码是布!奖励你一个苹果!" End Select Option2.Value = False End Sub Private Sub Option3_Click() Randomize Select Case Int(3 * Rnd) Case 0: MsgBox "哈哈!你赢了!对方出的是石头!奖励你一个苹果!" Case 1: MsgBox "你输了!对方出的是剪刀哦!不好意思,苹果给对方了哈!" Case 2: MsgBox "对方也出布!继续!" End Select Option3.Value = False End Sub。
诚征vb小游戏代码
贪吃蛇
Option Explicit
Private WithEvents Timer1 As Timer
Private WithEvents Label1 As Label
Dim GFangXiang As Boolean
Dim HWB As Single
Dim She() As ShenTi
Dim X As Long, Y As Long
Dim ZhuangTai(, ) As Long
Private Type ShenTi
F As Long
X As Long
Y As Long
End Type
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim C As Long
If KeyCode = Then End
If KeyCode = Then
If Timer1.Enabled = True Then
Timer1.Enabled = False
Label1.Visible = True
Else
Timer1.Enabled = True
Label1.Visible = False
End If
End If
C = UBound(She)
If GFangXiang = True Then Exit Sub
Select Case KeyCode
Case
If She(C).F = 2 Then Exit Sub
She(C).F = 0
GFangXiang = True
Case
If She(C).F = 3 Then Exit Sub
She(C).F = 1
GFangXiang = True
Case
If She(C).F = 0 Then Exit Sub
She(C).F = 2
GFangXiang = True
Case
If She(C).F = 1 Then Exit Sub
She(C).F = 3
GFangXiang = True
End Select
End Sub
Private Sub Form_Load()
Me.AutoRedraw = True
Me.BackColor = &HC&
Me.FillColor =
Me.FillStyle = 0
Me.ScaleWidth =
Me.ScaleHeight =
Me.WindowState = 2
Set Timer1 = Controls.Add("VB.Timer", "Timer1")
Set Label1 = Controls.Add("VB.Label", "Label1")
Label1.AutoSize = True
Label1.BackStyle = 0
Label1 = "暂停"
Label1.ForeColor = RGB(, , 0)
Label1.FontSize =
ChuShiHua
End Sub
Private Sub Form_Resize()
On Error GoTo 1:
With Me
If .WindowState <> 1 Then
.Cls
.ScaleMode = 3
HWB = .ScaleHeight / .ScaleWidth
.ScaleWidth =
.ScaleHeight =
Label1.Move (Me.ScaleWidth - Label1.Width) / 2, (Me.ScaleHeight - Label1.Height) / 2
HuaTu
Me.Line (X, Y)-(X + 1, Y + 1), RGB(, , 0), BF
End If
End With
1:
End Sub
Private Sub Timer1_Timer()
Dim C As Long, I As Long
On Error GoTo 2:
QingChu
C = UBound(She)
Select Case She(C).F
Case 0
If ZhuangTai(She(C).X - 1, She(C).Y) = 2 Then
C = C + 1
ReDim Preserve She(C)
She(C).F = She(C - 1).F
She(C).X = She(C - 1).X - 1
She(C).Y = She(C - 1).Y
ChanShengShiWu
GoTo 1:
ElseIf ZhuangTai(She(C).X - 1, She(C).Y) = 1 Then
GoTo 2:
End If
Case 1
If ZhuangTai(She(C).X, She(C).Y - 1) = 2 Then
C = C + 1
ReDim Preserve She(C)
She(C).F = She(C - 1).F
She(C).X = She(C - 1).X
She(C).Y = She(C - 1).Y - 1
ChanShengShiWu
GoTo 1:
ElseIf ZhuangTai(She(C).X, She(C).Y - 1) = 1 Then
GoTo 2:
End If
Case 2
If ZhuangTai(She(C).X + 1, She(C).Y) = 2 Then
C = C + 1
ReDim Preserve She(C)
She(C).F = She(C - 1).F
She(C).X = She(C - 1).X + 1
She(C).Y = She(C - 1).Y
ChanShengShiWu
GoTo 1:
ElseIf ZhuangTai(She(C).X + 1, She(C).Y) = 1 Then
GoTo 2:
End If
Case 3
If ZhuangTai(She(C).X, She(C).Y + 1) = 2 Then
C = C + 1
ReDim Preserve She(C)
She(C).F = She(C - 1).F
She(C).X = She(C - 1).X
She(C).Y = She(C - 1).Y + 1
ChanShengShiWu
GoTo 1:
ElseIf ZhuangTai(She(C).X, She(C).Y + 1) = 1 Then
GoTo 2:
End If
End Select
ZhuangTai(She(0).X, She(0).Y) = 0
For I = 0 To C
Select Case She(I).F
Case 0
She(I).X = She(I).X - 1
Case 1
She(I).Y = She(I).Y - 1
Case 2
She(I).X = She(I).X + 1
Case 3
She(I).Y = She(I).Y + 1
End Select
Next
TiaoZheng
1:
GFangXiang = False
ZhuangTai(She(C).X, She(C).Y) = 1
HuaTu
Exit Sub
2:
If MsgBox("游戏结束,点“是”重新开始游戏,点“否”", vbYesNo, "贪吃蛇") = vbYes Then
ChuShiHua
Else
End
End If
End Sub
Private Sub ChuShiHua()
Me.Cls
Timer1.Enabled = True
Timer1.Interval =
Erase ZhuangTai
ReDim She(2)
She(0).F = 2
She(0).X = 9
She(0).Y =
ZhuangTai(9, ) = 1
She(1).F = 2
She(1).X =
She(1).Y =
ZhuangTai(, ) = 1
She(2).F = 2
She(2).X =
She(2).Y =
ZhuangTai(, ) = 1
HuaTu
ChanShengShiWu
End Sub
Private Sub QingChu()
Dim I As Long
For I = 0 To UBound(She)
Me.Line (She(I).X, She(I).Y)-(She(I).X + 1, She(I).Y + 1), Me.BackColor, BF
Next
End Sub
Private Sub HuaTu()
Dim I As Long
For I = 0 To UBound(She)
Me.Circle (She(I).X + 0.5, She(I).Y + 0.5), 0., RGB(, , 0), , , HWB
Next
End Sub
Private Sub TiaoZheng()
Dim I As Long
For I = 0 To UBound(She) - 1
She(I).F = She(I + 1).F
Next
End Sub
Private Sub ChanShengShiWu()
Randomize Timer
1:
X = Int(Rnd * )
Y = Int(Rnd * )
If ZhuangTai(X, Y) > 0 Then GoTo 1:
ZhuangTai(X, Y) = 2
Me.Line (X, Y)-(X + 1, Y + 1), RGB(, , 0), BF
End Sub
如何用vb做一个小游戏
1、首先双击桌面图标启动 visual basic 6.0。2、然后新建工程,选择标准EXE。
3、选择完工程后,点击打开,就可以新建一个exe工程了。
4、然后双击 FORM1 窗体,在弹出的代码窗体中复制该代码到 Form_Click() 事件中。
5、代码:If a * + b * + c = a ^ 3 + b ^ 3 + c ^ 3 Thenn = n + 1If (n Mod 5) = 0 Then
Print a & b & cElsePrint a & b & c,End IfEnd IfNext cNext bNext aPrint Chr() & Chr() & "三位数中水仙花数个数为" &n。最后运行这样就完成了。