Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


sprites, how?

This topic is 5812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm making a bomberman clone and I've recently run into some trouble. The way I designed my sprite class wasn't really that efficient, and it didn't work for the most part (it was quickly thrown together, bad on my part). I'm going to redesign it, but before I do that, I was hoping I could get a couple of pointers. This question is for those who have made 2D games in opengl before .. How'd you manage your sprites in game? Thanks in advance! [edited by - blueEbola on August 15, 2002 6:28:42 PM]

Share this post

Link to post
Share on other sites
I use glBitmap for writing (see Red GL book Chapter 8 I think).
Another method is to use transparent textures with an alpha channel (see NeHe TGA loading tutorials) or Masking (NeHe too).

Masking has the disadvantage that you have to draw the picture and the mask for every animation frame.

I got an texture array, with the sprites.
and an animation file like this:



The Textures are loaded and the EXPLODE animation is followed by the texture numbers and the timeinterval to wait before changing to next frame.

This is how I''ve done it.
I hope I hav''nt missed your question

Share this post

Link to post
Share on other sites
I''ve gone the other route and avoided external files altogether, except for the graphics.

I made a base sprite class, with virtual functions, notably a spawn function, a frame function, and a draw function. I inherit all sprites from this.
In my games main class I have the texture resource manager, wich the sprites spawn function uses to get it''s texture binding numbers. The main class also has a spawn entity function which uses a string to choose which sprite class to create, then casts the pointer to the base class, and sticks it in an std::vector called, surprisingly, sprites.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!