本文介绍了我怎么做一个“ “跳跃” VS 2010中的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计们

我正在用VB开发我的第一个游戏,我需要学习一些关于在按下特定按钮时使对象跳跃的想法

这里是只移动汽车的代码

i需要汽车跳我按下UP按钮

任何想法?



我的尝试:



hi guys
I'm developing my 1st game in VB and i need to learn some ideas about making objects jump when i press a specific button
here is the code for only moving a car
i need the car to jump when i press UP button
any ideas ?

What I have tried:

Public Class Form1
    Dim x As Integer = 1, y As Integer = 1, speed As Integer = 1
    '=========================================
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        MovemenT.Enabled = True
    End Sub

    Private Sub MovemenT_Tick(sender As Object, e As EventArgs) Handles MovemenT.Tick
        PictureBox1.Left -= speed
        Select Case x
            Case 1
                PictureBox1.Image = My.Resources.Car2
                x += 1
            Case 2
                PictureBox1.Image = My.Resources.Car3
                x += 1
            Case 3
                PictureBox1.Image = My.Resources.Car4
                x = 1
        End Select
    End Sub
End Class

推荐答案


这篇关于我怎么做一个“ “跳跃” VS 2010中的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 01:26