I am trying to check when my Hero makes impact with an object at a specific point I want to bounce it back. I have this at the moment:
How do I move Mario -30 on the first if statement and +30 on the second?
if (getOneObjectAtOffset(-30, -40, Mario.class) != null || getOneObjectAtOffset(-30, 40, Mario.class) != null) { System.out.println("hit block left"); //Mario.setLocation(getX() - 30, getY()); } if (getOneObjectAtOffset(30, -40, Mario.class) != null || getOneObjectAtOffset(30, 40, Mario.class) != null) { System.out.println("hit block right"); }