Homework Assignment Episode 7 (** READING == SPOILER **)
Posted: January 13th, 2012, 4:15 am
DO NOT READ IF YOU DID NOT FINISH YOUR HOMEWORK!
UNLESS YOU WANT TO CHEAT ON YOURSELF AND LEARN LESS
Alrighty, I'm already enjoying this stuff ALOT!
As you might be able to figure out from the code, my starting point or 'origin' for my moving crosshair = 100 from x nullpoint and 100 from y nullpoint. It's running around in a dimension of 600 x 400ish. Also added a targetspeed variable so it can be set to a higher difficulty (target's moving speed) if wanted.
Anyway, I think I have the answer, atleast it seems to be working!
The code might be a little too much at some points, I was going nuts after figuring this out for 20 minutes or so. So I think the code can be tweaked even more, but did not really try to figure that out since it is 05.22 AM here right now, this coding has got me addicted!
I'm off to bed now though because I got this moving crosshair working!! Now I can sleep in peace!! Hope I get your oh-so-wise answer tomorrow my friend.
And thanks AGAIN for putting effort into teaching C++ to us noobs!
Thanks
UNLESS YOU WANT TO CHEAT ON YOURSELF AND LEARN LESS
Alrighty, I'm already enjoying this stuff ALOT!
As you might be able to figure out from the code, my starting point or 'origin' for my moving crosshair = 100 from x nullpoint and 100 from y nullpoint. It's running around in a dimension of 600 x 400ish. Also added a targetspeed variable so it can be set to a higher difficulty (target's moving speed) if wanted.
Anyway, I think I have the answer, atleast it seems to be working!
Code: Select all
// Moving Target Movement.
if( mty == 100 && mtx < 700 )
{
mtx = mtx + targetspeed;
}
if( mtx == 700 && mty < 500 )
{
mty = mty + targetspeed;
}
if( mty == 499 && mtx < 701 )
{
mtx = mtx - targetspeed;
}
if( mtx == 100 && mty > 100 )
{
mty = mty - targetspeed;
}
I'm off to bed now though because I got this moving crosshair working!! Now I can sleep in peace!! Hope I get your oh-so-wise answer tomorrow my friend.
And thanks AGAIN for putting effort into teaching C++ to us noobs!
Thanks