Homework Assignment Episode 7 (** READING == SPOILER **)

The Partridge Family were neither partridges nor a family. Discuss.
MtDewdGM
Posts: 11
Joined: January 7th, 2012, 12:24 am

Re: Homework Assignment Episode 7 (** READING == SPOILER **)

Post by MtDewdGM » January 14th, 2012, 6:53 am

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.

WwortelHD
Posts: 34
Joined: January 6th, 2012, 7:01 pm
Location: Lochem
Contact:

Re: Homework Assignment Episode 7 (** READING == SPOILER **)

Post by WwortelHD » January 14th, 2012, 10:17 am

Natox wrote:I'm doubting about my judgement right now, but I switched 2 ifstatements.... let me show you.

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;
	}
I switched the first and the second statement with eachother.... Why you're asking?
Well I'm not really sure myself anymore... haha! :lol:

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! :lol:

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 ! :P
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. :lol:

Natox
Posts: 51
Joined: January 10th, 2012, 2:51 pm
Location: the Netherlands
Contact:

Re: Homework Assignment Episode 7 (** READING == SPOILER **)

Post by Natox » January 14th, 2012, 10:36 am

WwortelHD wrote:that line of code is what we need to learn next!! I know what it does ! :P
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. :lol:
Haha that line of text only prints out that text on your screen.
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.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Homework Assignment Episode 7 (** READING == SPOILER **)

Post by chili » January 15th, 2012, 12:53 pm

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. 8-)
Chili

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Homework Assignment Episode 7 (** READING == SPOILER **)

Post by chili » January 19th, 2012, 5:02 pm

Hey Natox, did the homework explanation in lesson 8 clear up the confusion about the cursor skipping corners? :)
Chili

Natox
Posts: 51
Joined: January 10th, 2012, 2:51 pm
Location: the Netherlands
Contact:

Re: Homework Assignment Episode 7 (** READING == SPOILER **)

Post by Natox » January 19th, 2012, 7:56 pm

chili wrote:Hey Natox, did the homework explanation in lesson 8 clear up the confusion about the cursor skipping corners? :)
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!

Too bad that we did not get a new programming homework assignment though! :P

Looking forward to next lesson mate :)
My Weblog: http://www.gamer-bay.com/
Keep track of my learning progress on the C++ programming language.

Post Reply