Jump to content
  • Advertisement
Sign in to follow this  
ginkeq

Some graphics / rendering questions

This topic is 3847 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

I'm writing a pacman clone, and was wondering how would you typically implement the sprites? Just as ordinary bitmap files (1 per different movement?) I also have a 2 dimensional array of Images to represent the map(each one is a tile, is that a stupid way to implement it?). How is the draw/undraw code going to be? Invalidate the nearby tiles, redraw the sprites? I'm using C# btw.

Share this post


Link to post
Share on other sites
Advertisement
For your sprites you can use one sprite per animation frame/direction, i.e. (<, >), ... . You could also use a few sprites and rotate/flip them accordingly, but I guess you'll gona have only small ones and a few characters, so having more sprites isn't that much a waste of memory.

I'd represent the map as a 2D array of some structure that describes the map. Since you'll certainly reuse many of the tiles you could just have a tile pool that contains every tile image once, store the id of or a reference to the image in your tile structure and get the tile from the pool for rendering.

As for your draw code: I don't know what API you will be using, but if you just use the OS functionality or some 2D library like GTK your approach is fine: redraw only the tiles that have changed. If you are using some 3D library like DirectX or OpenGL the easiest way is to render each tile as a quad every frame.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!