so basically i want an actor call "blueCircle" to move in 1 direction at a random and move at the same speed the whole time it also needs to move in a straight line, please help, thank you


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | public class Bullet extends Actor { double x, y, dx, dy; int speed = 5 ; protected void addedToWorld(World world) { x = getX(); y = getY(); dx = Math.cos(Math.PI*getRotation()/ 180 )*speed; dy = Math.sin(Math.PI*getRotation()/ 180 )*speed; } public void act() { move(); } public void move() { x += dx; y += dy; setLocation(( int )x, ( int )y); } } |