taetsiETobeditswe
→ keyPressed()Runs once when any key is pressed.
tiro taetsiETobeditswe() { ... }Declare taetsiETobeditswe as a function with tiro, and Bopa will call it whenever any key is pressed. taetsi and khoutuYaTaetsi are updated before it is called, so you can read which key it was.
fa (taetsi === 'a') { ... }
It runs once per press. If you want something to happen for the whole time a key is held — moving something across the screen, say — read taetsiETshwerwe inside tshwantsha instead. That is the right way to build a game.
Click the sketch first. In the Bopa editor, key presses reach the sketch only while the preview pane holds the keyboard focus. If you press Tsamaisa ▶ and then start typing, the letters go into the code box — not into the sketch — and
taetsiETobeditswenever runs at all. Click once on the picture with the mouse and it starts working. This was measured in the running editor, not inferred.
Examples
Section titled “Examples”diri mmala = 200;
tiro setaLoeto() {
thalaKanefase(400, 240);
tlhalosa('Sekwere se se mo bogareng se se fetolang mmala nako nngwe le nngwe fa taetsi e tobediwa. Tobetsa setshwantsho pele.');
}
tiro tshwantsha() {
bokamorago(238);
tlogelaMothalo();
tlatsaMmala(mmala, 120, 200 - mmala / 2);
thalaSekwere(150, 60, 120);
tlatsaMmala(60);
bogoloJwaMokwalo(15);
rulaganyaMokwalo(BOGARE);
thalaMokwalo('Tobetsa setshwantsho, mme o bo o tobetsa taetsi', 200, 215);
}
tiro taetsiETobeditswe() {
mmala = paloEpe(40, 255);
}See also
Section titled “See also”taetsiEGolotswe, taetsiEKwadilwe, taetsiETshwerwe, taetsi, khoutuYaTaetsi