this is a game I am creating called: "Click the apple" its in dutch btw
我是一个初学程序员,所以我正在制作这个游戏,但我正在尝试添加一些grafics和我在photoshop中尝试一些东西,这就是我想出来的,我很喜欢它,现在当我点击时出现问题picutebox(苹果)上的事件,我每次点击它都会增加一个标签它工作正常,但当我点击快速它不能跟上(我也使用快速点击器但它只是慢慢递增)当我做同样的事情,但有一个按钮,它工作得很好,现在我想知道这是什么问题,也许你们中的一些人可以帮助我,在这里粘贴代码:
Public Class Form1
Dim appels As Integer = 0
Dim aps As Integer = 0
Dim apc As Integer = 10
Dim ug_1_multiplier As Integer = 2
Dim ug_1_prijs As Integer = 1500
Dim appelstruik_prijs As Integer = 100
Dim appelstruik_aps As Integer = 1
Dim appelstruik_aantal As Integer = 0
Dim appelstruik_max As Integer = 20
Dim appelboom_prijs As Integer = 200
Dim appelboom_aps As Integer = 5
Dim appelboom_aantal As Integer = 0
Dim appelboom_max As Integer = 10
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
L_appelstruiken_prijs.Text = appelstruik_prijs
L_aant_appelstruiken.Text = (appelstruik_aantal & " / " & appelstruik_max)
L_appelbomen_prijs.Text = appelboom_prijs
L_aant_appelbomen.Text = (appelboom_aantal & " / " & appelboom_max)
T_aps.Start()
T_testformax.Start()
End Sub
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
PictureBox2.Enabled = False
PictureBox2.Enabled = True
appels = appels + apc
L_aant_appels.Text = appels
End Sub
Private Sub B_appelstruik_kopen_Click(sender As Object, e As EventArgs) Handles B_appelstruik_kopen.Click
If appels >= appelstruik_prijs Then
aps = aps + appelstruik_aps
appels = appels - appelstruik_prijs
appelstruik_prijs = Math.Round(Val(appelstruik_prijs / 10), 0) + appelstruik_prijs
appelstruik_aantal += 1
L_aant_appelstruiken.Text = (appelstruik_aantal & " / " & appelstruik_max)
L_appelstruiken_prijs.Text = appelstruik_prijs
L_aps.Text = aps
L_aant_appels.Text = appels
Else
MessageBox.Show("je hebt: " & appels & " van de: " & appelstruik_prijs)
End If
End Sub
Private Sub B_appelboom_kopen_Click(sender As Object, e As EventArgs) Handles B_appelboom_kopen.Click
If appels >= appelboom_prijs Then
aps = aps + appelboom_aps
appels = appels - appelboom_prijs
appelboom_prijs = Math.Round(Val(appelboom_prijs / 10), 0) + appelboom_prijs
appelboom_aantal += 1
L_aant_appelbomen.Text = (appelboom_aantal & " / " & appelboom_max)
L_appelbomen_prijs.Text = appelboom_prijs
L_aps.Text = aps
L_aant_appels.Text = appels
Else
MessageBox.Show("je hebt: " & appels & " van de: " & appelboom_prijs)
End If
End Sub
Private Sub T_aps_Tick(sender As Object, e As EventArgs) Handles T_aps.Tick
appels = appels + aps
L_aant_appels.Text = appels
L_aant_appelstruiken.Text = (appelstruik_aantal & " / " & appelstruik_max)
L_appelstruiken_prijs.Text = appelstruik_prijs
L_appelbomen_prijs.Text = appelboom_prijs
L_aant_appelbomen.Text = (appelboom_aantal & " / " & appelboom_max)
L_aps.Text = aps
L_aant_appels.Text = appels
End Sub
Private Sub T_testformax_Tick(sender As Object, e As EventArgs) Handles T_testformax.Tick
If appelstruik_aantal >= appelstruik_max Then
B_appelstruik_kopen.Enabled = False
Else
B_appelstruik_kopen.Enabled = True
End If
If appelboom_aantal >= appelboom_max Then
B_appelboom_kopen.Enabled = False
Else
B_appelboom_kopen.Enabled = True
End If
End Sub
Private Sub B_gen_appels_Click(sender As Object, e As EventArgs) Handles B_gen_appels.Click
appels = appels + apc
L_aant_appels.Text = appels
End Sub
Private Sub b_upgrade_1_apc_dubbel_Click(sender As Object, e As EventArgs) Handles b_upgrade_1_apc_dubbel.Click
If appels >= ug_1_prijs Then
apc = apc * ug_1_multiplier
L_apc.Text = apc
b_upgrade_1_apc_dubbel.Enabled = False
Else
MessageBox.Show("je hebt: " & appels & " van de: " & ug_1_prijs)
End If
End Sub
End Class
答案 0 :(得分:0)
请勿使用Click事件。如果您需要获得点击次数,请使用MouseClick事件。它有MouseEventArgs之类的参数。此类具有类似属性:Clicks,返回按下和释放鼠标按钮的次数。