Remade collision detection. Works nicely for rectangular objects at least, as long as they are bigger than the player.