← Wszystkie przykłady

Ułóż słowo

Litery to przeciągalne elementy z tekstem; trzeba z nich ułożyć słowo pasujące do obrazka (KOT, po angielsku CAT). Litera zmienia kolor po dobrym i złym ruchu.

Schemat
v2.0
Wymagane funkcje
element.imageelement.textelement.componentelement.targetvisual.textvisual.animationvisual.statescomponent.draggabletarget.capacityrule.placeaction.play-soundaction.set-stateaction.lockaction.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 (13 063 znaki)
{
  "schema": "2.0",
  "requires": [
    "element.image",
    "element.text",
    "element.component",
    "element.target",
    "visual.text",
    "visual.animation",
    "visual.states",
    "component.draggable",
    "target.capacity",
    "rule.place",
    "action.play-sound",
    "action.set-state",
    "action.lock",
    "action.return",
    "action.emit-particles"
  ],
  "id": "word-building",
  "size": {
    "width": 1200,
    "height": 675
  },
  "languages": [
    "pl",
    "en"
  ],
  "defaultLanguage": "pl",
  "assets": [
    {
      "id": "meadow",
      "kind": "image",
      "src": {
        "default": "images/meadow.png"
      }
    },
    {
      "id": "tile",
      "kind": "image",
      "src": {
        "default": "images/tile.png"
      }
    },
    {
      "id": "frame",
      "kind": "image",
      "src": {
        "default": "images/frame.png"
      }
    },
    {
      "id": "cat-blink",
      "kind": "animation",
      "src": {
        "default": "images/cat-blink.png"
      }
    },
    {
      "id": "cat-joy",
      "kind": "animation",
      "src": {
        "default": "images/cat-joy.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,
        60
      ],
      "layer": 5,
      "visual": {
        "type": "text",
        "text": {
          "pl": "Ułóż z liter słowo, które pasuje do obrazka.",
          "en": "Build the word that matches the picture."
        },
        "size": 30,
        "color": "#5a3a22",
        "align": "center"
      }
    },
    {
      "id": "picture",
      "type": "image",
      "rect": [
        176,
        150,
        250,
        250
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "frame"
      }
    },
    {
      "id": "kitten",
      "type": "image",
      "rect": [
        221,
        195,
        160,
        160
      ],
      "layer": 2,
      "visual": {
        "type": "animation",
        "asset": "cat-blink",
        "frames": 4,
        "fps": 3,
        "loop": true,
        "autoplay": true,
        "states": {
          "smile": {
            "asset": "cat-joy",
            "frames": 4,
            "fps": 8,
            "loop": true,
            "autoplay": true
          }
        }
      }
    },
    {
      "id": "slot-1",
      "type": "target",
      "rect": [
        556,
        205,
        140,
        140
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "tile"
      },
      "capacity": 1,
      "on": {
        "correct": [
          {
            "do": "set-state",
            "target": "dropped",
            "state": "good"
          },
          {
            "do": "lock",
            "target": "dropped"
          },
          {
            "do": "play-sound",
            "asset": "correct"
          }
        ],
        "wrong": [
          {
            "do": "set-state",
            "target": "dropped",
            "state": "bad"
          },
          {
            "do": "play-sound",
            "asset": "wrong"
          },
          {
            "do": "return",
            "target": "dropped"
          }
        ]
      }
    },
    {
      "id": "slot-2",
      "type": "target",
      "rect": [
        720,
        205,
        140,
        140
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "tile"
      },
      "capacity": 1,
      "on": {
        "correct": [
          {
            "do": "set-state",
            "target": "dropped",
            "state": "good"
          },
          {
            "do": "lock",
            "target": "dropped"
          },
          {
            "do": "play-sound",
            "asset": "correct"
          }
        ],
        "wrong": [
          {
            "do": "set-state",
            "target": "dropped",
            "state": "bad"
          },
          {
            "do": "play-sound",
            "asset": "wrong"
          },
          {
            "do": "return",
            "target": "dropped"
          }
        ]
      }
    },
    {
      "id": "slot-3",
      "type": "target",
      "rect": [
        884,
        205,
        140,
        140
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "tile"
      },
      "capacity": 1,
      "on": {
        "correct": [
          {
            "do": "set-state",
            "target": "dropped",
            "state": "good"
          },
          {
            "do": "lock",
            "target": "dropped"
          },
          {
            "do": "play-sound",
            "asset": "correct"
          }
        ],
        "wrong": [
          {
            "do": "set-state",
            "target": "dropped",
            "state": "bad"
          },
          {
            "do": "play-sound",
            "asset": "wrong"
          },
          {
            "do": "return",
            "target": "dropped"
          }
        ]
      }
    },
    {
      "id": "bank-1",
      "type": "image",
      "rect": [
        265,
        500,
        110,
        110
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "tile"
      }
    },
    {
      "id": "bank-2",
      "type": "image",
      "rect": [
        405,
        500,
        110,
        110
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "tile"
      }
    },
    {
      "id": "bank-3",
      "type": "image",
      "rect": [
        545,
        500,
        110,
        110
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "tile"
      }
    },
    {
      "id": "bank-4",
      "type": "image",
      "rect": [
        685,
        500,
        110,
        110
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "tile"
      }
    },
    {
      "id": "bank-5",
      "type": "image",
      "rect": [
        825,
        500,
        110,
        110
      ],
      "layer": 1,
      "visual": {
        "type": "image",
        "asset": "tile"
      }
    },
    {
      "id": "letter-3",
      "type": "component",
      "rect": [
        265,
        500,
        110,
        110
      ],
      "layer": 3,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>T</b>",
          "en": "<b>T</b>"
        },
        "size": 80,
        "color": "#5a3a22",
        "align": "center",
        "states": {
          "good": {
            "color": "#2e8b3a"
          },
          "bad": {
            "color": "#d23c3c"
          }
        }
      },
      "draggable": {
        "bounds": "scene",
        "hit": "rect"
      },
      "on": {
        "drag-start": [
          {
            "do": "set-state",
            "target": "self",
            "state": "normal"
          },
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    },
    {
      "id": "letter-x1",
      "type": "component",
      "rect": [
        405,
        500,
        110,
        110
      ],
      "layer": 3,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>L</b>",
          "en": "<b>D</b>"
        },
        "size": 80,
        "color": "#5a3a22",
        "align": "center",
        "states": {
          "good": {
            "color": "#2e8b3a"
          },
          "bad": {
            "color": "#d23c3c"
          }
        }
      },
      "draggable": {
        "bounds": "scene",
        "hit": "rect"
      },
      "on": {
        "drag-start": [
          {
            "do": "set-state",
            "target": "self",
            "state": "normal"
          },
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    },
    {
      "id": "letter-1",
      "type": "component",
      "rect": [
        545,
        500,
        110,
        110
      ],
      "layer": 3,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>K</b>",
          "en": "<b>C</b>"
        },
        "size": 80,
        "color": "#5a3a22",
        "align": "center",
        "states": {
          "good": {
            "color": "#2e8b3a"
          },
          "bad": {
            "color": "#d23c3c"
          }
        }
      },
      "draggable": {
        "bounds": "scene",
        "hit": "rect"
      },
      "on": {
        "drag-start": [
          {
            "do": "set-state",
            "target": "self",
            "state": "normal"
          },
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    },
    {
      "id": "letter-x2",
      "type": "component",
      "rect": [
        685,
        500,
        110,
        110
      ],
      "layer": 3,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>S</b>",
          "en": "<b>O</b>"
        },
        "size": 80,
        "color": "#5a3a22",
        "align": "center",
        "states": {
          "good": {
            "color": "#2e8b3a"
          },
          "bad": {
            "color": "#d23c3c"
          }
        }
      },
      "draggable": {
        "bounds": "scene",
        "hit": "rect"
      },
      "on": {
        "drag-start": [
          {
            "do": "set-state",
            "target": "self",
            "state": "normal"
          },
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    },
    {
      "id": "letter-2",
      "type": "component",
      "rect": [
        825,
        500,
        110,
        110
      ],
      "layer": 3,
      "visual": {
        "type": "text",
        "text": {
          "pl": "<b>O</b>",
          "en": "<b>A</b>"
        },
        "size": 80,
        "color": "#5a3a22",
        "align": "center",
        "states": {
          "good": {
            "color": "#2e8b3a"
          },
          "bad": {
            "color": "#d23c3c"
          }
        }
      },
      "draggable": {
        "bounds": "scene",
        "hit": "rect"
      },
      "on": {
        "drag-start": [
          {
            "do": "set-state",
            "target": "self",
            "state": "normal"
          },
          {
            "do": "play-sound",
            "asset": "pick-up"
          }
        ],
        "drop-outside": [
          {
            "do": "play-sound",
            "asset": "drop"
          },
          {
            "do": "return",
            "target": "self"
          }
        ]
      }
    }
  ],
  "rule": {
    "kind": "place",
    "pairs": [
      {
        "components": [
          "letter-1"
        ],
        "targets": [
          "slot-1"
        ]
      },
      {
        "components": [
          "letter-2"
        ],
        "targets": [
          "slot-2"
        ]
      },
      {
        "components": [
          "letter-3"
        ],
        "targets": [
          "slot-3"
        ]
      }
    ]
  },
  "on": {
    "completed": [
      {
        "do": "set-state",
        "target": "kitten",
        "state": "smile"
      },
      {
        "do": "emit-particles",
        "target": "kitten"
      },
      {
        "do": "play-sound",
        "asset": "win"
      }
    ]
  }
}