<level>
  <playground map="switches.map">
    <decorations>
      <platform id="1" x="16" y="23" w="8" left="yellow" right="yellow"/>
      <platform x="2" y="7" w="9"/>
      <platform x="29" y="7" w="9"/>
      <platform x="2" y="15" w="9"/>
      <platform x="29" y="15" w="9"/>

      <barrier id="20" x="12" y="1" h="7" activated="1"/>
      <barrier id="21" x="27" y="1" h="7" activated="1"/>
      <barrier id="22" x="12" y="9" h="7" activated="1"/>
      <barrier id="23" x="27" y="9" h="7" activated="1"/>

      <magnet id="25" orientation="left" x="1" y="10" h="6"
              distance="12" activated="1"/>
      <magnet id="26" orientation="right" x="38" y="10" h="6"
              distance="12" activated="1"/>

      <switch id="30" orientation="top" x="16" y="1"/>
      <switch id="31" orientation="top" x="23" y="1"/>
      <switch id="32" orientation="left" x="1" y="4"/>
      <switch id="33" orientation="right" x="38" y="4"/>
      <switch id="34" orientation="top" x="3" y="9"/>
      <switch id="35" orientation="top" x="36" y="9"/>

      <crate id="10" type="big" x="6" y="7"/>
      <crate id="11" type="big" x="33" y="7"/>
      <crate id="12" type="big" x="6" y="15"/>
      <crate id="13" type="big" x="33" y="15"/>
    </decorations>
  </playground>

  <startposition platform="1"/>

  <gamecontrol>
  <![CDATA[
	function init() {
		for (var id = 10; id <= 13; id++) {
			addBringCrateToPlatformObjective(id, 1);
		}
  	}

	function onSwitch(s) {
		switch (s.getID()) {
		case 30:
			gameControl.getObjectById(22).toggle();
			break;
		case 31:
			gameControl.getObjectById(23).toggle();
			break;
		case 32:
			gameControl.getObjectById(22).toggle();
			gameControl.getObjectById(23).toggle();
			gameControl.getObjectById(25).toggle();
			break;
		case 33:
			gameControl.getObjectById(22).toggle();
			gameControl.getObjectById(23).toggle();
			gameControl.getObjectById(26).toggle();
			break;
		case 34:
			gameControl.getObjectById(20).toggle();
			gameControl.getObjectById(22).toggle();
			break;
		case 35:
			gameControl.getObjectById(21).toggle();
			gameControl.getObjectById(23).toggle();
			break;
		}
	}
	
  	function onObjectiveReached() {
  		gameControl.finish();
  	}
  ]]>
  </gamecontrol>
</level>
