Jump to content
  • Advertisement
Sign in to follow this  

Animation sprite

This topic is 5203 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 wanted to know how to create the animation sprite in the bomberman game. the problem is when the bomberman drop the bomb it will come out the bomb effect. i wanted to know how to crete the effect into four direction, two direction? Pls show me the coding for how to create it. Thank u

Share this post

Link to post
Share on other sites
ok, i suppose your game world is made of 2d tiles.

here is how i'd do, but of course, there may be some better ways to achieve this...

in this case you need only to draw 3 sprites for explosions :
(sorry for the ugly ascii art)
1. "horizontal" explosion (like uhm... that : "=" with a fire color, ared/yellow/white gradient for example)
2. "vertical" explosion (let's say : "||")
3. "cross" explosion (err... like that : "+")

then, i suggest you create a boolean array of the size of your tilemap (ie. if you have 10x10 tiles, you need a 10x10 array of booleans). initialize it with a "FALSE" value.

now, in your game loop :

when a bomb explodes, you recursively look at the four adjacent edges (north/south/east/west of the tile where the bomb is), and put a "TRUE" value in the boolean array, to tell later if a tile is "in fire".

then, after you're done with it, parse the boolean array and draw the appropriate sprite ("horizontal", "vertical" or "cross"), knowing it from the adjacent tiles (for example : "if (boolarray[x,y] AND boolarray[x+1,y] AND boolarray[x,y+1]) then drawsprite("cross");").

(err... i hope i'm clear enough for you to understand... feel free to ask more questions if something seems weird to you)

you can also make it easier by just using the "cross" sprite everywhere there's a "tile in fire".

btw, don't forget that :
- in a bomberman clone, the length of explosions vary
- you will need a counter to make the tiles "in fire" during a short moment, and then put the tiles back to normal.

i hope it will help you.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!