Results 1 to 3 of 3

Thread: Background stars

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    3

    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-!~

  2. #2
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    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
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  3. #3
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    You'll need a picture box and a timer on your form.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width