Sprites get a makeover!

Right, the old way bHive used sprites was to have a sprite sheet and animate it using the coordinates that were assigned using the framedata array. This method was okay, but just assumed that the sprite sheet contained only one animation, in reality you’d need a seperate sprite sheet for every animated sprite in your game or application. Boo!

I’ve now rewritten the Sprite class so that you can pass in a bHive.bitmap as the src property which will allow you to load a all encompassing sprite sheet and create multiple animated sprites from it.

The Sprite class also now sports a few more methods for controlling animation:

  • nextTimedFrame – Advances the frame to the next frame using the correct frame timings
  • nextFrame – Advances the frame to the next frame, regardless of timing.
  • gotoFrame – Sets the frame to the specified frame number
  • stop – Stops all playback of animation
  • play – Starts playback of animation

Leave a Reply