| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5293 人关注过本帖
标题:求解!!
只看楼主 加入收藏
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:10 

DO IT YOURSELF !
2013-06-20 08:24
yuccn
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:何方
等 级:版主
威 望:167
帖 子:6815
专家分:42393
注 册:2010-12-16
收藏
得分:10 
vs2010 好用点,v6,太老了,不习惯

我行我乐
公众号:逻辑客栈
我的博客:
https://blog.yuccn. net
2013-06-20 09:03
Artless
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:103
帖 子:4211
专家分:28888
注 册:2009-4-8
收藏
得分:10 
...

无知
2013-06-20 10:59
snrtjat
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:山那边 海尽头
等 级:贵宾
威 望:22
帖 子:1115
专家分:7025
注 册:2013-1-21
收藏
得分:10 
程序代码:
'VB6 贪吃蛇
Option Explicit
Dim aspect
Dim Score As Integer

Private Sub Begin_Click()
    Lbl_start_Click
End Sub

Private Sub Exit_Click()
    If MsgBox("Í˳öÓÎÏ·£¿", vbYesNo + vbInformation, "ÐÅÏ¢Ìáʾ") = vbYes Then End
End Sub

Private Sub Form_Activate()
    Dim i As Integer
    Pic(0).Left = 20
    Pic(0).Top = 50
    For i = 1 To Pic.UBound
        Pic(i).Left = Pic(i - 1).Left - 5
        Pic(i).Top = Pic(i - 1).Top
    Next i
    aspect = 2
End Sub

Private Sub Form_Resize()
    PicRect.Cls
    Dim i As Integer
    PicRect.ScaleWidth = 150
    PicRect.ScaleHeight = 125
    For i = 0 To PicRect.ScaleWidth Step 5
'        PicRect.Line (i, 0)-(i, PicRect.ScaleHeight), vbYellow
'        PicRect.Line (0, i)-(PicRect.ScaleWidth, i), vbYellow
    Next i
    For i = 0 To Pic.UBound
        Pic(i).Width = Int(PicRect.ScaleWidth / 30)
        Pic(i).Height = Int(PicRect.ScaleHeight / 25)
    Next i
End Sub

Private Sub Label2_Click()

End Sub

Private Sub Lbl_start_Click()
    Dim i As Integer
    PicAdd.Visible = False
    Picmore.Visible = False
    Pic(0).Left = 15
    Pic(0).Top = 50
    For i = Pic.UBound To 4 Step -1
        Unload Pic(i)
    Next i
    For i = 1 To Pic.UBound
        Pic(i).Left = Pic(i - 1).Left - Pic(i).Width
        Pic(i).Top = Pic(i - 1).Top
    Next i
    '    Command2.Caption = "ÔÝÍ£"
    aspect = 2
    Label1.Caption = 0
    Timer1.Enabled = True
    Timer2.Enabled = True
End Sub

Private Sub Lbl_stop_Click()
    If Lbl_stop.Tag = "ÔÝÍ£" Then
        Lbl_stop.Tag = "¼ÌÐø"
        Timer1.Enabled = False
        Timer2.Enabled = False
    Else
        Lbl_stop.Tag = "ÔÝÍ£"
        Timer1.Enabled = True
        Timer2.Enabled = True
    End If
End Sub

Private Sub Pause_Click()
    Timer1.Enabled = False
    Timer2.Enabled = False
End Sub


Private Sub PicRect_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 37 And Pic(0).Top <> Pic(1).Top Then
        aspect = 1 '&Iuml;ò×ó±ê&frac14;&Ccedil;&Icirc;&ordf;1
    ElseIf KeyCode = 40 And Pic(0).Left <> Pic(1).Left Then
        aspect = 4 '&Iuml;ò&Iuml;&Acirc;±ê&frac14;&Ccedil;&Icirc;&ordf;4
    ElseIf KeyCode = 39 And Pic(0).Top <> Pic(1).Top Then
        aspect = 2 '&Iuml;ò&Oacute;&Ograve;±ê&frac14;&Ccedil;&Icirc;&ordf;2
    ElseIf KeyCode = 38 And Pic(0).Left <> Pic(1).Left Then
        aspect = 3 '&Iuml;ò&Eacute;&Iuml;±ê&frac14;&Ccedil;&Icirc;&ordf;3
    End If
End Sub

Private Sub posthaste_Click()
    Timer1.Interval = 100
End Sub

Private Sub rapid_Click()
    Timer1.Interval = 300
End Sub

Private Sub slow_Click()
    Timer1.Interval = 500
End Sub

Private Sub Timer1_Timer()
    Dim PreX, PreY
    Dim PreX1, PreY1
    Dim i As Integer
    For i = 0 To Pic.UBound
        If i = 0 Then
            PreX1 = Pic(0).Left
            PreY1 = Pic(0).Top
            If aspect = 2 Then
                Pic(0).Left = Pic(0).Left + 5
            ElseIf aspect = 1 Then
                Pic(0).Left = Pic(0).Left - 5
            ElseIf aspect = 4 Then
                Pic(0).Top = Pic(0).Top + 5
            ElseIf aspect = 3 Then
                Pic(0).Top = Pic(0).Top - 5
            End If
        Else
            If Pic(0).Left = Pic(i).Left And Pic(0).Top = Pic(i).Top Then
                Timer1.Enabled = False
                Timer2.Enabled = False
            End If
            PreX = Pic(i).Left
            PreY = Pic(i).Top
            Pic(i).Left = PreX1
            Pic(i).Top = PreY1
            PreX1 = PreX
            PreY1 = PreY
        End If
    Next i
    If Pic(0).Left < 0 Or Pic(0).Left + Pic(0).Width > PicRect.ScaleWidth _
       Or Pic(0).Top < 0 Or Pic(0).Top + Pic(0).Height > PicRect.ScaleHeight Then
        Timer1.Enabled = False
        Timer2.Enabled = False
    End If
    PicRect.SetFocus
    If Pic(0).Left = PicAdd.Left And Pic(0).Top = PicAdd.Top Then
        Load Pic(Pic.Count)
        Set Pic(Pic.UBound).Container = PicRect
        Pic(Pic.UBound).Picture = Pic(1).Picture
        Pic(Pic.UBound).Visible = True
        PicAdd.Visible = False
        Score = Score + 1
        Label1.Caption = Score
    End If
    If Pic(0).Left = Picmore.Left And Pic(0).Top = Picmore.Top Then
        Score = Score + 5
        Label1.Caption = Score
        For i = 1 To 3
            Load Pic(Pic.Count)
            Set Pic(Pic.UBound).Container = PicRect
            Pic(Pic.UBound).Picture = Pic(1).Picture
            Pic(Pic.UBound).Visible = True
            Picmore.Visible = False
        Next i
    End If

End Sub

Private Sub Timer2_Timer()
    Dim i As Integer
    Static n As Integer
    n = n + 1
X:
    If n Mod 5 = 0 Then
        PicAdd.Visible = False
        PicAdd.Left = 100
        Picmore.Left = Int(Rnd * 10) * 10
        Picmore.Top = Int(Rnd * 10) * 10
        For i = 0 To Pic.UBound
            If Picmore.Left = Pic(i).Left And Picmore.Top = Pic(i).Top Then GoTo X
        Next i
        Picmore.Visible = True
    Else
        Picmore.Visible = False
        Picmore.Left = 100
        PicAdd.Left = Int(Rnd * 10) * 10
        PicAdd.Top = Int(Rnd * 10) * 10
        For i = 0 To Pic.UBound
            If PicAdd.Left = Pic(i).Left And PicAdd.Top = Pic(i).Top Then GoTo X
        Next i
        PicAdd.Visible = True
    End If
End Sub

不怕错误,只怕知错不改.
2013-06-20 15:43
迪达拉
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:479
专家分:1070
注 册:2013-4-3
收藏
得分:0 
http://pan.baidu.com/share/link?shareid=195080&uk=4211438870#dir/path=%2F%E6%88%91%E7%9A%84%E8%A7%86%E9%A2%91%2F%E6%88%91%E6%9D%A5%E8%AF%B4%E8%AF%B4%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%20%E7%AC%AC01%E5%AD%A3



上面是下载地址

http://tieba.baidu.com/p/2039621772?pn=1

这个是原帖子

我认识一个人,因为撒了一泡尿,被关了五百年
2013-06-20 18:15
迪达拉
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:479
专家分:1070
注 册:2013-4-3
收藏
得分:0 
相信可以解决你想问的一切

我认识一个人,因为撒了一泡尿,被关了五百年
2013-06-20 18:16
迪达拉
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:479
专家分:1070
注 册:2013-4-3
收藏
得分:0 
java教程 (绝对全 不是三脚猫)
http://tieba.baidu.com/p/2183218532


[ 本帖最后由 迪达拉 于 2013-6-20 18:19 编辑 ]

我认识一个人,因为撒了一泡尿,被关了五百年
2013-06-20 18:17
azzbcc
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:江西财经大学
等 级:贵宾
威 望:81
帖 子:3293
专家分:12919
注 册:2012-11-4
收藏
得分:10 
去年的这几天我用的是vc6.0,easyx库,写的贪吃蛇,视频教程是大话C图


[fly]存在即是合理[/fly]
2013-06-20 19:17
笑傲
Rank: 8Rank: 8
来 自:迪拜
等 级:蝙蝠侠
威 望:5
帖 子:223
专家分:856
注 册:2013-3-9
收藏
得分:10 
没写过,前段时间打算写的,但还是没写,还是暑假用mfc和java写吧

练就一身本领,只为笑傲江湖!
2013-06-20 21:30
我叫沃恩
Rank: 12Rank: 12Rank: 12
来 自:Asia
等 级:贵宾
威 望:10
帖 子:1234
专家分:3865
注 册:2013-3-29
收藏
得分:0 
回复 17楼 迪达拉
两天后,来领分!!

因为我是菜鸟,所以应该被骂! 细节+坚持=成功!
2013-06-20 23:13
快速回复:求解!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022553 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved