Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualselve

Posted 21 November 2012 - 12:40 PM

So how should it look like?
I've did this in ball moving function:
[source lang="cpp"]if(ballposition.x == ballX && ballposition.y == ballY) { targetreached = true; }[/source]
And this in while(!gameover):
[source lang="cpp"]if(targetreached) { srand(time(NULL)); do { ballX = randx; ballY = randy; }while(abs(oldx-ballX) > 300 && abs(oldy-ballY) > 300); oldx = ballX; oldy = ballY; targetreached = false; }[/source]

But it is still not working ;/ The ball is just moving to one position and then doesn't move any more.

#7selve

Posted 21 November 2012 - 12:40 PM

So how should it look like?
I've did this in ball moving function:
[source lang="cpp"]if(ballposition.x == ballX && ballposition.y == ballY) { targetreached = true; }[/source]
And this in while(!gameover):
[source lang="cpp"]if(targetreached) { srand(time(NULL)); do { ballX = randx; ballY = randy; }while(abs(oldx-ballX) > 300 && abs(oldy-ballY) > 300); oldx = ballX; oldy = ballY; targetreached = false; }[/source]

But it is still not working ;/ The ball is just moving to one position and then doesn't move any more.

#6selve

Posted 21 November 2012 - 12:39 PM

So how should it look like?
I've did this in ball moving function:
[source lang ="cpp"]if(ballposition.x == ballX && ballposition.y == ballY) { targetreached = true; }[/source]
And this in while(!gameover):
[source lang ="cpp"]if(targetreached) { srand(time(NULL)); do { ballX = randx; ballY = randy; }while(abs(oldx-ballX) > 300 && abs(oldy-ballY) > 300); oldx = ballX; oldy = ballY; targetreached = false; }[/source]

But it is still not working ;/ The ball is just moving to one position and then doesn't move any more.

#5selve

Posted 21 November 2012 - 12:38 PM

So how should it look like?
I've did this in ball moving function:
[source lang ="cpp"]if(ballposition.x == ballX && ballposition.y == ballY) { targetreached = true; }[/source]
And this in while(!gameover):
[source lang ="cpp"]if(targetreached) { srand(time(NULL)); do { ballX = randx; ballY = randy; }while(abs(oldx-ballX) > 300 && abs(oldy-ballY) > 300); oldx = ballX; oldy = ballY; targetreached = false; }[/source]

But it is still not working ;/ The ball is just moving to one position and then doesn't move any more.

#4selve

Posted 21 November 2012 - 12:38 PM

So how should it look like?
I've did this in ball moving function:
[source lang ="cpp"]if(ballposition.x == ballX && ballposition.y == ballY) { targetreached = true; }[/source]
And this in while(!gameover):
[source lang ="cpp"]if(targetreached) { srand(time(NULL)); do { ballX = randx; ballY = randy; }while(abs(oldx-ballX) > 300 && abs(oldy-ballY) > 300); oldx = ballX; oldy = ballY; targetreached = false; }[/source]

But it is still not working ;/

#3selve

Posted 21 November 2012 - 12:37 PM

So how should it look like?
I've did this in ball moving function:
[source lang ="cpp"]if(ballposition.x == ballX && ballposition.y == ballY) { targetreached = true; }[/source]
And this in while(!gameover):
[source lang ="cpp"]if(targetreached) { srand(time(NULL)); do { ballX = randx; ballY = randy; }while(abs(oldx-ballX) > 300 && abs(oldy-ballY) > 300); oldx = ballX; oldy = ballY; targetreached = false; }[/source]

PARTNERS