Created
March 15, 2010 19:22
-
-
Save NIA/333218 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Type Ball | |
| x As Integer | |
| y As Integer | |
| radius As Integer | |
| col As Integer | |
| isalive As Integer | |
| level As Integer | |
| speed As Integer | |
| End Type | |
| ' ... | |
| Const BALLSNUM = 8 | |
| Dim Shared balls (1 To BALLSNUM) As Ball | |
| ' ... | |
| Sub CreateBall | |
| Dim free As Integer | |
| For i = 1 To 8 | |
| If balls(i).isalive = 0 Then Exit For | |
| Next | |
| free = i | |
| balls(free).isalive = 1 | |
| level% = Cint( Rnd * 4 ) | |
| balls(free).level = level% | |
| balls(free).radius = BallRadius( level% ) | |
| balls(free).speed = BallSpeed( level% ) | |
| left = Rnd | |
| If left < 0.5 Then | |
| balls(free).x = MINX - balls(free).radius | |
| Else | |
| balls(free).x = MAXX + balls(free).radius | |
| balls(free).speed = -balls(free).speed | |
| End If | |
| balls(free).col = BallRandomColor | |
| balls(free).y = MINY + Cint( Rnd*(MAXY - MINY) ) | |
| DrawBall( free ) | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment