Public Sub AddLeroy
Dim animator As SpriteAnimator
Dim rects(6) As Rect
Dim bitmaps(6) As Bitmap
Dim row As Int
row = 0
'The Leroy sprite sheet includes 1 row of sprites.
For i = 0 To 5
rects(i) = leroyBitmaps(i, row).SrcRect
bitmaps(i) = leroyBitmaps(i, row).Bitmap
Next
animator.Initialize
Dim bd As BitmapData
animator.SetFrames(bd, rects, bitmaps) 'sets the frames that will be animated
animator.AnimationInterval = 10
MyLeroy.Initialize(bd, animator, Me, 50%x, 65%y, 250)
gv.BitmapsData.Add(bd) 'add Leroy to the GameView (so it will be redrawn every time).
End Sub
Public Sub AddDog (x As Int, y As Int, size As Int)
Dim animator As SpriteAnimator
Dim rects(6) As Rect
Dim bitmaps(6) As Bitmap
Dim row As Int
row = Rnd(0, 2)
'The Dogs sprite sheet includes 4 rows of sprites.
'One of the rows is randomly selected.
For i = 0 To 5
rects(i) = DogsBitmaps(i, row).SrcRect
bitmaps(i) = DogsBitmaps(i, row).Bitmap
Next
animator.Initialize
Dim bd As BitmapData
animator.SetFrames(bd, rects, bitmaps) 'sets the frames that will be animated
animator.AnimationInterval = 10
Dim doggie As Dog
doggie.Initialize(bd, animator, Me, x, y, 125)
Dogs.Add(doggie) 'add the Dog to the Dogs list.
gv.BitmapsData.Add(bd) 'add the Dog to the GameView (so it will be redrawn every time).
End Sub