atametsaTlase
→ floor()Rounds a number down to the whole number below it.
atametsaTlase(palo)atametsaTlase simply drops what comes after the point for numbers above 0:
atametsaTlase(9.97)is 9atametsaTlase(9.03)is 9
Below zero the direction turns, and that is the correct behaviour: “down” means away from 0, so atametsaTlase(-4.2) is -5, not -4.
If what you actually want is to drop the decimals on both sides of zero, palotlalo is the one you want: palotlalo(-4.2) is -4.
atametsaTlase is the one reached for most in Bopa when an uneven number has to become the index of a whole thing — such as choosing an item from a list with paloEpe.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
palo | palo | The number to round down. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(238);
tlogelaMothalo();
paloEpePeo(11);
metlha mebala = [
[220, 80, 60],
[40, 140, 200],
[250, 190, 60],
[90, 180, 120]
];
gopheta (diri i = 0; i < 8; i = i + 1) {
gopheta (diri j = 0; j < 8; j = j + 1) {
// 0..1 go ya go 0..3, e bo e atametswa kwa tlase go nna letshwao
metlha sekao = atametsaTlase(paloEpe() * 4);
metlha mmala = mebala[sekao];
tlatsaMmala(mmala[0], mmala[1], mmala[2]);
thalaKhutlonne(i * 50, j * 50, 50, 50);
}
}
}tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(20, 24, 34);
tlogelaMothalo();
metlha dipalo = [-4.2, -1.5, 1.5, 4.2];
gopheta (diri i = 0; i < 4; i = i + 1) {
metlha p = dipalo[i];
metlha x = 70 + i * 90;
// Kwa tlase — bobududu
tlatsaMmala(80, 150, 230);
thalaSediko(x, 160, 20 + bokgakalaPalo(atametsaTlase(p)) * 8);
// Kwa godimo — bosetlha
tlatsaMmala(240, 170, 90);
thalaSediko(x, 270, 20 + bokgakalaPalo(atametsaGodimo(p)) * 8);
kwala(atametsaTlase(p));
}
}