1.  > 游戏大全

游戏vb代码大全,vb小游戏代码大全

游戏vb代码大全,vb小游戏代码大全

大家好,今天小编关注到一个比较有意思的话题,就是关于游戏vb代码大全的问题,于是小编就整理了1个相关介绍游戏vb代码大全的解答,让我们一起看看吧。

  1. 求一个简单的vb小游戏制作代码?

1、求一个简单的vb小游戏制作代码?

贪吃蛇Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)Dim C As LongIf KeyCode = 27 Then EndIf KeyCode = 32 ThenIf Timer1.Enabled = True ThenTimer1.Enabled = FalseLabel1.Visible = TrueElseTimer1.Enabled = TrueLabel1.Visible = FalseEnd IfEnd IfC = UBound(She)If GFangXiang = True Then Exit SubSelect Case KeyCodeCase 37If She(C).F = 2 Then Exit SubShe(C).F = 0GFangXiang = TrueCase 38If She(C).F = 3 Then Exit SubShe(C).F = 1GFangXiang = TrueCase 39If She(C).F = 0 Then Exit SubShe(C).F = 2GFangXiang = TrueCase 40If She(C).F = 1 Then Exit SubShe(C).F = 3GFangXiang = TrueEnd SelectEnd SubPrivate Sub Form_Load()Me.AutoRedraw = TrueMe.BackColor = amp;HC000amp;Me.FillColor = 255Me.FillStyle = 0Me.ScaleWidth = 24Me.ScaleHeight = 24Me.WindowState = 2Set Timer1 = Controls.Add("VB.Timer", "Timer1")Set Label1 = Controls.Add("VB.Label", "Label1")Label1.AutoSize = TrueLabel1.BackStyle = 0Label1 = "暂停"Label1.ForeColor = RGB(255, 255, 0)Label1.FontSize = 50ChuShiHuaEnd SubPrivate Sub Form_Resize()On Error GoTo 1:With MeIf .WindowState lt;gt; 1 Then.Cls.ScaleMode = 3HWB = .ScaleHeight / .ScaleWidth.ScaleWidth = 24.ScaleHeight = 24Label1.Move (Me.ScaleWidth - Label1.Width) / 2, (Me.ScaleHeight - Label1.Height) / 2HuaTuMe.Line (X, Y)-(X 1, Y 1), RGB(255, 255, 0), BFEnd IfEnd With1:End SubPrivate Sub Timer1_Timer()Dim C As Long, I As LongOn Error GoTo 2:QingChuC = UBound(She)Select Case She(C).FCase 0If ZhuangTai(She(C).X - 1, She(C).Y) = 2 ThenC = C 1ReDim Preserve She(C)She(C).F = She(C - 1).FShe(C).X = She(C - 1).X - 1She(C).Y = She(C - 1).YChanShengShiWuGoTo 1:ElseIf ZhuangTai(She(C).X - 1, She(C).Y) = 1 ThenGoTo 2:End IfCase 1If ZhuangTai(She(C).X, She(C).Y - 1) = 2 ThenC = C 1ReDim Preserve She(C)She(C).F = She(C - 1).FShe(C).X = She(C - 1).XShe(C).Y = She(C - 1).Y - 1ChanShengShiWuGoTo 1:ElseIf ZhuangTai(She(C).X, She(C).Y - 1) = 1 ThenGoTo 2:End IfCase 2If ZhuangTai(She(C).X 1, She(C).Y) = 2 ThenC = C 1ReDim Preserve She(C)She(C).F = She(C - 1).FShe(C).X = She(C - 1).X 1She(C).Y = She(C - 1).YChanShengShiWuGoTo 1:ElseIf ZhuangTai(She(C).X 1, She(C).Y) = 1 ThenGoTo 2:End IfCase 3If ZhuangTai(She(C).X, She(C).Y 1) = 2 ThenC = C 1ReDim Preserve She(C)She(C).F = She(C - 1).FShe(C).X = She(C - 1).XShe(C).Y = She(C - 1).Y 1ChanShengShiWuGoTo 1:ElseIf ZhuangTai(She(C).X, She(C).Y 1) = 1 ThenGoTo 2:End IfEnd SelectZhuangTai(She(0).X, She(0).Y) = 0For I = 0 To CSelect Case She(I).FCase 0She(I).X = She(I).X - 1Case 1She(I).Y = She(I).Y - 1Case 2She(I).X = She(I).X 1Case 3She(I).Y = She(I).Y 1End SelectNextTiaoZheng1:GFangXiang = FalseZhuangTai(She(C).X, She(C).Y) = 1HuaTuExit Sub2:If MsgBox("游戏结束,点“是”重新开始游戏,点“否”", vbYesNo, "贪吃蛇") = vbYes ThenChuShiHuaElseEndEnd IfEnd SubPrivate Sub ChuShiHua()Me.ClsTimer1.Enabled = TrueTimer1.Interval = 200Erase ZhuangTaiReDim She(2)She(0).F = 2She(0).X = 9She(0).Y = 11ZhuangTai(9, 11) = 1She(1).F = 2She(1).X = 10She(1).Y = 11ZhuangTai(10, 11) = 1She(2).F = 2She(2).X = 11She(2).Y = 11ZhuangTai(11, 11) = 1HuaTuChanShengShiWuEnd SubPrivate Sub QingChu()Dim I As LongFor I = 0 To UBound(She)Me.Line (She(I).X, She(I).Y)-(She(I).X 1, She(I).Y 1), Me.BackColor, BFNextEnd SubPrivate Sub HuaTu()Dim I As LongFor I = 0 To UBound(She)Me.Circle (She(I).X 0.5, She(I).Y 0.5), 0.49, RGB(255, 255, 0), , , HWBNextEnd SubPrivate Sub TiaoZheng()Dim I As LongFor I = 0 To UBound(She) - 1She(I).F = She(I 1).FNextEnd SubPrivate Sub ChanShengShiWu()Randomize Timer1:X = Int(Rnd * 24)Y = Int(Rnd * 24)If ZhuangTai(X, Y) gt; 0 Then GoTo 1:ZhuangTai(X, Y) = 2Me.Line (X, Y)-(X 1, Y 1), RGB(255, 255, 0), BFEnd Sub

关于游戏vb代码大全和vb小游戏代码大全的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。 游戏vb代码大全的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb小游戏代码大全、游戏vb代码大全的信息别忘了在本站进行查找喔。

[免责声明]本文来源于网络,不代表本站立场,如转载内容涉及版权等问题,请联系邮箱:83115484#qq.com,#换成@即可,我们会予以删除相关文章,保证您的权利。 转载请注明出处:http://www.dmrkw.com/wenda/10435.html

联系我们

电话:400-658-2019

微信号:7151897

工作日:9:30-18:30,节假日休息