This shows you the differences between two versions of the page.
— |
ro:keypressed [2020/02/28 10:46] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== KeyPressed (Funcție) ====== | ||
+ | > **Engleză: | ||
+ | ==== Format ==== | ||
+ | **keypressed** ( )\\ | ||
+ | **keypressed** ( // | ||
+ | |||
+ | Întoarce un [[integerexpressions|număr_întreg]] sau o [[booleanexpressions|expresie_booleană]] . | ||
+ | ==== Descriere ==== | ||
+ | Funcția **KeyPressed** verifică dacă tasta cu codul // | ||
+ | |||
+ | Acestă funcție permite crearea de aplicații sau de jocuri performante în care să se utilizeze combinații de taste.\\ | ||
+ | Dacă se dorește să se afle ce cod are o anumită tastă se poate consulta exemplul de pe pagina funcției [[key|Key]] sau se poate consulta [[http:// | ||
+ | ==== Parametri ==== | ||
+ | **// | ||
+ | ==== Exemplu ==== | ||
+ | < | ||
+ | sageata_jos=16777237 | ||
+ | sageata_sus=16777235 | ||
+ | sageata_stanga=16777234 | ||
+ | sageata_dreapta=16777236 | ||
+ | fastgraphics | ||
+ | x = 150 | ||
+ | y = 150 | ||
+ | color blue | ||
+ | print " | ||
+ | while not keypressed(32) | ||
+ | if keypressed(sageata_jos) then y = y + 1 | ||
+ | if keypressed(sageata_sus) then y = y - 1 | ||
+ | if keypressed(sageata_dreapta) then x = x + 1 | ||
+ | if keypressed(sageata_stanga) then x = x - 1 | ||
+ | # păstrează x și y în intervalul 0-300 | ||
+ | x = (x + 300) % 300 | ||
+ | y = (y + 300) % 300 | ||
+ | # desenează bila | ||
+ | clg | ||
+ | | ||
+ | | ||
+ | end while | ||
+ | </ | ||
+ | ==== Vezi și ==== | ||
+ | {{page> | ||
+ | ==== Istoric ==== | ||
+ | |1.99.99.26|Adăugată în acestă versiune| | ||