@Override
	public void actionPerformed(ActionEvent arg0)
	{
		if (doors.size() > 0)
		{
			for (int i = 0; i < doors.size(); i++)
			{
				Body door = doors.get(i);
				EditorObjectInformation baseDoor = doorObjects.get(i);
				if (world.isClosedDoor(baseDoor.toString()))
				{
					int diffX = (int) (door.getPosition().getX() - baseDoor.getStartPosition().x);
					int diffY = (int) (door.getPosition().getY() - baseDoor.getStartPosition().y);
					if (diffX != 0)
					{
						if (diffX > 0)
							diffX--;
						else
							diffX++;
					}
					if (diffY != 0)
					{
						if (diffY > 0)
							diffY--;
						else
							diffY++;
					}
					door.setPosition(baseDoor.getStartPosition().x + diffX, baseDoor.getStartPosition().y + diffY);
				}
				else
				{
					int diffX = (int) (door.getPosition().getX() - baseDoor.getEndPosition().x);
					int diffY = (int) (door.getPosition().getY() - baseDoor.getEndPosition().y);
					if (diffX != 0)
					{
						if (diffX > 0)
							diffX--;
						else
							diffX++;
					}
					if (diffY != 0)
					{
						if (diffY > 0)
							diffY--;
						else
							diffY++;
					}
					door.setPosition(baseDoor.getEndPosition().x + diffX, baseDoor.getEndPosition().y + diffY);
				}
			}
		}

		if (pcImage != null)
		{
			pcCounter = (pcCounter + 1) % 5;
			if (pcCounter == 4 && world.isClosed(pc))
				pcX = (pcX + 1) % 4;
		}
		if (colorGain)
			colorN += 3;
		else
			colorN -= 5;
		if (colorN >= 200)
			colorGain = false;
		else if (colorN <= 30)
			colorGain = true;

		if (hero2D.getPosition().getY() > 280)
			factY = 0;
		else
			factY = 520;
		if (world.isDead() || gettingUp)
			deadCounter++;
		if (running && !world.isDead())
		{
			for (int i = 0; i < 4; i++)
			{
				world2D.step();
				validate();
			}
		}
		if (world.isDead())
		{
			if (deadCounter % 4 == 0)
			{
				imgX = (imgX + 1) % 5;
				if (imgX == 0)
					imgY = (imgY + 1) % 3;
			}
			if (imgY == 2 && imgX == 4)
			{
				deadCounter = 0;
				gettingUp = true;
				imgX = 0;
			}
		}
		if (gettingUp)
		{
			imgY = 3;
			if (deadCounter % 20 == 19)
				imgX++;
			if (imgX == 2)
				world.setDead(false);
			if (imgX == 4)
				gettingUp = false;
		}
		if (!interAct)
		{
			setRunning(true);
		}
		else
		{
			setRunning(false);
			hero.setPaused(true);
			if (interActX > 0)
			{
				interActX -= 25;
				interActEnd = true;
			}
			if (interActMoved > 0)
				interActEnd = true;
			if (interActMoved == interActMax + 1)
			{
				interActX -= 25;
				if (interActX < -930)
				{
					interAct = false;
					hero.setPaused(false);
				}
			}
		}

		update();
		for (GameMovingObject object : platforms)
			object.update();

		int x = (int) hero2D.getPosition().getX();
		int y = (int) hero2D.getPosition().getY();
		if (y < 0)
			frame.loadMap(frame.getCurLvl(), objects.getNextMapInt().get(0), new Vector2f(x, 590));
		if (x > 900)
			frame.loadMap(frame.getCurLvl(), objects.getNextMapInt().get(1), new Vector2f(10, y));
		if (y > 600)
			frame.loadMap(frame.getCurLvl(), objects.getNextMapInt().get(2), new Vector2f(x, 10));
		if (x < 0)
			frame.loadMap(frame.getCurLvl(), objects.getNextMapInt().get(3), new Vector2f(890, y));

		if (objects.getNextLevelStep() != null)
		{
			if (x > objects.getNextLevelStep().x && x < objects.getNextLevelStep().x + objects.getNextLevelStep().width)
			{
				if (y > objects.getNextLevelStep().y && y < objects.getNextLevelStep().y + objects.getNextLevelStep().height)
					frame.loadMap(frame.getCurLvl() + 1, 1, new Vector2f(450, 300));
			}
		}
	}