I'm working on my first sidescrolling game and I need some help with crashing. Everything's working perfect so far, moving, collecting objects, adding/removing score. Objects fly from left to right and they dissapear when they hit the opposite end of the world.
Now I'm trying to add a minus score if the object hits the opposite side but the game crashes.
How should I fix this?
public void act()
{
setLocation(getX() -2, getY());
if (getX() == 0) {
// ((Game) getWorld()).addScore(-20);
getWorld().removeObject(this);
}
