I'M EXTREMELY NEW to coding, and I need help with a game for a school project. I'm sure my code is poorly written, sorry!
I have this code in the "parent" target, and 3 "child" classes under target, being TargetMid, TargetFar, and TargetClose. The problem is that the code works for TargetClose, but not the other two. If it helps, I have code for unrelated things in TargetMid and Far, and nothing in TargetClose
public class Target extends Actor
{
public int targetSpeed=-8;
public static int scoreVar=0;
/**
* Act - do whatever the Target wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(MyWorld.isPaused == false)
{
setLocation(getX()+targetSpeed,getY());
if(getX()<5)
{
getWorld().removeObject(this);
}
}
pointup();
}
public void pointup()
{
Actor water = getOneIntersectingObject(Water.class);
if (water != null)
{
getWorld().removeObject(water);
getWorld().removeObject(this);
scoreVar++;
}
}
}
