- Buat 1 Form Dengan Name Terserah Anda
-Tambahkan 2 Timer 1 dan Timer2 di Form Anda Dengan Interval 500
-Tambahkan Lagi 1 Module dengan Name Module1
Isi Code Berikut Pada Module
Spoiler: |
Option Explicit Type xparticle x As Integer y As Integer oldX As Integer oldY As Integer iStopped As Integer End Type Global Const kecepatan_salju = 400 Global Const ukuran_salju = 1 Global snow(0 To kecepatan_salju) As xparticle |
PostSubyek: Buat Form BerSalju Yesterday at 9:52 am Balas dengan kutipan Ubah/Hapus pesan Hapus post ini Lihat IP pengirim
Langsung Aja
- Buat 1 Form Dengan Name Terserah Anda
-Tambahkan 2 Timer 1 dan Timer2 di Form Anda Dengan Interval 500
-Tambahkan Lagi 1 Module dengan Name Module1
Isi Code Berikut Pada Module
Spoiler:
Option Explicit
Type xparticle
x As Integer
y As Integer
oldX As Integer
oldY As Integer
iStopped As Integer
End Type
Global Const kecepatan_salju = 400
Global Const ukuran_salju = 1
Global snow(0 To kecepatan_salju) As xparticle
Tambahkan Code Di Bawah Pada Form
Spoiler: |
option Explicit Dim jalan As Boolean Private Sub Form_Load() ScaleMode = vbPixels DrawWidth = ukuran_salju BackColor = vbBlack Dim i As Integer For i = 0 To kecepatan_salju snow(i).x = CInt(Int(ScaleWidth * Rnd)) snow(i).y = CInt(Int(ScaleHeight * Rnd)) Next jalan = True Timer1.Enabled = True Const sTEXT = "Karamecat" ForeColor = vbRed FontSize = 20 CurrentX = ScaleWidth / 2 - TextWidth(sTEXT) / 2 CurrentY = ScaleHeight / 2 - TextHeight(sTEXT) / 2 - 5 Print sTEXT Const sText2 = "karameca.forumid.net" CurrentX = ScaleWidth / 2 - TextWidth(sText2) / 2 CurrentY = ScaleHeight / 2 + TextHeight(sText2) + 2 Print sText2 ForeColor = vbWhite End Sub Sub DrawSnow() Dim i As Integer Dim newX As Integer Dim newY As Integer Timer1.Enabled = False Do While jalan For i = 0 To kecepatan_salju PSet (snow(i).oldX, snow(i).oldY), vbBlack PSet (snow(i).x, snow(i).y) Next i For i = 0 To kecepatan_salju snow(i).oldX = snow(i).x snow(i).oldY = snow(i).y newX = snow(i).x + Int(2 * Rnd) newX = newX - Int(2 * Rnd) newY = snow(i).y + 1 If Point(newX, newY) = vbBlack Then snow(i).y = newY snow(i).x = newX Else If snow(i).iStopped = 10 Then If Point(snow(i).x + 1, snow(i).y + 1) = vbBlack Then snow(i).x = snow(i).x + 1 snow(i).y = snow(i).y + 1 snow(i).iStopped = 0 ElseIf Me.Point(snow(i).x - 1, snow(i).y + 1) = vbBlack Then snow(i).x = snow(i).x - 1 snow(i).y = snow(i).y + 1 snow(i).iStopped = 0 Else NewParticle (i) End If Else snow(i).iStopped = snow(i).iStopped + 1 End If End If Next i DoEvents Loop End Sub Sub NewParticle(i As Integer) snow(i).x = CInt(Int(ScaleWidth * Rnd)) snow(i).y = 0 snow(i).oldX = 0 snow(i).oldY = 0 snow(i).iStopped = 0 End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) jalan = False End Sub Private Sub Timer1_Timer() DrawSnow End Sub |
Kemudian coba di jalankan programnya
Posting Komentar