| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2161 人关注过本帖
标题:一个小飞机游戏(源码)(懒了点)
取消只看楼主 加入收藏
专科西校
Rank: 1
等 级:新手上路
帖 子:3
专家分:5
注 册:2018-11-6
收藏
 问题点数:0 回复次数:0 
一个小飞机游戏(源码)(懒了点)
Public Class Form1
    Dim x, q, w, f As Integer
    Dim aa As Integer = 0
   
    Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress

        Select Case Asc(e.KeyChar)
            Case 87 : PictureBox1.Top = PictureBox1.Top - 5
            Case 83 : PictureBox1.Top = PictureBox1.Top + 5
            Case 65 : PictureBox1.Left = PictureBox1.Left - 5
            Case 68 : PictureBox1.Left = PictureBox1.Left + 5
            Case 13 : po(PictureBox21)
        End Select
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        f = 0
        Me.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub hei(ByVal pic)
        Randomize()
        x = Rnd() * 1500 + 50
        w = Rnd() * 15 + 1
        pic.Visible = True
        pic.Top = pic.Top + w
        If pic.Top >= PictureBox1.Top - 20 And pic.Left >= PictureBox1.Left - 20 And pic.left <= PictureBox1.Left + 80 Then

            If aa = 0 Then
                f = f + 1
                If f = 1 Then
                    MessageBox.Show("您应该挂了")
                End If
            End If
        End If
        If pic.Top >= PictureBox21.Top And pic.Left >= PictureBox21.Left - 20 And pic.left <= PictureBox21.Left + 18 Then

            pic.Top = 0
            pic.Left = x

        End If
        If pic.Top >= 800 Then
            pic.Top = 0
            pic.Left = x
        End If

    End Sub
    Private Sub hong(ByVal pic)
        Randomize()
        x = Rnd() * 1500 + 50
        q = Rnd() * 15 + 1
        pic.Visible = True
        pic.Top = pic.Top + q
        If pic.Top >= PictureBox1.Top - 20 And pic.Left >= PictureBox1.Left - 20 And pic.left <= PictureBox1.Left + 80 Then
            aa = aa + 1
            Select aa
                Case 1 : PictureBox26.Visible = True
                Case 2 : PictureBox27.Visible = True
                Case 3 : PictureBox25.Visible = True

            End Select

            pic.Top = 0
            pic.Left = x
        End If
        If pic.Top >= 800 Then
            pic.Top = 0
            pic.Left = x
        End If

    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Static i As Integer
        i = (i + 1) Mod 3
        If i = 0 Then
            Timer1.Interval = 1 * 100
            PictureBox1.Image = PictureBox3.Image
        ElseIf i = 1 Then
            Timer1.Interval = 2 * 100
            PictureBox1.Image = PictureBox2.Image
        Else
        End If
        '敌机碰撞

        

            hei(PictureBox4)
            hei(PictureBox5)
            hei(PictureBox7)
            hei(PictureBox9)
            hei(PictureBox11)
            hei(PictureBox12)
            hei(PictureBox14)
            hei(PictureBox15)
            hei(PictureBox16)
            hei(PictureBox17)
            hei(PictureBox6)
            hei(PictureBox8)
            hei(PictureBox10)
            hei(PictureBox13)
        hei(PictureBox20)
        hei(PictureBox18)
        '奖励




        hong(PictureBox19)


        '子弹动
        dong(PictureBox21)



      


    End Sub
    Private Sub po(ByVal pic)
        pic.top = PictureBox1.Top
        pic.left = PictureBox1.Left + 22
        pic.Visible = True
    End Sub

    Private Sub dong(ByVal pic)
        pic.top = pic.top - 40


    End Sub

   
End Class
搜索更多相关主题的帖子: Sub End Top Left If 
2018-11-06 19:56
快速回复:一个小飞机游戏(源码)(懒了点)
数据加载中...
 
   



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

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