|
-
Oct 5th, 2002, 05:18 PM
#1
Thread Starter
New Member
Background stars
how do u make stars fly in VB6, like a background in most progs. you no, when the stars are looking liek they are in space. ye im a noob hit me back
~Holla
~!-What You See Here Let It Stay Here Or Dont Come Back Here-!~
-
Oct 5th, 2002, 06:28 PM
#2
Hyperactive Member
Code:
Private Type Coord
x As Single
y As Single
End Type
Dim Star(2, 25) As Coord
Private Sub Form_Load()
Me.ScaleMode = 3
Picture1.ScaleMode = 3
Picture1.BackColor = 0
Picture1.FillStyle = 0
Picture1.FillColor = vbWhite
For i = 0 To 25
Star(0, i).x = Int(Rnd * Picture1.Width)
Star(0, i).y = Int(Rnd * Picture1.Height)
Star(1, i).x = Int(Rnd * Picture1.Width)
Star(1, i).y = Int(Rnd * Picture1.Height)
Star(2, i).x = Int(Rnd * Picture1.Width)
Star(2, i).y = Int(Rnd * Picture1.Height)
Next i
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
Picture1.Cls
For i = 0 To 25
Star(0, i).x = Star(0, i).x + 3
Star(0, i).y = Star(0, i).y + 3
Star(1, i).x = Star(1, i).x + 2
Star(1, i).y = Star(1, i).y + 2
Star(2, i).x = Star(2, i).x + 1
Star(2, i).y = Star(2, i).y + 1
For n = 0 To 2
If Star(n, i).x > Picture1.Width Then Star(n, i).x = 0
If Star(n, i).x < 0 Then Star(n, i).x = Picture1.Width
If Star(n, i).y > Picture1.Height Then Star(n, i).y = 0
If Star(n, i).y < 0 Then Star(n, i).y = Picture1.Height
Next n
Picture1.Circle (Star(0, i).x, Star(0, i).y), 1.5, RGB(255, 255, 255)
Picture1.Circle (Star(1, i).x, Star(1, i).y), 1, RGB(150, 150, 150)
Picture1.Circle (Star(2, i).x, Star(2, i).y), 1, RGB(80, 80, 80)
Next i
End Sub
-
Oct 5th, 2002, 06:29 PM
#3
Hyperactive Member
You'll need a picture box and a timer on your form.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|