Hello, everyone!
I'm Octavarium XI. I've been programming C/C++ for about 10 months now.
Just today, I started programming a concept I've been thinking about a lot... And I already have a problem (Never good :p)
I use Dev-C++ and Notepad++ (just a quick note)
First, I tried using classes for drawing and key input, but it kept screwing up. So I decided to just use normal old functions.
Now, it'll compile, yes, but for some reason it just doesn't work. Can someone clarify the reason?
EDIT: Code removed, I'll attach it
Thanks!
Octavarium XI
I use Dev-C++ and Notepad++ (just a quick note)
I suggest switching to code::blocks and also please paste your code. Nothing personal but everyone here is a stranger and that could be a virus for all I know. I just dont have antivirus running right now.
Yes, you have reasons to be suspicous. A C++/ASM programmer who has 2 posts?
Anyways, here's the code.
The parenthesis and spacing are screwed up because of Allegro.cc; I don't know why o_O
You just have to click the help button and use the CODE tag to enclose your code.
Thanks, but why won't it work? o:
I might be mistaken but your global declaration for xturn is decremented until -5 and incremented until 5 only once and then it stops the motion. I think you need to somehow keep this variable in a different place, not globally.
void left() { if (xturn >= -5) xturn = (xturn - 0.1); } //void left() void right() { if (xturn <= 5) xturn = (xturn + 0.1); } //void right()
Well yah, but why won't it draw the bullets? o:
Is your live counter in sync with your bullet? I can't really tell cause
A. Im tired and my eyes are like
B. I'm going to pass out.
Haven't tried your program, just checked your code. I'm guessing you want to draw the bullets in your checkfordraw() function, right?. Then I guess the problem is your for loop. The second expression in a for is a condition, so for( counter = 1 ; counter == 10 ; ++counter ) will never be executed, you probably meant for( counter = 1 ; counter <= 10 ; ++counter ).
Oshi- that explains alot >_< /facepalm
Thanks for the help!
If you're wondering why so few people are responding, it's because "it doesn't work" is never, ever an acceptable problem description. Is it not compiling? Is it crashing? Is it running but showing some sort of wrong result? Until you describe what the problem actually is, in detail (e.g. "When I compile it, I get the following error: ...", "It compiles without warnings, but when I run it the colors are all weird - here's a screenshot"), few people are going to take the time to read through your code. I know I won't.
But from the one line kenmasters1976 quoted, there's a good chance you have a buffer overrun...
But from the one line kenmasters1976 quoted, there's a good chance you have a buffer overrun...
Let me have another look at his code... yes, you're right.
"it doesn't work" is never, ever an acceptable problem description
Yeah... it doesn't work.
Shouldn't it be for(counter = 0; counter < 10 ; counter++) ?
Shouldn't it be for(counter = 0; counter < 10 ; counter++) ?
He has his own concept, he said.. Respect the youth!
bool live[10] ; //Is the bullet live?
I've got nothing to help you, but I was wondering if you are using a bool on an array to account for multiple bullets on the screen?
Shouldn't it be for(counter = 0; counter < 10 ; counter++) ?
Hopefully he'll be able to fix that.
I've got nothing to help you, but I was wondering if you are using a bool on an array to account for multiple bullets on the screen?
Up to 10 live bullets on screen. Maybe he should change that hardcoded 10 with a #define MAX_BULLETS 10. Of course, he'll also have to take care of if (curbul < 11) 'cause that would mean a crash if he actually ever called checkforkey() with curbul = 10.