Jump to content
  • Advertisement
Sign in to follow this  
zonozz

Mouse OnClick with explosion effects

This topic is 1434 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 everyone:

 

I'm doing a effect like when I click in then window somewhere, there will be a explosion effect. But, here is a requirement : When I continually click on different position, the previous explosion effect should not disappear immediately, I mean they should be work on there own life span.

 

The first of my solution is that I build a render queue and a position queue. However, it doesn't work. Because it cannot render the current mouse position explosion effect when previous explosion effect is still working.

 

So I tried to create a thread when I click. And I hope each thread could finish one explosion effects. But there must something wrong when I call the Draw() function, because Draw() is also called by gluDisplayFunc(Draw);

 

Does anyone have solution ? Thank you very much. 

Share this post


Link to post
Share on other sites
Advertisement

create a little array of explosions that contains their position, and lifetime, or time of creation. Then every frame you just draw all the active explosions in the array that haven't burned up yet. When you click, you find an empty/dead explosion slot in the array and fill it with the mouse position and current time.

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!