Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Tiny lag before an explosion

Author
Message
lolzPie
13
Years of Service
User Offline
Joined: 19th Sep 2010
Location: Under your pillow. Watch out!
Posted: 19th Sep 2010 18:43
Hi. I'm a beginner in DarkGDK and C++. I'm also new to this forum.

Recently I have encountered a problem involving explosions. My game is a 2d vertical space shooter where the player ship (bottom) has to shoot enemy ships (top). Once a bullet touches the enemy ship, the bullet and the enemy ship are deleted.

I've made it so that before the other plane is defeated, it will show an explosion animation. But, as the explosion begins, the whole screen stops for around half a second. The explosion continues after, then ends and is deleted.

I've been wondering for hours on why there's a slight lag before the explosion, but I've come up with nothing. Does anyone know how to prevent this? If so, how?

Here's my code:



I can has noobish skills.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Sep 2010 02:14
Because you're creating a new animated sprite for every explosion. That involves loading an image, cutting it up and then displaying it. Better to just create a few at the start and use them.

[b]
lolzPie
13
Years of Service
User Offline
Joined: 19th Sep 2010
Location: Under your pillow. Watch out!
Posted: 20th Sep 2010 02:18
Thanks, I'll try that.

I can has noobish skills.

Login to post a reply

Server time is: 2024-07-02 08:45:21
Your offset time is: 2024-07-02 08:45:21