Quote: "Sorry moops, I get this windows message:
Quote: "Microsoft Visual Studio C Runtime Library has detected a fatal error in shooter.exe.
Press Break to debug the program or Continue to terminate the program."
This happens here:
dbText (10,120,dbStr (CurrentBullet));
And anywhere you use dbText, I commented them out and it ran for me but it hung up on me when I kept it running for a while. I am on my laptop at the moment so I will need to check your new version on my desktop to be sure the other issue I was having has gone away."
I tried the newer version on my desktop and had same issue as above(from my laptop), are you guys not getting these errors?
Commented them out and it ran, I could move around, things coming in toward me and vanishing, as they should. I pressed left mouse button and kaboom, my computer shut down.
I got a blue screen telling me that windows had to close to stop my computer getting corrupted. I have never had this happen and I'm guessing its a memory issue as my laptop never done this.
From my position, I would have to disagree with JTK and say that something is very wrong with your code, you may be getting strange results with your projectiles and it may seem trivial but I would say my desktop computer is showing this up to be something serious.
The fact that both of my computers wont let you use the dbText() or more likely the dbStr() command is also alarming as I have never seen this error before.
Sorry to be the bringer of bad news all the time but I would maybe have a re-think if I was you and maybe start again.
I'll give you my opinion of where I think you may be able to improve.
Design and make your classes so they are as independent and self contained as possible, you are having an issue with creating and deleting projectiles, perhaps have a projectile class which has less responsibilities. As it stands now, the projectiles are responsible for their own ID numbers and even keeping track of how many there should be(maxProjectiles), they also deal with collision which means they need to know about other objects.
What do projectiles really need to do as a bare minimum:
start() // make/create etc
update() // just keep going in your current direction at your current speed
stop() // die/destroy etc maybe send a message to create an explosion(not projectiles problem after it sends the message)
It may need a tracking system:
setDirection(x, y, z)
This new projectile class does not care how many projectiles exist or are allowed to exist because its not its problem, it also does not care who its following, it just gets the instruction to go in a certain direction. This can all be tested without other classes being involved.
setDirection(dbObjectPositionX(ID), dbObjectPositionY(ID), dbObjectPositionZ(ID));
How does this help, you then create a small projectile handler/manager class that may have a responsiblity to make sure only so many projectiles exist at any one time, it will create them, update them and when they get destroyed it will sort your array out for you.
Lets say this only has three functions: makeProjectile(), updateProjectile(), destroyProjectile().
You can then test the making and the destroying of projectiles from your main.cpp without other classes being involved.
I have gone on a bit there but I just wanted to illustrate the point that smaller self contained classes that can be tested easily, what you have now is really impressive but you may gradually see that giving each class a small, well defined set of responsiblities will make your life easier. The challenge then is designing your classes and how they will interact, this is chalenging but can be rewarding.
The real irony is that most of the time you don't know what classes you need until you have done it wrong a few times, I go through many iterations when programming anything, as long as the next one is an improvement on the last then you know you are going in the right direction, good luck
.