Remember those little programs which were called “desktop mascots”?
They appeared as small animated images of characters, doing not much, but standing/sitting there to keep you company. They weren’t traditional virtual pets, as they don’t need direct care.
Has anyone thought of (or has already done) this concept in PICO8? It could be like the classic Neko software, as said character could move around the screen randomly on its own or by the user’s input.
Just found out that the “goto” function is actually implemented in Picotron; I’ve tested a pico8 code snippet by @ultrabrite and put it into the usual function _draw()
function _draw() cls() x=1 y=0 n=120 ::io:: d=rnd(2)>1 and 0 or 5 line(x+5-d,y,x+d,y+5,11) x+=6 if(x>n+6) x=1 y+=6 print(' ') if(y>n) y=n flip() goto io end |
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 |
Is there a way for a keyboard entry when I need an integer from the user?
Especially for this:
https://www.lexaloffle.com/bbs/?tid=141477
On the line of
local playerHand = drawCards(5,cardDeck) |
to which 5 can be modified…
btw can the F keys be overridden to a specific integer? (ie. pressing F12 for an integer of 12)
based on the tutorial from here https://docs.coronalabs.com/tutorial/data/shuffleTable/index.html
local cardDeck = {"AS","AH","2S","3S","KH","QD","QS","KD","4D","10H"} math.random(flr(rnd())) local function shuffleTable(t) if (type(t) ~= "table") then print("warning") return false end local j for i = #t, 2, -1 do j = math.random(i) t[i], t[j] = t[j], t[i] end return t end cardDeck = shuffleTable(cardDeck) local currentIndex = 1 local function drawCards(num,deck) local cardsDrawn = {} for i = currentIndex, num do cardsDrawn[#cardsDrawn+1] = deck [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=145857#p) |