mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
few bugfixes, added ESC to exit game
This commit is contained in:
parent
f723f9f795
commit
664842e04c
@ -62,6 +62,10 @@ end
|
||||
|
||||
while true do
|
||||
term.clrscr()
|
||||
term.gotoxy( 3, 12 )
|
||||
term.putstr( "eLua hangman" )
|
||||
term.gotoxy( 3, 13 )
|
||||
term.putstr( "ESC to exit" )
|
||||
stats()
|
||||
|
||||
-- Draw the hanging site
|
||||
@ -80,7 +84,10 @@ while true do
|
||||
local tried = {}
|
||||
local key
|
||||
while tries < 7 and nguess < #lword do
|
||||
key = string.char( term.getch( term.WAIT ) ):lower()
|
||||
key = term.getch( term.WAIT )
|
||||
if key == term.KC_ESC then break end
|
||||
if key > 0 and key < 255 then
|
||||
key = string.char( key ):lower()
|
||||
term.gotoxy( 2, h - 1 )
|
||||
term.clreol()
|
||||
if not key:find( '%l' ) then
|
||||
@ -109,6 +116,8 @@ while true do
|
||||
end
|
||||
term.gotoxy( 9, h - 2 )
|
||||
end
|
||||
end
|
||||
if key == term.KC_ESC then break end
|
||||
|
||||
term.gotoxy( 2, h - 1 )
|
||||
total = total + 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user