I am trying to make it so, when a Bullet touches a rock, it splits into 2 smaller rocks at the location, where the rock was shot, but I cant seem to figure out how to do it, i tried creating the following method.
class ball (rock):
While at the top in the same class i declare the variables locationX and locationY
this gives me an error saying something along the lines of "actor does not exist in world" or something.
public void split() { Actor bullet = getOneIntersectingObject(bullet.class); if (bullet != null) { World myWorld = getWorld(); myWorld.removeObject(this); ball2 ball2 = new ball2(); getWorld().addObject(ball2, locationX, locationY); } }
public int locationX=this.getX(); public int locationY=this.getY();