Log In  

I'm trying to make a simple text-adventure game within the terminal (using the arrow keys as input), but the print() functions for the various options aren't kept permanently on screen.
What am I doing wrong here?

cls(0)

--      left = "80"
--      up = "82"
--      right = "79"
--      down = "81"

print("Press a key:") 
for kp = 79,81 do
    if key(80) and key(kp) then print("left")
    elseif key(81) and key(kp) then print("center")
    elseif key(79) and key(kp) then print("right")    
    end 
end
P#146537 2024-04-13 12:54

1

Is this in your _draw? It looks like the second any key isn't pressed it'll just clear the screen completely with cls(0)

P#146543 2024-04-13 13:53

@crimson2877
Found out that I needed to remove the cls() function and change the key(kp) to keyp(kp) so that there’s no unnecessary duplication of the print() functions

P#146544 2024-04-13 14:22
1

@WidgetOtaku glad u figured it out! excited for a lil text adventure on here

P#146547 2024-04-13 16:10

[Please log in to post a comment]