The reason that I had the five pixels instead of three was because when I was testing my game, it was too hard to hit the green target because you had to be right on. I changed this to five so that you could still have the end of your reticle hit the end of the other reticle to test for collision, since the collision was tested from the middle of the reticle.
I sort of have a clamp to screen because when the reticle that moves on it's own hits the side of the screen, it inverts the direction of whatever axis was hit on. This then sends the object away from the edge of the screen, thereby clamping it in the screen.
Homework Assignment Episode 7 (** READING == SPOILER **)
Re: Homework Assignment Episode 7 (** READING == SPOILER **)
Natox wrote:I'm doubting about my judgement right now, but I switched 2 ifstatements.... let me show you.
I switched the first and the second statement with eachother.... Why you're asking?Code: Select all
if( mtx == 700 ) { mty = mty + targetspeed; } if( mty == 100 ) { mtx = mtx + targetspeed; } if( mty == 500 ) { mtx = mtx - targetspeed; } if( mtx == 100 && mty > 100 ) { mty = mty - targetspeed; }
Well I'm not really sure myself anymore... haha!
The reason that I swapped the top 2 if-statements, is because since the program reads the complete composedframe code over and over again, it actually moves the target to the right, untill it hits the 700pixel distance, then it reads all over the rest of the code before it starts over again and finally gets to the 'moving down code'. I thought this would give it just a mili-mili-mili second more time to display the target on the actual 700x100 coordinates.
Now again, this might be total bull-crap since I'm tired and all, but it might just be true!
So, this is my last shot, the only thing I can come up with. If this is false, I will kill myself!
Just kidding ofcourse, if this is not the right solution I will stick with the 'faulty' programming until your next video comes out!
cout << "C H E E R S" << endl;
----------------------^
that line of code is what we need to learn next!! I know what it does !
it makes a .bat file and there stands CHEERS and then it's waiting for you to press a key, oh you forgot << pauze; () ) <-- or something like that, otherwise the screen will be there for like 1 millisecond! haha.
Re: Homework Assignment Episode 7 (** READING == SPOILER **)
Haha that line of text only prints out that text on your screen.WwortelHD wrote:that line of code is what we need to learn next!! I know what it does !
it makes a .bat file and there stands CHEERS and then it's waiting for you to press a key, oh you forgot << pauze; () ) <-- or something like that, otherwise the screen will be there for like 1 millisecond! haha.
It can be used in a 'console application' which basically looks the same as your MSDOS window.
You could pause it, I suppose, but it does not seem to be a necessity... since it doesn't close automatically when using code::blocks compiler. Anyway, that is all it does.
cout << "Hello, my text here" << an integer or float or char can go here aswell I think << endl;
endl; means end line, but you could also (if ending in the text already), put a \n behind it like this:
cout << "Hello, my text ends here. \n";
This \n means nothing more then, new line.
correct me if I'm wrong!
My Weblog: http://www.gamer-bay.com/
Keep track of my learning progress on the C++ programming language.
Keep track of my learning progress on the C++ programming language.
Re: Homework Assignment Episode 7 (** READING == SPOILER **)
Natox here does indeed have the right of it. As for teaching iostream next, I don't plan on working in console mode for a while, and when we do (if ever), I actually prefer stdio to iostream at any rate.
Chili
Re: Homework Assignment Episode 7 (** READING == SPOILER **)
Hey Natox, did the homework explanation in lesson 8 clear up the confusion about the cursor skipping corners?
Chili
Re: Homework Assignment Episode 7 (** READING == SPOILER **)
Hey, if you read a bit back in this post, you'll notice that I already found a part of the flaw and posted it.... but now it has become completely clear, thanks alot!chili wrote:Hey Natox, did the homework explanation in lesson 8 clear up the confusion about the cursor skipping corners?
Too bad that we did not get a new programming homework assignment though!
Looking forward to next lesson mate
My Weblog: http://www.gamer-bay.com/
Keep track of my learning progress on the C++ programming language.
Keep track of my learning progress on the C++ programming language.