Advertisement

help me with that please....

Started by September 29, 2001 12:50 PM
13 comments, last by BiteThat 23 years, 4 months ago
the problem is i have a´

struct {
float x;
float y;
bool active;
}shots[10];


with every keypress the NUM_BULLETS is increased, until 10 (10 bullets allowed at a time).

if a bullet has come to a specific x limit it is resetted...
but then i must decrease the NUM_BULLETS counter somewhere..because otherwise u could only shoot 10 times...

sorry i cant describe better....
comeon please help me i am desperate ...

the main idea is i want to have unlimited ammo ...
Advertisement
mmmmmm, well, BulletCounter is set back to 1 everytime the function is called. ie
for( BulletCounter=1; BulletCounter<=BulletNum; BulletCounter++)
Its set to 1 here everytime and incremented to the number of bullets. If you are refering to BulletNum being reset, I don't. In my Demo level of my game there is an ammo limit of 350, so bulletnum keeps incrementing but not drawn if outa range/destroyed due to the B_Jip boolean variable. You may think that its still counting in the loop which is inefficient but I dont think it'll take the processor very long to count to the number of bullets. I suppose it depends on how many bullets you intend to shoot per level, I don't have a 'number of bullets at a time' rule in my game so I didn't need to code the kinda thing you are talking about. Lemme think about it cause at the minute I have a major headache.

**Later**

This probly won't work, I just brainstorming, but if when you decremented BulletNum you took all the coords of each bullet down one element, ie:Bullet[5]=Bullet[4],Bullet[6]=Bullet[5]; etc
Might not work but my head is still sore!

Edited by - AbeE on September 30, 2001 2:30:58 PM
well i want unlimited ammo, so im gonna set the maximum ammo to 9999 that should be more than enough, and its the easiest solution....


thanks for your time, and i hope your headache will be gone soon =) btw..have u got icq ??
Email me at RufusMeadow@hotmail.com if you want it.

This topic is closed to new replies.

Advertisement