← Wszystkie przykłady

Zwierzaki w ramkach

Każdy zwierzak trafia do ramki ze swoim imieniem. Upuszczenie na zajętą ramkę zamienia zwierzaki miejscami (onOccupied: swap), więc układankę łatwo poprawić.

Schemat
v2.0
Wymagane funkcje
element.imageelement.textelement.componentelement.targetvisual.textcomponent.draggabletarget.capacitytarget.onOccupiedrule.placeaction.play-soundaction.returnaction.emit-particles
Componenty
imagetexttargetcomponent

Jak otworzyć w edytorze

  1. Kliknij Otwórz w edytorze — GS Editor otworzy się z wczytanym ćwiczeniem (scena i zasoby).
  2. Albo kliknij Pobierz ćwiczenie (ZIP z projekt.json, images/ i sounds/) i w oknie startowym edytora wybierz Otwórz ZIP.

Plik ćwiczenia

Pokaż JSON (10 159 znaków)
{
  "schema": "2.0",
  "requires": [
    "element.image",
    "element.text",
    "element.component",
    "element.target",
    "visual.text",
    "component.draggable",
    "target.capacity",
    "target.onOccupied",
    "rule.place",
    "action.play-sound",
    "action.return",
    "action.emit-particles"
  ],
  "id": "jigsaw-swap",
  "size": {
    "width": 1200,
    "height": 675
  },
  "languages": [
    "pl",
    "en"
  ],
  "defaultLanguage": "pl",
  "assets": [
    {
      "id": "meadow",
      "kind": "image",
      "src": {
        "default": "images/meadow.png"
      }
    },
    {
      "id": "frame",
      "kind": "image",
      "src": {
        "default": "images/frame.png"
      }
    },
    {
      "id": "cat",
      "kind": "image",
      "src": {
        "default": "images/cat.png"
      }
    },
    {
      "id": "fox",
      "kind": "image",
      "src": {
        "default": "images/fox.png"
      }
    },
    {
      "id": "bear",
      "kind": "image",
      "src": {
        "default": "images/bear.png"
      }
    },
    {
      "id": "owl",
      "kind": "image",
      "src": {
        "default": "images/owl.png"
      }
    },
    {
      "id": "correct",
      "kind": "audio",
      "src": {
        "default": "sounds/correct.wav"
      }
    },
    {
      "id": "wrong",
      "kind": "audio",
      "src": {
        "default": "sounds/wrong.wav"
      }
    },
    {
      "id": "pick-up",
      "kind": "audio",
      "src": {
        "default": "sounds/pick-up.wav"
      }
    },
    {
      "id": "drop",
      "kind": "audio",
      "src": {
        "default": "sounds/drop.wav"
      }
    },
    {
      "id": "win",
      "kind": "audio",
      "src": {
        "default": "sounds/win.wav"
      }
    }
  ],
  "elements": [
    {
      "id": "background",
      "type": "image",
      "rect": [
        0,
        0,
        1200,
        675
      ],
      "layer": 0,
      "visual": {
        "type": "image",
        "asset": "meadow"
      }
    },
    {
      "id": "instruction",
      "type": "text",
      "rect": [
        72,
        20,
        1056,
        80
      ],
      "layer": 5,
      "visual": {
        "type": "text",
        "text": {
          "pl": "Wstaw każdego zwierzaka do ramki z jego imieniem. Upuść go na zajętą ramkę, a zwierzaki <b>zamienią się miejscami</b>.",
          "en": "Put each animal in the frame with its name. Drop it on a taken frame and the animals <b>swap places</b>."
        },
        "size": 26,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "frame-cat",
      "type": "target",
      "rect": [
        105,
        130,
        190,
        190
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "frame"
      },
      "capacity": 1,
      "onOccupied": "swap",
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct"
          },
          {
            "do": "emit-particles",
            "target": "dropped"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong"
          }
        ]
      }
    },
    {
      "id": "frame-fox",
      "type": "target",
      "rect": [
        375,
        130,
        190,
        190
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "frame"
      },
      "capacity": 1,
      "onOccupied": "swap",
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct"
          },
          {
            "do": "emit-particles",
            "target": "dropped"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong"
          }
        ]
      }
    },
    {
      "id": "frame-bear",
      "type": "target",
      "rect": [
        645,
        130,
        190,
        190
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "frame"
      },
      "capacity": 1,
      "onOccupied": "swap",
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct"
          },
          {
            "do": "emit-particles",
            "target": "dropped"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong"
          }
        ]
      }
    },
    {
      "id": "frame-owl",
      "type": "target",
      "rect": [
        915,
        130,
        190,
        190
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "frame"
      },
      "capacity": 1,
      "onOccupied": "swap",
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct"
          },
          {
            "do": "emit-particles",
            "target": "dropped"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong"
          }
        ]
      }
    },
    {
      "id": "label-cat",
      "type": "text",
      "rect": [
        105,
        328,
        190,
        44
      ],
      "layer": 2,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>Kot</b>",
          "en": "<b>Cat</b>"
        },
        "size": 30,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "label-fox",
      "type": "text",
      "rect": [
        375,
        328,
        190,
        44
      ],
      "layer": 2,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>Lis</b>",
          "en": "<b>Fox</b>"
        },
        "size": 30,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "label-bear",
      "type": "text",
      "rect": [
        645,
        328,
        190,
        44
      ],
      "layer": 2,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>Miś</b>",
          "en": "<b>Bear</b>"
        },
        "size": 30,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "label-owl",
      "type": "text",
      "rect": [
        915,
        328,
        190,
        44
      ],
      "layer": 2,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>Sowa</b>",
          "en": "<b>Owl</b>"
        },
        "size": 30,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "fox",
      "type": "component",
      "rect": [
        135,
        480,
        130,
        130
      ],
      "layer": 3,
      "visual": {
        "type": "image",
        "asset": "fox"
      },
      "draggable": {
        "bounds": "scene",
        "hit": "pixels"
      },
      "on": {
        "drag-start": [
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    },
    {
      "id": "owl",
      "type": "component",
      "rect": [
        405,
        480,
        130,
        130
      ],
      "layer": 3,
      "visual": {
        "type": "image",
        "asset": "owl"
      },
      "draggable": {
        "bounds": "scene",
        "hit": "pixels"
      },
      "on": {
        "drag-start": [
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    },
    {
      "id": "cat",
      "type": "component",
      "rect": [
        675,
        480,
        130,
        130
      ],
      "layer": 3,
      "visual": {
        "type": "image",
        "asset": "cat"
      },
      "draggable": {
        "bounds": "scene",
        "hit": "pixels"
      },
      "on": {
        "drag-start": [
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    },
    {
      "id": "bear",
      "type": "component",
      "rect": [
        945,
        480,
        130,
        130
      ],
      "layer": 3,
      "visual": {
        "type": "image",
        "asset": "bear"
      },
      "draggable": {
        "bounds": "scene",
        "hit": "pixels"
      },
      "on": {
        "drag-start": [
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    }
  ],
  "rule": {
    "kind": "place",
    "pairs": [
      {
        "components": [
          "cat"
        ],
        "targets": [
          "frame-cat"
        ]
      },
      {
        "components": [
          "fox"
        ],
        "targets": [
          "frame-fox"
        ]
      },
      {
        "components": [
          "bear"
        ],
        "targets": [
          "frame-bear"
        ]
      },
      {
        "components": [
          "owl"
        ],
        "targets": [
          "frame-owl"
        ]
      }
    ]
  },
  "on": {
    "completed": [
      {
        "do": "play-sound",
        "asset": "win"
      },
      {
        "do": "emit-particles",
        "target": "frame-cat"
      },
      {
        "do": "emit-particles",
        "target": "frame-fox"
      },
      {
        "do": "emit-particles",
        "target": "frame-bear"
      },
      {
        "do": "emit-particles",
        "target": "frame-owl"
      }
    ]
  }
}