Skip to main content

KeyPressed

KeyPressed (फ़ंक्शन)​

प्रारूप​

keypressed ( व्यंजक )

बूलियन_व्यंजक या पूर्णांक_व्यंजक लौटाता है

विवरण​

KeyPressed फ़ंक्शन बताता है (सत्य या असत्य) कि कोई कुंजी इस समय दबी है या नहीं, या इस समय दबी कुंजियों की संख्या लौटाता है। कीबोर्ड बफ़र साफ़ करने वाले key फ़ंक्शन के विपरीत, KeyPressed ऐसा नहीं करता। इससे ज़्यादा तेज़ प्रतिक्रिया वाले खेल और कीबोर्ड के दूसरे उपयोग बनाए जा सकते हैं।

आम कुंजी कोडों की सूची के लिए key फ़ंक्शन देखें, या पूरी सूची यहाँ देखें।

उदाहरण​

ar_down=16777237
ar_up=16777235
ar_left=16777234
ar_right=16777236

fastgraphics
x = 150
y = 150
color blue

print "use arrows to move the ball, space to exit"

while not keypressed(32)
if keypressed(ar_down) then y = y + 1
if keypressed(ar_up) then y = y - 1
if keypressed(ar_right) then x = x + 1
if keypressed(ar_left) then x = x - 1
# x और y को 0-300 की सीमा में रखें
x = (x + 300) % 300
y = (y + 300) % 300
# गेंद बनाएँ
clg
circle x,y,10
refresh
end while

यह भी देखें​

Alert, Confirm, Input, Input Float, Input Integer, Input String, Key, Keypressed, Prompt

इतिहास​

1.99.99.26इस संस्करण में नया