← Wszystkie przykłady

Połącz w pary

Każdego zwierzaka trzeba połączyć linią z tabliczką jego nazwy (reguła connect, punkty z rolą connectable). Punkty łączenia są narysowane na grafikach jako pierścienie, a punkt zaczepienia linii (anchor) każdego punktu jest wycelowany w środek pierścienia: linię zaczyna się i kończy przy pierścieniu, a kropki na jej końcach wypełniają pierścienie. Zła linia zostaje na czerwono (wrongLines: keep) i blokuje oba punkty, dopóki gracz jej nie kliknie; dobra para zostaje na scenie razem ze swoją zieloną linią i jest zablokowana (lock), więc nie da się jej już zmienić.

Schemat
v2.3
Wymagane funkcje
element.imageelement.textelement.componentvisual.textvisual.statescomponent.connectablecomponent.anchorrule.connectaction.play-soundaction.set-stateaction.lockaction.emit-particles
Componenty
imagetextcomponent

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 (11 299 znaków)
{
  "schema": "2.3",
  "requires": [
    "element.image",
    "element.text",
    "element.component",
    "visual.text",
    "visual.states",
    "component.connectable",
    "component.anchor",
    "rule.connect",
    "action.play-sound",
    "action.set-state",
    "action.lock",
    "action.emit-particles"
  ],
  "id": "connect-pairs",
  "size": {
    "width": 1200,
    "height": 675
  },
  "languages": [
    "pl",
    "en"
  ],
  "defaultLanguage": "pl",
  "assets": [
    {
      "id": "meadow",
      "kind": "image",
      "src": {
        "default": "images/meadow.png"
      }
    },
    {
      "id": "cat",
      "kind": "image",
      "src": {
        "default": "images/cat-point.png"
      }
    },
    {
      "id": "fox",
      "kind": "image",
      "src": {
        "default": "images/fox-point.png"
      }
    },
    {
      "id": "bear",
      "kind": "image",
      "src": {
        "default": "images/bear-point.png"
      }
    },
    {
      "id": "owl",
      "kind": "image",
      "src": {
        "default": "images/owl-point.png"
      }
    },
    {
      "id": "plate",
      "kind": "image",
      "src": {
        "default": "images/label-plate.png"
      }
    },
    {
      "id": "correct",
      "kind": "audio",
      "src": {
        "default": "sounds/correct.wav"
      }
    },
    {
      "id": "wrong",
      "kind": "audio",
      "src": {
        "default": "sounds/wrong.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,
        90
      ],
      "layer": 5,
      "visual": {
        "type": "text",
        "text": {
          "pl": "Połącz linią każdego zwierzaka z jego <b>nazwą</b>.<br>Złą, czerwoną linię usuń kliknięciem.",
          "en": "Draw a line from each animal to its <b>name</b>.<br>Click a wrong, red line to remove it."
        },
        "size": 30,
        "color": "#5a3a22",
        "align": "center",
        "states": {
          "win": {
            "text": {
              "pl": "Brawo! Wszystkie pary są połączone.",
              "en": "Well done! All the pairs are connected."
            },
            "size": 40,
            "color": "#2e8b3a"
          }
        }
      }
    },
    {
      "id": "cat",
      "type": "component",
      "rect": [
        100,
        150,
        130,
        130
      ],
      "layer": 2,
      "visual": {
        "type": "image",
        "asset": "cat"
      },
      "connectable": true,
      "anchor": {
        "point": [
          65,
          116
        ]
      },
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct",
            "exclusive": true
          },
          {
            "do": "emit-particles",
            "target": "self"
          },
          {
            "do": "lock",
            "target": "self"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong",
            "exclusive": true
          }
        ]
      }
    },
    {
      "id": "fox",
      "type": "component",
      "rect": [
        390,
        150,
        130,
        130
      ],
      "layer": 2,
      "visual": {
        "type": "image",
        "asset": "fox"
      },
      "connectable": true,
      "anchor": {
        "point": [
          65,
          116
        ]
      },
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct",
            "exclusive": true
          },
          {
            "do": "emit-particles",
            "target": "self"
          },
          {
            "do": "lock",
            "target": "self"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong",
            "exclusive": true
          }
        ]
      }
    },
    {
      "id": "bear",
      "type": "component",
      "rect": [
        680,
        150,
        130,
        130
      ],
      "layer": 2,
      "visual": {
        "type": "image",
        "asset": "bear"
      },
      "connectable": true,
      "anchor": {
        "point": [
          65,
          116
        ]
      },
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct",
            "exclusive": true
          },
          {
            "do": "emit-particles",
            "target": "self"
          },
          {
            "do": "lock",
            "target": "self"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong",
            "exclusive": true
          }
        ]
      }
    },
    {
      "id": "owl",
      "type": "component",
      "rect": [
        970,
        150,
        130,
        130
      ],
      "layer": 2,
      "visual": {
        "type": "image",
        "asset": "owl"
      },
      "connectable": true,
      "anchor": {
        "point": [
          65,
          116
        ]
      },
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct",
            "exclusive": true
          },
          {
            "do": "emit-particles",
            "target": "self"
          },
          {
            "do": "lock",
            "target": "self"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong",
            "exclusive": true
          }
        ]
      }
    },
    {
      "id": "name-bear",
      "type": "component",
      "rect": [
        65,
        505,
        200,
        80
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "plate"
      },
      "connectable": true,
      "anchor": {
        "point": [
          100,
          14
        ]
      },
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct",
            "exclusive": true
          },
          {
            "do": "emit-particles",
            "target": "self"
          },
          {
            "do": "lock",
            "target": "self"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong",
            "exclusive": true
          }
        ]
      }
    },
    {
      "id": "name-owl",
      "type": "component",
      "rect": [
        355,
        505,
        200,
        80
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "plate"
      },
      "connectable": true,
      "anchor": {
        "point": [
          100,
          14
        ]
      },
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct",
            "exclusive": true
          },
          {
            "do": "emit-particles",
            "target": "self"
          },
          {
            "do": "lock",
            "target": "self"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong",
            "exclusive": true
          }
        ]
      }
    },
    {
      "id": "name-cat",
      "type": "component",
      "rect": [
        645,
        505,
        200,
        80
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "plate"
      },
      "connectable": true,
      "anchor": {
        "point": [
          100,
          14
        ]
      },
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct",
            "exclusive": true
          },
          {
            "do": "emit-particles",
            "target": "self"
          },
          {
            "do": "lock",
            "target": "self"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong",
            "exclusive": true
          }
        ]
      }
    },
    {
      "id": "name-fox",
      "type": "component",
      "rect": [
        935,
        505,
        200,
        80
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "plate"
      },
      "connectable": true,
      "anchor": {
        "point": [
          100,
          14
        ]
      },
      "on": {
        "correct": [
          {
            "do": "play-sound",
            "asset": "correct",
            "exclusive": true
          },
          {
            "do": "emit-particles",
            "target": "self"
          },
          {
            "do": "lock",
            "target": "self"
          }
        ],
        "wrong": [
          {
            "do": "play-sound",
            "asset": "wrong",
            "exclusive": true
          }
        ]
      }
    },
    {
      "id": "label-bear",
      "type": "text",
      "rect": [
        65,
        525,
        200,
        56
      ],
      "layer": 2,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>Miś</b>",
          "en": "<b>Bear</b>"
        },
        "size": 40,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "label-owl",
      "type": "text",
      "rect": [
        355,
        525,
        200,
        56
      ],
      "layer": 2,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>Sowa</b>",
          "en": "<b>Owl</b>"
        },
        "size": 40,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "label-cat",
      "type": "text",
      "rect": [
        645,
        525,
        200,
        56
      ],
      "layer": 2,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>Kot</b>",
          "en": "<b>Cat</b>"
        },
        "size": 40,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "label-fox",
      "type": "text",
      "rect": [
        935,
        525,
        200,
        56
      ],
      "layer": 2,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>Lis</b>",
          "en": "<b>Fox</b>"
        },
        "size": 40,
        "color": "#5a3a22",
        "align": "center"
      }
    }
  ],
  "rule": {
    "kind": "connect",
    "pairs": [
      [
        "cat",
        "name-cat"
      ],
      [
        "fox",
        "name-fox"
      ],
      [
        "bear",
        "name-bear"
      ],
      [
        "owl",
        "name-owl"
      ]
    ],
    "inOrder": false,
    "draw": "drag",
    "lineWidth": 8,
    "lineColor": "#23763f",
    "wrongLines": "keep"
  },
  "on": {
    "completed": [
      {
        "do": "set-state",
        "target": "instruction",
        "state": "win"
      },
      {
        "do": "play-sound",
        "asset": "win"
      }
    ]
  }
}