taetsiETshwerwe
→ keyIsDown()Returns `nnete` while the key you name is held down.
taetsiETshwerwe(taetsiEo)This is the right way to build a game. taetsiETobeditswe runs once per press, while taetsiETshwerwe gives you the key’s state on every frame — so a shape glides while the key is held rather than jumping.
It also handles two keys at once, which taetsi cannot:
fa (taetsiETshwerwe(MOLEMA_MOTSWI) && taetsiETshwerwe(GODIMO_MOTSWI)) { ... }
What it accepts — measured, not assumed:
- Bopa’s key constants:
taetsiETshwerwe(MOLEMA_MOTSWI),taetsiETshwerwe(ENTER). - The character the key types:
taetsiETshwerwe('x'). Case matters: while SHIFT is held,taetsiETshwerwe('x')ismaakaandtaetsiETshwerwe('X')isnnete. - The physical key’s name:
taetsiETshwerwe('KeyX')— this works too, and it ignores SHIFT, which makes it the safer one for a game. - Numbers are not accepted.
taetsiETshwerwe(88)is alwaysmaaka. Use the character or the key name.
Click the sketch first. In the Bopa editor the keyboard reaches the sketch only while the preview pane holds focus. Measured in the running editor: with focus in the code box,
taetsiETshwerwereturnsmaakahowever hard the key is held. One click on the picture fixes it.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
taetsiEo | mokwalo | The key you are asking about — a key constant (MOLEMA_MOTSWI), the character it types ('x'), or the physical key name ('KeyX'). |
Examples
Section titled “Examples”diri x = 200;
diri y = 130;
tiro setaLoeto() {
thalaKanefase(400, 260);
tlhalosa('Sediko se se serolwana se se tsamaisiwang mo kanefaseng ka ditaetsi tsa metswi. Tobetsa setshwantsho pele.');
}
tiro tshwantsha() {
bokamorago(28, 32, 42);
fa (taetsiETshwerwe(MOLEMA_MOTSWI)) { x = x - 3; }
fa (taetsiETshwerwe(MOJA_MOTSWI)) { x = x + 3; }
fa (taetsiETshwerwe(GODIMO_MOTSWI)) { y = y - 3; }
fa (taetsiETshwerwe(TLASE_MOTSWI)) { y = y + 3; }
x = thibela(x, 20, 380);
y = thibela(y, 20, 240);
tlogelaMothalo();
tlatsaMmala(245, 205, 90);
thalaSediko(x, y, 40);
tlatsaMmala(120);
bogoloJwaMokwalo(14);
rulaganyaMokwalo(BOGARE);
thalaMokwalo('Tobetsa setshwantsho, mme o dirise metswi', 200, 245);
}tiro setaLoeto() {
thalaKanefase(400, 200);
tlhalosa('Mokwalo o o bonalang fela fa metswi a mabedi a tshwerwe mmogo. Tobetsa setshwantsho pele.');
}
tiro tshwantsha() {
bokamorago(238);
tlatsaMmala(40, 60, 90);
bogoloJwaMokwalo(18);
rulaganyaMokwalo(BOGARE);
fa (taetsiETshwerwe(MOLEMA_MOTSWI) && taetsiETshwerwe(GODIMO_MOTSWI)) {
thalaMokwalo('Godimo-molema!', 200, 100);
} gongwe {
thalaMokwalo('Tshwara MOLEMA le GODIMO mmogo', 200, 100);
}
}See also
Section titled “See also”taetsiNngweETshwerwe, konopoETshwerwe, MOLEMA_MOTSWI, MOJA_MOTSWI, GODIMO_MOTSWI, TLASE_MOTSWI