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.

Author
Message
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 2nd Oct 2005 22:14 Edited at: 2nd Oct 2005 22:17
I got a little problem with my shooting. When the key is pressed, it launches 2 missiles and the speed increases as it moves off, but when you fire a second set of missiles and so on, they no longer move off from slow to fast, its just fast. Here is the code for it, also if anyone has any tips on how this code could be modified that would be helpfull too.


[EDIT] Also is it possible to put this code, or parts of this code into one line, like the function thing, so that it does not look so big?

http://www.Bevansfunbox.com
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd Oct 2005 23:25
A common mistake.

Every time you fire off a set of rockets, you use the same standard numeric variable to control the speed. So, if the first set is on their way and travelling at max speed, firing a second set will also make them move at max speed.

What you need to do is create an array for the speed variable so each set of rockets can have their speed set independently.

Fire rocket set 1 and you add RocketSpd(1) to their position. Fire off set 2 and you add RocketSpd(2) to their position... and so on.

TDK_Man

Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 2nd Oct 2005 23:44
I dont know how to do arrays, any tutorials or help avaialble?

http://www.Bevansfunbox.com
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 2nd Oct 2005 23:50
Yes, there are tutorials in Dark Basic. If you go to TDK man's webpage:
[href]
http://www.matedit.com/
[/href]
I think there are some array tutorials in the tutorials section on arrays. There are also many other tutorials on the web about arrays, but in different languages. Try searching tutorials+arrays+qbasic on google and you should find some for qbasic. Qbasic is very similar to Dark Basic.

Green Bunnies rule!
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 3rd Oct 2005 23:30
Ok, i might be albe to get the hang of this array thingy. Just need to know if im on the right lines.
First off i need to creat things called "Dim" and specify the data content, which in my game will be 30 missiles. I have done 4 "Dims", 2 on each wing. 2 Sets are holding an ammount of 30 and the other 2 sets are holding the amount of 50. Then I need to somehow code some functions so if the object exists, the object number goes up one and then it creates it and so on. Then I need to create the timer for reloading which i think i can do, (fingers crossed) and the actuall speed function which i have no idea how to code. Hopefully this is sort of on the rite track of what i need? Also, is it better to actually Clone the object of create one each time it the shoot button is pressed?

http://www.Bevansfunbox.com
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 3rd Oct 2005 23:37
Also i forgot to say that if you are going to pick up objects that give you ammo, then will this array thing still work? I need to make 30 Rocket speed thingys but once i have depleted the ammo, and i get an object and it give me ammo, does that still apply to the 30 sets of speed thingys i made or would i somehow have to make the ammo create a new set of speed thingys?

http://www.Bevansfunbox.com
The admiral
22
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 4th Oct 2005 01:06
Generally you clone your objects when the games is loading up and hide them.

The admiral
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 4th Oct 2005 01:29
So it would be ok to each time the shoot button is pressed, it clones an object and moves it off?

http://www.Bevansfunbox.com
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Oct 2005 02:02
I get the distinct impression that you are in 'way over your head' here. You are trying to write quite a complex sort of program and to be honest you haven't got a clue what you are doing.

Quote: "I have done 4 "Dims", 2 on each wing"


I'm sorry, but that's nonsense and you simply cannot do what you are trying to do by diving in clueless and 'bodging' it. You need to go away and learn the 'basics' first.

Apart from the fact that you will get absolutely nowhere fast, the problem is that like in this post, when you ask a question, you don't have enough basic knowledge of DB to understand the answer!

If you knew the elementary stuff well enough, you wouldn't be talking about "Rocket speed thingys".

Sorry to be so blunt, but IMHO you need to learn how to write much simpler stuff than this first. This doesn't mean you have to be waste time on useless code though...

For example if you are absolutely sure you are good enough to be using 3D, write a simple program where you have 6 different coloured spheres which race down a straight track - each one getting faster and faster using random numbers.

Guess which colour will win then use the space bar to start the race and use arrays to control the speed of the spheres.

The same sphere should NOT win each time you run the program!

If you can do that simple task, you can then apply the technique to your rocket firing problem.

TDK_Man

Login to post a reply

Server time is: 2024-11-27 16:44:56
Your offset time is: 2024-11-27 16:44:56