|
電腦遊戲製作開發設計論壇 任何可以在PC上跑的遊戲都可以討論,主要以遊戲之製作開發為主軸,希望讓台灣的遊戲人有個討論、交流、教學、經驗傳承的園地
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
kogptn 稍嫌羞澀的路人
註冊時間: 2011-01-11 文章: 3
78.54 果凍幣
|
|
回頂端 |
|
|
yag Site Admin
註冊時間: 2007-05-02 文章: 689
2704.11 果凍幣
|
發表於: 2011-1-12, AM 10:08 星期三 文章主題: |
|
|
真的很lag
但要看code才知道原因
不過vb6本身就是效能不怎麼好的語言…
我是沒用過,但有可能是語言本身就lag… |
|
回頂端 |
|
|
kogptn 稍嫌羞澀的路人
註冊時間: 2011-01-11 文章: 3
78.54 果凍幣
|
發表於: 2011-1-12, PM 4:07 星期三 文章主題: 目前 |
|
|
Dim x1%, y1%
Private Sub bg1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.Left = X + 1000 + bg1.Left
If Y < 6000 And Y > 400 Then
image1.Top = Y - 80
End If
x1 = image1.Left
y1 = image1.Top
player.Left = image1.Left - 740
player.Top = image1.Top - 500
End Sub
Private Sub bg2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.Left = X + 1000 + bg2.Left
If Y < 6000 And Y > 400 Then
image1.Top = Y - 80
End If
x1 = image1.Left
y1 = image1.Top
player.Left = image1.Left - 740
player.Top = image1.Top - 500
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 32
If t.Caption = 1 Then
Timer2.Enabled = True
Timer3.Enabled = True
Timer4.Enabled = True
Timer5.Enabled = True
t.Caption = 0
GoTo p
End If
End Select
Select Case KeyCode
Case 32
If t.Caption = 0 And Timer6.Enabled = False Then
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = False
t.Caption = 1
Timer6.Enabled = True
GoTo p
End If
End Select
p:
Select Case KeyCode
Case 68
For d = 1 To 20
If MP.Width > 200 And hp.Width < 1452 Then
MP.Width = MP.Width - 200
hp.Width = hp.Width + 50
End If
Next d
End Select
Select Case KeyCode
Case 70
For f = 1 To 20
If Controls("Shape" & f).Visible = False And MP.Width > 300 And Timer1.Enabled = False Then
Controls("Shape" & f).Shape = 3
Controls("Shape" & f).Height = 1500
Controls("Shape" & f).Width = 1500
Controls("Shape" & f).Left = image1.Left - 500
Controls("Shape" & f).Top = image1.Top - 500
Controls("Shape" & f).Visible = True
Controls("Shape" & f).BorderColor = &HFF8080
MP.Width = MP.Width - 300
Timer1.Enabled = True
GoTo 1
End If
Next f
End Select
Select Case KeyCode
Case 71
For GI = 1 To 20
If Controls("Shape" & GI).Visible = False And MP.Width > 1 Then
Controls("Shape" & GI).Shape = 0
Controls("Shape" & GI).Height = 20
Controls("Shape" & GI).Width = 250
Controls("Shape" & GI).Left = image1.Left + 600
Controls("Shape" & GI).Top = image1.Top + 100
Controls("Shape" & GI).Visible = True
Controls("Shape" & GI).BorderColor = &HFF8181
gtimer.Enabled = True
GoTo 1
End If
Next GI
End Select
Select Case KeyCode
Case 72
For H = 1 To 20
If Controls("Shape" & H).Visible = False And MP.Width > 500 And Timer1.Enabled = False Then
Controls("Shape" & H).Shape = 4
Controls("Shape" & H).Height = 500
Controls("Shape" & H).Width = 10000
Controls("Shape" & H).Left = image1.Left + 700
Controls("Shape" & H).Top = image1.Top - 100
Controls("Shape" & H).Visible = True
Controls("Shape" & H).BorderColor = &HFF8080
MP.Width = MP.Width - 500
Timer1.Enabled = True
GoTo 1
End If
Next H
End Select
Select Case KeyCode
Case 74
For i = 1 To 20
If Controls("Shape" & i).Visible = False And MP.Width > 15 Then
Controls("Shape" & i).Shape = 0
Controls("Shape" & i).Height = 50
Controls("Shape" & i).Width = 250
Controls("Shape" & i).Left = image1.Left + 600
Controls("Shape" & i).Top = image1.Top + 100
Controls("Shape" & i).Visible = True
Controls("Shape" & i).BorderColor = &HFF8080
MP.Width = MP.Width - 15
GoTo 1
End If
Next i
End Select
1:
End Sub
Private Sub Form_Load()
Form1.BackColor = RGB(0, 0, 0)
'WMP1.URL = App.Path & "\music\" & a & ".mid"
For i = 2 To 11
Controls("image" & i).Picture = LoadPicture(App.Path & "\pic\en.gif")
Next i
bg1.Picture = LoadPicture(App.Path & "\pic\bg1.gif")
bg2.Picture = LoadPicture(App.Path & "\pic\bg1.gif")
bg3.Picture = LoadPicture(App.Path & "\pic\bg2.gif")
bg4.Picture = LoadPicture(App.Path & "\pic\bg2.gif")
cover.Picture = LoadPicture(App.Path & "\pic\cover.gif")
player.Picture = LoadPicture(App.Path & "\pic\player.gif")
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.Left = X + 1000
If Y < 6000 And Y > 400 Then
image1.Top = Y - 80
End If
x1 = image1.Left
y1 = image1.Top
player.Left = image1.Left - 740
player.Top = image1.Top - 500
End Sub
Private Sub List1_Click()
End Sub
Private Sub Image12_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
image1.Left = X + 1000
If Y < 6000 And Y > 400 Then
image1.Top = Y - 80
End If
x1 = image1.Left
y1 = image1.Top
player.Left = image1.Left - 740
player.Top = image1.Top - 500
End Sub
Private Sub gtimer_Timer()
For Gm = 1 To 20
If Controls("shape" & Gm).Visible = True And Controls("Shape" & Gm).BorderColor = &HFF8181 And Controls("shape" & Gm).Shape = 0 Then
Controls("shape" & Gm).Left = Controls("shape" & Gm).Left + 200
End If
If Controls("shape" & Gm).Left > 9480 Then
Controls("shape" & Gm).Visible = False
gtimer.Enabled = False
End If
Next Gm
End Sub
Private Sub Label4_Click()
Unload Form1
End Sub
Private Sub Label5_Click()
Shell "cmd.exe /c start " & "http://springculturecircle.blogspot.com/"
End Sub
Private Sub player_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
player.Left = player.Left + 150
image1.Left = image1.Left + 150
End Sub
Private Sub start_Click()
cover.Visible = False
Timer2.Enabled = True
Timer3.Enabled = True
Timer4.Enabled = True
Timer5.Enabled = True
hp.Width = 1501
MP.Width = 1500
result = 0
End Sub
Private Sub Timer1_Timer()
For hm = 1 To 20
If Controls("shape" & hm).Width > 10 And Controls("shape" & hm).Shape = 4 Then
Controls("shape" & hm).Height = Controls("shape" & hm).Height - 10
Controls("shape" & hm).Top = Controls("shape" & hm).Top + 5
Controls("Shape" & hm).Left = image1.Left + 700
Controls("Shape" & hm).Top = image1.Top - 100 - (Controls("shape" & hm).Height / 2)
End If
If Controls("shape" & hm).Shape = 4 And Controls("shape" & hm).Height < 11 Then
Controls("shape" & hm).Visible = False
Timer1.Enabled = False
End If
Next hm
For fm = 1 To 20
If Controls("shape" & fm).Visible = True And Controls("shape" & fm).Shape = 3 Then
Controls("shape" & fm).Top = image1.Top - ((Controls("shape" & fm).Height + 1) / 2)
Controls("shape" & fm).Left = image1.Left - ((Controls("shape" & fm).Height + 1) / 2)
Controls("shape" & fm).Height = Controls("shape" & fm).Height + 1
Controls("shape" & fm).Width = Controls("shape" & fm).Width + 1
End If
If Controls("shape" & fm).Width > 1600 And Controls("shape" & fm).Shape = 3 Then
Controls("shape" & fm).Visible = False
Timer1.Enabled = False
End If
Next fm
End Sub
Private Sub Timer2_Timer()
If MP.Width < 1500 Then
MP.Width = MP.Width + 50
End If
If hp.Width = 1501 And music = 1500 Then
WMP1.URL = App.Path & "\music\1.mid"
WMP1.Controls.play
music = 1000
ElseIf hp.Width < 1001 And music = 1000 Then
WMP1.URL = App.Path & "\music\2.mid"
WMP1.Controls.play
music = 500
ElseIf hp.Width < 501 And music = 500 Then
WMP1.URL = App.Path & "\music\3.mid"
WMP1.Controls.play
music = 0
End If
End Sub
Private Sub Timer3_Timer()
If bg2.Left < bg1.Left Then
bg1.Left = bg1.Left - 150
bg2.Left = bg2.Left - 150
Else
bg2.Left = bg2.Left - 150
bg1.Left = bg1.Left - 150
End If
If bg1.Left <= 0 - bg1.Width Then
bg1.Left = bg2.Left + bg2.Width
ElseIf bg2.Left <= 0 - bg2.Width Then
bg2.Left = bg1.Left + bg1.Width
End If
If bg4.Left < bg3.Left Then
bg3.Left = bg3.Left - 50
bg4.Left = bg4.Left - 50
Else
bg4.Left = bg4.Left - 50
bg3.Left = bg3.Left - 50
End If
If bg3.Left <= 0 - bg3.Width Then
bg3.Left = bg4.Left + bg4.Width
ElseIf bg4.Left <= 0 - bg4.Width Then
bg4.Left = bg3.Left + bg3.Width
End If
For i = 1 To 10
Controls("image" & 1 + i).Left = Controls("shape" & 20 + i).Left
Controls("image" & 1 + i).Top = Controls("shape" & 20 + i).Top
Next i
For im = 1 To 20
If Controls("shape" & im).Visible = True And Controls("shape" & im).Shape = 0 Then
Controls("shape" & im).Left = Controls("shape" & im).Left + 200
End If
If Controls("shape" & im).Left > 9480 Then
Controls("shape" & im).Visible = False
End If
Next im
For enmove = 21 To 70
If enmove < 31 Then
Controls("shape" & enmove).Left = Controls("shape" & enmove).Left - 40
ElseIf enmove < 40 Then
Controls("shape" & enmove).Left = Controls("shape" & enmove).Left - 60
ElseIf enmove < 50 Then
Controls("shape" & enmove).Left = Controls("shape" & enmove).Left - 80
ElseIf enmove < 60 Then
Controls("shape" & enmove).Left = Controls("shape" & enmove).Left - 100
ElseIf enmove < 70 Then
Controls("shape" & enmove).Left = Controls("shape" & enmove).Left - 120
End If
Next enmove
For emove = 31 To 70
If Controls("shape" & emove).FillColor = &HFF& Then
If Controls("shape" & emove).Left < image1.Left Then
llag = llag + 1
Controls("shape" & emove).Left = Controls("shape" & emove).Left + 15 + llag
ElseIf Controls("shape" & emove).Left > image1.Left Then
llag = llag - 1
Controls("shape" & emove).Left = Controls("shape" & emove).Left - 100 + llag
End If
If Controls("shape" & emove).Top < image1.Top Then
tlag = tlag + 1
Controls("shape" & emove).Top = Controls("shape" & emove).Top + 30 + tlag
ElseIf Controls("shape" & emove).Top > image1.Top Then
tlag = tlag - 1
Controls("shape" & emove).Top = Controls("shape" & emove).Top - 30 + tlag
End If
ElseIf Controls("shape" & emove).FillColor = &H80FF& And Controls("shape" & emove).Height < 4000 Then
Controls("shape" & emove).Height = Controls("shape" & emove).Height + 10
Controls("shape" & emove).Width = Controls("shape" & emove).Width + 10
Controls("shape" & emove).Left = Controls("shape" & emove).Left - 50
ElseIf Controls("shape" & emove).FillColor = &HFFFF& Then
Controls("shape" & emove).Left = Controls("shape" & emove).Left + 150
Controls("shape" & emove).Width = Controls("shape" & emove).Width + 7
ElseIf Controls("shape" & emove).FillColor = &HFF00& Then
Controls("shape" & emove).Top = Controls("shape" & emove).Top - 50
Controls("shape" & emove).Height = Controls("shape" & emove).Height + 7
ElseIf Controls("shape" & emove).FillColor = &HFFFF00 Then
Controls("shape" & emove).Top = Controls("shape" & emove).Top + 50
Controls("shape" & emove).Height = Controls("shape" & emove).Height + 7
ElseIf Controls("shape" & emove).FillColor = &HFF00FF Then
Controls("shape" & emove).Left = Controls("shape" & emove).Left - 150
Controls("shape" & emove).Width = Controls("shape" & emove).Width + 7
End If
Next emove
'攻擊
For bp = 1 To 20
For EP = 21 To 70
If Controls("shape" & EP).Left < Controls("shape" & bp).Left + Controls("shape" & bp).Width And Controls("shape" & EP).Left > Controls("shape" & bp).Left - Controls("shape" & EP).Width And Controls("shape" & EP).Top > Controls("shape" & bp).Top - Controls("shape" & EP).Height And Controls("shape" & EP).Top < Controls("shape" & bp).Top + Controls("shape" & bp).Height And hp.Width > 10 And Controls("shape" & EP).Visible = True And Controls("shape" & bp).Visible = True Then
If EP < 31 Then
Controls("shape" & EP).Visible = False
result = result + 50
If MP.Width < 1500 Then
MP.Width = MP.Width + 1
End If
End If
If EP > 30 And Controls("Shape" & bp).BorderColor = &HFF8181 Then
Controls("shape" & bp).Visible = False
Controls("shape" & EP).Left = Controls("shape" & EP).Left + 25
End If
If EP > 30 And Controls("Shape" & bp).BorderColor = &HFF8080 Then
Controls("shape" & EP).Visible = False
result = result + 50
If MP.Width < 1500 Then
MP.Width = MP.Width + 1
End If
End If
End If
Next EP
Next bp
For en = 21 To 70
If image1.Left < Controls("shape" & en).Left + Controls("shape" & en).Width And image1.Left > Controls("shape" & en).Left - image1.Width And image1.Top > Controls("shape" & en).Top - image1.Height And image1.Top < Controls("shape" & en).Top + Controls("shape" & en).Height And hp.Width > 10 And image1.Visible = True And Controls("shape" & en).Visible = True And hp.Width > 50 Then
hp.Width = hp.Width - 100
Controls("shape" & en).Visible = False
Shape71.Left = image1.Left - 200
Shape71.Top = image1.Top - 200
Shape71.Visible = True
Timer5.Enabled = True
End If
Next en
If hp.Width < 50 Then
cover.Visible = True
For i = 1 To 5
Controls("Timer" & i).Enabled = False
Next i
For st = 2 To 71
Controls("shape" & st).Left = -50000
Next st
For ia = 21 To 30
Controls("shape" & ia).Left = 15000
Next ia
music = 1500
WMP1.Controls.stop
End If
End Sub
Private Sub Timer4_Timer()
result = result + 30
'死亡
For dead = 21 To 70
If Controls("shape" & dead).Left < -3000 Then
Controls("shape" & dead).Visible = False
End If
Next dead
'敵重生
For cen = 21 To 30
If Controls("shape" & cen).Visible = False Then
Randomize
startleft = Int(Rnd * 500)
Controls("shape" & cen).Left = 9600 + startleft
Randomize
starttop = Int(Rnd * 5900) + 50
Controls("shape" & cen).Top = starttop
End If
'子彈位置 '子彈大細 '重生
For Group = 3 To 6
For tgroup = 1 To 9
Controls("Shape" & Group & tgroup).FillColor = Controls("Shape2" & tgroup).FillColor
If Controls("Shape" & Group & tgroup).Visible = False Then
Controls("Shape" & Group & tgroup).Top = Controls("Shape2" & tgroup).Top
Controls("Shape" & Group & tgroup).Left = Controls("Shape2" & tgroup).Left
Size = Int(Rnd * 200) + 300
Controls("Shape" & Group & tgroup).Height = Size
Controls("Shape" & Group & tgroup).Width = Size
Controls("Shape" & Group & tgroup).Visible = True
GoTo 1
End If
Next tgroup
Next Group
1:
'色彩
If cen < 31 And Controls("Shape" & cen).Visible = False Then
Randomize
coloren = Int((Rnd * 6) + 1)
If coloren = 1 Then
Controls("shape" & cen).FillColor = &HFF&
ElseIf coloren = 2 Then
Controls("shape" & cen).FillColor = &H80FF&
ElseIf coloren = 3 Then
Controls("shape" & cen).FillColor = &HFFFF&
ElseIf coloren = 4 Then
Controls("shape" & cen).FillColor = &HFF00&
ElseIf coloren = 5 Then
Controls("shape" & cen).FillColor = &HFFFF00
ElseIf coloren = 6 Then
Controls("shape" & cen).FillColor = &HFF00FF
End If
End If
Controls("shape" & cen).Visible = True
Next cen
End Sub
Private Sub Timer5_Timer()
Timer5.Enabled = False
Shape71.Visible = False
End Sub
Private Sub Timer6_Timer()
If MP.Width > 51 Then
MP.Width = MP.Width - 25
Else:
Timer2.Enabled = True
Timer3.Enabled = True
Timer4.Enabled = True
Timer5.Enabled = True
Timer6.Enabled = False
t.Caption = 0
End If
End Sub
Private Sub Timer7_Timer()
End Sub
已經優化了不少...但問題還存在... |
|
回頂端 |
|
|
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 可以 在這個版面附加檔案 您 可以 在這個版面下載檔案
|
|