Last active
March 31, 2017 08:23
-
-
Save dz0/125a79e2f31f426b5190074e316e0c97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void draw(){ | |
| /* | |
| // reik surasti ir pakeisti buvusį užpildo nustatymo kodą: | |
| int alpha = 255 - ligos_poveikis_alphai(i); // 255 yra pilnai spalvotas | |
| if (i==0) fill(250, 250, 0, alpha); | |
| else fill(100, alpha); // uzpildas | |
| // prie info: | |
| text(alpha, X[i], Y[i]+15); | |
| */ | |
| } | |
| int vieta_eileje(int nr) { | |
| for (int k=0; k<eil_n; k++) | |
| if (eile[k]==nr) | |
| return k; | |
| // jei nieko nerado | |
| return -1; | |
| } | |
| int ligos_poveikis_alphai(int nr) { | |
| // surandu, vietą eilėje | |
| int kur = vieta_eileje(nr); | |
| if (kur>=0) { | |
| int kada_uzsikrete = eile_kada[kur]*1000; | |
| int ligos_poveikis = (millis()-kada_uzsikrete)/50; // kas 50 milisekundžių - 1 taškas (per 1s - 20 taškų) | |
| if (ligos_poveikis > 255) ligos_poveikis = 255; | |
| println(kur, ligos_poveikis); | |
| return ligos_poveikis; | |
| } | |
| return 0; // jei neserga | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment