Jump to content
  • Advertisement
Sign in to follow this  
pallavi

Generating a wave

This topic is 5145 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 all, I am writing a game named as colorwar. I want to create a wave that will gradually spread a particular color over a rectangular grid. can anybody suggest me how to create a this animation. thank you, Pallavi

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Use a regular flood-filler to prefill the cells.

Tag the cells with numbers that increas as distance from the start-point or the nearest already filled cell increases.

For the wave-animation:

Decrement all tag-numbers in a loop, display the cells where the tag-number reaches 0 with the filled color.

Stop iteration if all cells are counted down to 0.

Hope that helps.

Share this post


Link to post
Share on other sites
Thanks. Now i have implemented the code to fill the color of tiles and tag them with the number as it increases from the start or already filled tiles.
For the wave-animation:
Decrement all tag-numbers in a loop, display the cells where the tag-number reaches 0 with the filled color.

But to create a animation for the wave, This idea is not working for 30 fps. It too slow and sometimes hand up. Ooopps !! I am stuck here. can anybody will help me to animate this like a wave.

thanks you,
Pallavi

Share this post


Link to post
Share on other sites
Do a time-base decrement of the tiles, not on every frame...

You can set a timer for your decrement-function or a similar mechanism....now you can animate the wave as fast or slow as you desire...no matter what fps is rendered.

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!