Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualselve

Posted 21 November 2012 - 01:11 PM

Thanks all, now it's working.
Instead of using:
[source lang="cpp"]if(ballposition.x == balltarget.x && ballposition.y == balltarget.y)    {        balltarget.x = (rand() * 100) % SCREEN_WIDTH;        balltarget.y = (rand() * 100) % SCREEN_HEIGHT;    }[/source]

I used:
[source lang="cpp"]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;    }[/source]

#2selve

Posted 21 November 2012 - 01:06 PM

Thanks all, now it's working.
Instead of using:
[source lang="cpp"]if(ballposition.x == balltarget.x &amp;&amp; ballposition.y == balltarget.y)    {        balltarget.x = (rand() * 100) % SCREEN_WIDTH;        balltarget.y = (rand() * 100) % SCREEN_HEIGHT;    }[/source]

I used:
[source lang="cpp"]if(abs(ballposition.x-balltarget.x)<10 &amp;&amp; abs(ballposition.y-balltarget.y)< 10)    {        balltarget.x = (rand() * 100) % SCREEN_WIDTH;        balltarget.y = (rand() * 100) % SCREEN_HEIGHT;    }[/source]

#1selve

Posted 21 November 2012 - 01:05 PM

Thanks all, now it's working.
Instead of using:
[source lang="cpp"]if(ballposition.x == balltarget.x && ballposition.y == balltarget.y)    {        balltarget.x = (rand() * 100) % SCREEN_WIDTH;        balltarget.y = (rand() * 100) % SCREEN_HEIGHT;    }[/source]

I used:
[source lang="cpp"]if(abs(ballposition.x-balltarget.x)<100 && abs(ballposition.y-balltarget.y)< 100)    {        balltarget.x = (rand() * 100) % SCREEN_WIDTH;        balltarget.y = (rand() * 100) % SCREEN_HEIGHT;    }[/source]

PARTNERS