Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Type MyClass
- Global List:TList
- Field x:Float
- Field y:Float
- Field r:Int,g:Int,b:Int
- Field spd:Float
- Field ypd:Float
- Function Add(spd:Float,r:Int,g:Int,b:Int)
- If Not List List=CreateList()
- Local c:MyClass = New MyClass
- c.x = Rnd(0,800)
- c.y = Rnd(0,600)
- c.r = r
- c.g = g
- c.b = b
- c.spd = spd
- c.ypd = 0.0
- List.AddLast c
- End Function
- Function UpdateAll()
- If Not List Return
- For Local l:MyClass = EachIn List
- l.Update()
- Next
- End Function
- Method Update()
- y:-ypd
- x:-spd
- If x<-5 Then x = GraphicsWidth()+1
- Draw()
- End Method
- Method Draw()
- SetColor r,g,b
- Plot x,y
- SetColor 255,255,255
- End Method
- End Type
- '
- ' Main code
- '
- For Local i:Int=0 To 200
- MyClass.Add(1.0,255,255,255)
- MyClass.Add(0.7,155,155,155)
- MyClass.Add(0.2,55,55,55)
- Next
- SeedRnd MilliSecs()
- Global seed:Int=RndSeed()
- Graphics 800,600
- Repeat
- Cls
- MyClass.UpdateAll()
- Flip
- Until KeyHit(KEY_ESCAPE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement