(v17 07-26-22)
TO LOAD THIS PICO-8 CART, in immediate mode, type:
load #virtdeckcard
VVhat's new ?
07-26-22
- Where do I begin ?
-
Overhauled entire engine.
-
New Dialog Window. When flashing "?" appears, use LEFT and RIGHT arrows to select choices followed by the π ΎοΈ key.
-
Select Quick LOAD/SAVE state to remember your work between reset. Select from menu "Configuration" to automate so your work is saved every time.
- You can now work on a new set of cards without affecting internal memory, SRAM, or the virtual HD (not yet in use).
-
Added 7x7 pixel-image suits to show when you have the cursor over a face-up card on the table.
- New Menu option, save to clipboard. Both deck of cards and table are saved to a normal clipboard entry. Press CTRL+V inside Notepad or web page to save the contents. Any clip created when saving to clipboard are guaranteed <280 characters so they can always be published in TWITTER if you like.
- New Menu option, load from clipboard, both deck of cards and table are replaced by earlier saved clipboard entry. Either select from menu or press CTRL+V during operation of engine.
Here, try it out, copy and paste these examples to see how they appear. Triple-click the field and press CTRL+C to copy it to the clipboard. Then in my engine either select PASTE FROM CLIPBOARD from the menu or just press CTRL+V in the engine.
52-cards already pulled and face-up. Reloading this clip will reveal the same cards each time.
ctable=$zzzzzzzzzz.H%zz%z.I1.L1.I%zz%z.R1z1.R%zz%z.HyIQ7GvUZ+ROWJLBTX08KEjwsFq6tN2Cg4VcSAdrpbiol3HxPDekh
52-grid boxes. Select from menu, "Place face-up cards in boxes." to pull and reveal all the cards. Reload this clip again for new cards each time.
ctable=.H%zz%z.R1.z1.711zz11.d1.z1.l!Q
The start to my "CAVERNS" game. See below. Select "Place face-up" from menu to reveal.
ctable=.m!F
5-Card Stud for 4-players, friends, or you control. You are at the bottom starting with 5 coins. Reveal and replace each card and coin as you go. Reload this clip again for new cards each time.
ctable=.G?L.21.Ia.0aa.0aa1.t1aa.0aa.0a.I1.2?L.o%GY
- Hold π ΎοΈ and arrow keys to create a trail of grid boxes in that direction.
- Hold β and π ΎοΈ together to quick pull a card from the deck and flip it over in cursor position. Continue holding and press arrow key to create a trail of turned over cards in that direction.
- Saving any face-down cards via SRAM or clipboard will now reveal new values based on the existing deck of cards when turned face-up. This is useful so you can save the beginning of a game and guarantee random cards pulled up each time.
- Select new MENU with PAUSE key, usually "P". Hold PAUSE key "P" for true Pico-8 menu.
- Menu option, convert all grid boxes to face-up cards using existing directory of cards.
- Menu option, scramble all face-up cards, this does not swap but intelligently replaces every face-up card on the table.
- Press π ΎοΈ on a face-up card to move or swap it with another face-up or face-down card, you can swap all cards if you so choose. Press π ΎοΈ again on an empty square or grid box to drop the card you are carrying, record the new table, and exit lift mode.
- Press β when in swap mode to exit lift mode and recover every swapped card to their original position.
- Press β on a face-up card to make the "?" appear. Press π ΎοΈ from here to remove that card from the table and place it in the discard where it can no longer be accessed until you reset the table. To abort "?" press any other key.
- Press β on an empty square to add a gold coin. Hold it down and press arrow key to create a trail of gold coins. Use these as markers, counters, points, or reference.
- Press β on a gold coin to flip a single 2-sided coin reveal at bottom-left and roll a single 6-sided die reveal at bottom-right.
- Press β again from here to add another coin and total add another die and total. You can have 6-in all before they reset.
-
Press π ΎοΈ on a gold coin to remove it from the table.
- Planned, Load and save to internal file. There will be 72-file slots to work with including 17-character names for each and ability to move, copy, rename, and delete them. A virtual hard-drive. Internal keyboard is provided so total access can still be by joystick.
06-16-22
-
Changed position of descriptions and card information.
-
Added single menu option to cover all previous menu options. Choose "custom cart menu" from menu to activate.
-
Fixed menu not to appear until table and cards are ready.
-
Added quick load + save state to table. now you can flip cards + change the table and then undo it all by quick loading your last saved state.
-
Added info to show if table has not yet been saved. If changes are to be saved, "S?" will appear in the bottom-right-hand corner of the screen.
-
Added to custom menu option ability to auto-save table for every move. Select last gear icon in custom menu selection. It will appear in the top-right-hand corner of the table to show activation.
-
Added place a face-up card option on every existing grid box on the table.
- Next update will include load and save table to clipboard. Will include header + standard 6-bit compressed data.
06-14-22
- Menu option to correctly shuffle every face-up card. Does not do swap. instead it takes every face-up card on the table and places them in a stack. Then takes each card randomly from that stack and builds a new stack. That new stack is then put back on the table in the exact same place that the original cards were pulled.
06-12-22
- Records every session automatically now. Exit any time and restart to recover all work.
06-07-22
-
Wrote full and new joystick driver. Arrow keys are staggered, π ΎοΈ requires multiple presses now, and β only registers a single stroke when released, not pressed.
-
With new joystick driver, you can combine β and π ΎοΈ together to pull a card and place it face up on the cursor without added keystrokes.
-
You can also hold down any button or combination of π ΎοΈ or β and π ΎοΈ together and then press arrow keys to auto-generate fields for those positions the cursor touches. This is a quick way to generate grids and face-up cards.
-
Auto-save to current layout is planned.
-
Load and Save to internal memory is planned. 32-slots will be available. This also works online.
- Load and Save to clipboard is planned.
A FEW IMPORTANT NOTES:
If you activate auto-save every move it is instantaneous. You do not need to worry about the system slowing down even remotely for saving your work every move. This ability was automatic in the previous release, now you can choose whether to have it on or not through configuration menu.
06-02-22
-
Fixed moving card. Was not working properly for undo.
- Coded so both the values of coins and dice can be added up.
06-01-22
- Added new Grid Box to help you keep track of card positions even if there is no card there.
05-31-22
-
reissued color palette set.
-
Changed suit colors so they are easier to see. Thank you Lucky Charms cereal ! :)
-
You now have black spades, green clubs, red hearts, and blue diamonds.
-
Removed scrolling cards in favor of lifting and repositioning each card.
-
Added rolling a single die and flipping a coin ability. See below.
- Added version number to appear at boot.
Here is a game I made up called, "Caverns."
You place a single card face up in the center. You place another card. If it is minus 1 value or plus one value of the horizontal line center, then you lift that card up and place it next to the matching card vertically. The end result of the table will look like stalactites and stalagmites with all cards matched.
This program is a complete virtual green velvet table with a deck of cards, 52-in all, 6 pennies, and 6 dice. You can have 13 cards across by 11 cards down. You can lay down grid boxes to help you align where to place your cards. They can be face down or face up and can even be repositioned to another place on the table.
These cards can also be turned back over hiding their contents or discarded allowing you to pull new ones from the deck if you so desire.
It uses the arrow keys for navigation and the 2-standard joystick buttons of π ΎοΈ and β to add and remove cards to the table.
The π ΎοΈ and β also react in a special way depending upon whether the card it is on exists or not and if it is turned over or not. See below.
In running the cart, the deck of 52-cards will be shuffled. This shuffle method uses 2-different arrays and pulls a random card from the 1st pile to add it to the 2nd pile until all cards from the 1st pile are exhausted. This ensures a shuffling of the cards that is truly random.
After the shuffle the main screen will appear and there will be 3-values that appear at the bottom.
These are DECK
to show how many cards remain in the deck. To start with there are 52 (I am not using Jokers).
The next item is PLAY
to show how many cards are in play on the table above. This could be useful for counting score for your custom card games where the object is to remove matched cards from any method you develop.
The last item is DISC
which keeps track of every card you have discarded and put in the EMPTY pile. This could also be used for scoring. Any cards that have been discard cannot be retrieved later - and if you use up all 52-cards, you cannot draw any new cards and must use what is on the table - or start over.
So if you have pulled or discarded each of the 52-cards, then you can select from the menu and choose RESET CART
or press CTRL+R on your keyboard to start over with a fresh set of 52-shuffled cards and a clean table.
Both the π ΎοΈ and the β keys have unique properties. See below.
Press π ΎοΈ on an empty square to add a grid box to the table. This does not count as a card and you can have as many as you would like on the table.
If you press π ΎοΈ on a grid box, a card will be pulled from the deck, face down, and replace the grid box.
If you press π ΎοΈ on a card that is face down, it will be turned over so you can see its contents.
If you press π ΎοΈ on a card that is face up, it is lifted and the cursor changes. Then you can use π ΎοΈ to reposition this card to an empty space or directly on top of another card to replace it thereby discarding of the one beneath.
If you press β when you are in lifted mode, the mode will be canceled and the card you lifted along with the cursor will be returned from where you originally picked it up, still face up.
If you press β on a card that is face up, it will be turned over hiding its contents.
If you press β on a card that is face down, it will be discarded leaving a grid box here.
If you press β on a grid box, the grid box will be removed leaving a blank space.
If you press β on a blank space, two special items will occur. A coin will be flipped showing HEADS or TAILS in the top-left-hand corner and a single die will be rolled showing a value from 1-6 in the top-right-hand corner.
If you press β AGAIN a new flipped coin will be added and a new die will be rolled. The totals will change. You can have up to 6 of these before the values reset.
To discard the coins and the dice merely move the cursor away one step.
If you cannot tell what a card is, position the cursor directly on it and an exact description of that card will appear in the text frame above.
What games can you think up with this engine ?
And that's it ! If you have any questions or suggestions, please let me know in the comments below.
Enjoi !
Please see below for earlier versions and descriptions.
(v00 05-30-22)
TO LOAD THIS PICO-8 CART, in immediate mode, type:
load #virtdeckcard-0
I think we all write programs from one time to another not necessarily because we want to write a game for others to play or even something others can use in their own code - but for perfectly selfish reasons because we cannot find what we want written by other people.
I have examined no less than 20 card-flipping programs for my Android tablet and none do even close to what I wanted.
And as the term goes, "If you want something done right, do it yourself." so have I done so.
This is a bit more elaborate than a simple program that pulls a single card out of the deck to show it filling the full screen which is what most of them did.
If you press π ΎοΈ on a card that is face up, it and all cards to the right of it will be moved one tile across to the right. Any card at the extreme right can and will be discarded if it is there.
If you press β on a square that has no card, all the cards to the right of this square will be moved one tile across to the left.
If you are enjoying this cart, please let me know as you can see it represents a fair amount of work ... :)
Thanks !
I think I'm going to make some changes here ...
How about this ?
You use π ΎοΈ on a face-up card to pick it up and use arrow keys to put it in a new place.
If you press π ΎοΈ again it is moved to that new location.
If instead you press β it will be returned from where you lifted it.
Also β on an empty square does nothing. I don't think shifting the cards left and right will be needed since you will have the ability to lift and move cards now, not just left and right, but up and down or even to a new location entirely.
Let me work on this ...
seems like a nice little tool! the two main things that seem missing to me are mouse support and the ability to shuffle discarded cards. I agree with your ideas for changing O and X.
I think the sprite for the 10 card is a bit hard to see -- there's not enough contrast between color 5 and the background
Hi @pancelor:
Thank you ! Mouse support ? Alright, I can add that.
I'm just about to put out the new release. Has all kinds of neat new things in it. Let me see the 10 ... Yeah, I know one person maintained 3x5 font and used the letter "T" for ten but I was hoping to really get that double-digit 10 in there.
Maybe I should use T after all. The new version has a whole new color scheme based on Lucky Charms cereal (I kid you not) and a whole bunch of new bonus items. Let me put out that new version first, @pancelor, and see what you'd like me to change in there.
I want this to be good for everyone.
Hi @pancelor:
A bit about why I'm not using the mouse.
The mouse on a computer is not at all like touching the screen on a tablet. On a computer you can move the cursor where you like, seeing the cursor, and having the ability to press either the LEFT or RIGHT button or even rotating the mouse scroll button.
On a touchscreen tablet you cannot have a cursor displayed as it can only register one thing. When you touch it where you touch it. And that's it. Essentially a single button with no option to do a right-click.
I can add mouse ability but understand this will JUST be for people who have a mouse. It will in no way benefit anyone with a touch-screen.
This program I wrote needs to have a cursor so you can see where you are placing your card - and to have an β button to remove that card.
I may write something that is good for touch-screen, but that would be a separate program entirely.
. . .
As for the discarding, I could add each discarded card to the bottom of the active deck. You would never run out of cards this way. I'm not sure how else to do it.
I think you could get a lot of mileage by leaning into the physical-simulation aspect of this. I'm drawing some inspiration from Tabletop Simulator here:
- a Cardstack may have 0, 1, or many Cards in it
- every Gridcell holds a Cardstack
- there is a Cursor that moves with the mouse, arrow keys, or touchpad. It also holds a Cardstack
- the game/simulation starts with a mostly empty grid, except for a single cell holding a stack of 52 cards
when the Cursor is empty:
- if you tap on a cell, the Cursor picks up the top card off of the stack in that cell
- if you double-tap on a cell with cards, the Cursor picks up the stack from that cell
- if you double-tap on a cell without cards, a menu comes up that lets you choose something to spawn (dice, a new stack of cards, coins)
when the Cursor has cards:
- once you release your finger, the entire stack in the Cursor drops into the current cell (merging with the stack below)
- if you dropped the stack immediately without moving the cursor, it flips the cards in the stack over so that they're visible now (so, a quick tap will flip a stack of cards)
This assumes you're using a touchscreen, but these controls should work for keyboard/mouse users:
- keyboard: x = "tap". additionally, z can be used for "double-tap" (instead of double-pressing x)
- mouse: poke(0x5f2d,3) to map LMB to X and RMB to Z
The one question with this system is how to shuffle a stack of cards. maybe by dragging your mouse/finger quickly around, like in Tabletop Simulator? maybe an option in the pause menu? maybe a triple-tap?
some more concrete thoughts on the current build: (#virtdeckcard-6)
- the Grid Boxes seem a bit annoying to have to place one every time you want to place a card. I'm not sure how to fix that
- the new 10 is interesting! if it were me I think I would do it like this: (including some ideas from my post above, but also it has some 10s in it)
Hmm ! You are really getting busy in this, @pancelor.
I am looking at your mockup. That's quite complex there. So in this you can have more than one stack of cards ?
This might be useful if you could shuffle a deck and then create piles that only contain specific cards say using a filter so you could have one pile that contains only the 4-aces shuffled, etc.
I don't know if I'm going to go this route. Now I could do this in Blitz but I'm more interested once again in writing in Pico-8.
Now I could do THIS and work with menus. I found a way to use menus despite using FLIP(). Before you remember you could not create or invoke menus in repeat
/ until
statements.
So let me think.
Here are some ideas for menuitem()
- Enable/disable grid boxes.
- Flip over all cards + markers.
- Shuffle active cards only.
- Load/save/copy/delete board w filename.
- Copy/paste board to clipboard.
haha yeah, I may have gone a bit overboard...
my main design principle here was "could you do this in the real world? then you can do it in this game" / "can you not do this in the real world? then you can't do it in this game". so, to answer your question "you can have more than one stack of cards?": yes
you've got your own vision for this tool; I just wanted to offer my alternate take. feel free to use any parts you like!
They are superb suggestions, @pancelor. I'll definitely enable/disable the grid boxes or find a way to automate them to face down/face up cards. I like them but yeah laying down a bunch of cards with it could be tedious as it takes 3-clicks to get a single face up card.
[Please log in to post a comment]