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.

Newcomers DBPro Corner / shooting missles

Author
Message
WoW is WOW
21
Years of Service
User Offline
Joined: 21st Jun 2003
Location: Australia
Posted: 5th Nov 2003 10:10
I'm working on a warm-up game and i can't get it so that if you press the spacebar that the missle sprite launches.
When you press it appears, but unless you hold space it won't continue.
Also how would i do multiple missles at once?
RPG_Freak.
Dark Coyote
20
Years of Service
User Offline
Joined: 17th Oct 2003
Location:
Posted: 5th Nov 2003 12:50
Is this for a 3D game or a 2D game?

For multiple missiles you could use arrays containing the co-ordinates and advance through these so that say, if one missile is fired add 1 to a value then if that value is 2 and space is pressed it uses the arrays for missile 2 etc..

To possition these just use a For next loop (1 to number of missiles) and have in between the code for placing the missile sprite.

Dark Coyote
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 5th Nov 2003 15:28
so it would look somthing like this

For m = 1 to 5 (this will make 5 missles or so and the variable m is for missles)
do this and that
next m

i just showed you incase you don't know what a for next loop is i learned myself awhile ago hehe

http://www.freewebs.com/ingamers
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 5th Nov 2003 17:05
shouldn't the main game loop advance the missle along its path? If you used a for-next wouldn't you "pause" the rest of your game while the missle travelled?

-RUST-
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 5th Nov 2003 19:21
You should attach the source, freak. That would make your question easier to answer.

WoW is WOW
21
Years of Service
User Offline
Joined: 21st Jun 2003
Location: Australia
Posted: 6th Nov 2003 09:05
it's a 2d game.
You have a jet and it can move anywhere along the screen and when you shoot i want the missle to continue to advance in that path until it is no longer visible on screen even thought the space bar has been 'tapped'.
rpg_freak.
Dark Coyote
20
Years of Service
User Offline
Joined: 17th Oct 2003
Location:
Posted: 6th Nov 2003 12:40
If you put the For Next loop in the main loop it would run it every loop, it shouldnt pause the program unless your running a on an old computer or you have a lot of missiles to advance.

An alternative is that you could create a function to advance the missiles and just call it for each missile which has been fired, I would post a short demo code but Im at collage and my home computer dosnt work at the mo (And im not good enough to remember all the coding of my head without testing it in DB).

Try looking through the help files that come with DB to learn how to make a function + try looking at the source of other games, see how they make somthing advance and model your code on that.

Dark Coyote.

Login to post a reply

Server time is: 2024-09-21 07:37:11
Your offset time is: 2024-09-21 07:37:11