public void updatePosition(Level terrain)
	{		
		boolean collision = false;
		while (detectHorizontalCollision(terrain) == true)
		{
			collision = true;
			if (heroxSpeed < 0)
			{
				heroxSpeed = (int)(heroxSpeed + 1);
			}
			else if (heroxSpeed > 0)
			{
				heroxSpeed = (int)(heroxSpeed - 1);
			}
		}
		herox += heroxSpeed;
		if (collision)
			heroxSpeed = 0;
		
		collision = false;
		while (detectVerticalCollision(terrain) == true)
		{
			collision = true;
			if (heroySpeed < 0)
			{
				
				heroySpeed = (int)(heroySpeed + 1);
			}
			else if (heroySpeed > 0)
			{
				heroySpeed = (int)(heroySpeed - 1);
			}
		}
		heroy += heroySpeed;
		if (collision)
			heroySpeed = 0;
	}