This site requires JavaScript, please enable it in your browser!
Greenfoot back
sopatron
sopatron wrote ...

2013/12/18

how to getX() of another actor

sopatron sopatron

2013/12/18

#
i want to make a pong game and i want the second wall to be moved by the computer if the ball is under 400 X but i have trouble getting the X of the ball :( my code is like this public void automove() { if(getX(Ball) <= 400) { if(getY(Ball) < getX() - 20) { move(4); } if(Ball.getY(Ball) < getX() + 20) { move(4); } } }
You need to login to post a reply.