Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualL. Spiro

Posted 21 November 2012 - 04:55 PM

I used:

if(abs(ballposition.x-balltarget.x)< ballspeed && abs(ballposition.y-balltarget.y)< ballspeed)
	{
		balltarget.x = (rand() * 100) % SCREEN_WIDTH;
		balltarget.y = (rand() * 100) % SCREEN_HEIGHT;
	}

Wrong again. It should be:
if(abs(ballposition.x-balltarget.x)< ballspeed || abs(ballposition.y-balltarget.y)< ballspeed)
	{
		balltarget.x = (rand() * 100) % SCREEN_WIDTH;
		balltarget.y = (rand() * 100) % SCREEN_HEIGHT;
	}
And no I am not talking about the difference in whitespace nor your use of [source] instead of [code].


L. Spiro

#1L. Spiro

Posted 21 November 2012 - 04:54 PM

I used:

if(abs(ballposition.x-balltarget.x)< ballspeed && abs(ballposition.y-balltarget.y)< ballspeed)
	{
		balltarget.x = (rand() * 100) % SCREEN_WIDTH;
		balltarget.y = (rand() * 100) % SCREEN_HEIGHT;
	}

Wrong again. It should be:
if(abs(ballposition.x-balltarget.x)< ballspeed || abs(ballposition.y-balltarget.y)< ballspeed)
    {
	    balltarget.x = (rand() * 100) % SCREEN_WIDTH;
	    balltarget.y = (rand() * 100) % SCREEN_HEIGHT;
    }


L. Spiro

PARTNERS