I have an actor called Red_Ball getting removed by an actor called "Red_Goal". I want a function that checks to see how many red balls there are and adds one if there are none.


public void spawnBall() { List<Red_Ball> numredball = getObjects(Red_Ball.class); if (numredball.isEmpty()) { Red_Ball red_ball = new Red_Ball(); addObject(red_ball, 224, 255); } }