For my platform game I use this when there is a collision going on with a platform and the player:
Right now it just pushes the player upward when they intersect but the problem is that the player will also be pushed up when it intersects the side of the platform.. So is there another way to do this? Something that will keep the player out of the platform from all the sides?
public boolean intersect5() { Actor player = getOneIntersectingObject(Platform.class); if (player == null){ return false; }else{ return true; } }
public void checkCollision() { int originalX = getX(); int originalY = getY(); if(intersect5()){ setLocation(originalX, originalY-7); } }