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 / Mines and torpedos!

Author
Message
Skolmen
15
Years of Service
User Offline
Joined: 28th Aug 2009
Location:
Posted: 18th Oct 2009 00:45
Hai hai! Long time no see!

I'm currently working on a simple 2d game in which you drive a submarine, and shoot torpedos and stuff. Now, this is my first real game, so I'm still learning alot about Dark GDK.

My problems at the moment are:

1. I have these mines, which float up to the surface of the water when you drop them. However, i want them to stay there for a while, before they dissapear. I started out by using dbWait, but then i realized that this made the whole screen freeze instead of only the mine. Are there any simple commands which lets you pause a sprite for a while?

2. I've also got torpedos. They simply just move from the submarine to the right, and when they go off the screen, they are deleted. The code is like this:

However, I want to be able to shoot several torpedos att the same time, not just one. I tried using a vraiable as sprite ID, which added 1 to itself each time a torpedo was created, and removed 1 every time a torpedo went outside the screen. However, this didn't seem to work.



So, I'm longing for some answeres

Cheers, Skolmen!

C++ newbie.
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 18th Oct 2009 01:15 Edited at: 18th Oct 2009 01:15
For number 1, I'd use a timer, so it'd be like



or something like that.


As for the torpedos, I'd use a vector or an array of classes/structures. The class would contain all the data about the torpedo, sprite id, x and y coordinates, etc. Then when you want to update them you go through the vector and update each one.

Login to post a reply

Server time is: 2024-11-20 13:43:48
Your offset time is: 2024-11-20 13:43:48