Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actual0Circle0

Posted 19 January 2013 - 07:08 PM

If your enemy is less than the screen min or greater than the screen max you would reverse the speed of x and/or y.

 

xSpeed = 1;
ySpeed = 1;
If (target.x < screenMinX || target.x > screenMaxX)
    xSpeed = -xSpeed; //reverse
if(target.y < screenMinY || target.y > screenMaxX)
    ySpeed = -ySpeed; //reverse</pre>
target.x += xSpeed;
target.y += ySpeed;

 

you mean that?


#40Circle0

Posted 19 January 2013 - 07:07 PM

If your enemy is less than the screen min or greater than the screen max you would reverse the speed of x and/or y.

 

</p><pre>
xSpeed = 1;
ySpeed = 1;
If (target.x < screenMinX || target.x > screenMaxX)
    xSpeed = -xSpeed; //reverse
if(target.y < screenMinY || target.y > screenMaxX)
    ySpeed = -ySpeed; //reverse</pre>
target.x += xSpeed;
target.y += ySpeed;

 

you mean that?


#30Circle0

Posted 19 January 2013 - 07:06 PM

If your enemy is less than the screen min or greater than the screen max you would reverse the speed of x and/or y.

 

xSpeed = 1;
ySpeed = 1;
If (target.x < screenMinX || target.x > screenMaxX)
    xSpeed = -xSpeed; //reverse
if(target.y < screenMinY || target.y > screenMaxX)
    ySpeed = -ySpeed; //reverse

 

 

you mean that?


#20Circle0

Posted 19 January 2013 - 07:05 PM

If your enemy is less than the screen min or greater than the screen max you would reverse the speed of x and/or y.

 

xSpeed = 1;
ySpeed = 1;
If (target.x < screenMinX || target.x > screenMaxX)
    xSpeed = -xSpeed;
if(target.y < screenMinY || target.y > screenMaxX)
    ySpeed = -ySpeed;

 

 

you mean that?


#10Circle0

Posted 19 January 2013 - 07:05 PM

If your enemy is less than the screen min or greater than the screen max you would reverse the speed of x and/or y.

xSpeed = 1;
ySpeed = 2;
If (target.x < screenMinX || target.x > screenMaxX)
    xSpeed = -xSpeed;
if(target.y < screenMinY || target.y > screenMaxX)
    ySpeed = -ySpeed;

 

you mean that?


PARTNERS