1
this is a game I am creating called: "Click the apple" its in dutch btw上的圖片快速點擊
IM編程新手,所以我做這個遊戲,但我想補充一些grafics和IM試圖在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
我不知道你是否使用visual studio,但是當你在設計視圖和dubbleklick的東西時,你會得到如下代碼:http://pastebin.com/KNBg8t0h,我對picturebox做了同樣的事情,但是它增加了較慢(相對於我點擊的速度) –
當你意識到在控制中雙擊時,你會得到類似圖像的代碼。但是,這只是控制的默認事件。在屏幕上方你會看到兩個列表。一會寫「點擊」。將其更改爲「MouseClick」。一個新的子將顯示。 – Daniel1791
我將它更改爲「MouseClick」,但它做了同樣的事情,後來我將它更改爲「MouseDown」並且問題得到解決,謝謝我感謝您的幫助。對不起,我的英文不好,:P哈哈 –