I don't know what I'm doing. Can someone point me in the right direction on how to properly code this type?
I want to be able to remove a balloon when it exceeds it's boundaries.
I'm still not that good with OOP. :/
Type balloon Global List:TList Field Link:TLink Field xloc:Int Field YLoc:Int Field Speed:Int Field BFrame:Int Field Direction:Int Global BalloonCount:Int = 0 Global MaxBalloons:Int = 20 Method New() If List=Null List=New TList End If Link=List.AddLast(Self) End Method Method Kill() Link.Remove() Link=Null End Method Function CreateBalloon:Int(BalloonCount:Int) For Local xiter:Int = 0 To balloon.BalloonCount Local b:balloon = New balloon b.XLoc = GraphicsWidth()/2 b.YLoc = GraphicsHeight()/2 b.Speed = Rand(3,10) b.BFrame = Rand(0,4) b.Direction = Rand(0,359) If balloon.BalloonCount >= balloon.MaxBalloons Exit End If Return BalloonCount Next If balloon.BalloonCount => balloon.MaxBalloons Then balloon.BalloonCount = balloon.MaxBalloons End Function Method UpdateBalloons() DrawImage AllBalloons,xloc,yloc,BFrame xloc:+ Cos(Direction) * Speed yloc:+ Sin(Direction) * Speed If xloc > 1050 or xloc < -50 balloon.Kill End If If yloc > 790 or yloc < - 50 balloon.Kill EndIf End Method End Type
I want to be able to remove a balloon when it exceeds it's boundaries.
I'm still not that good with OOP. :/