Log In  

Cart #cardinal_menu-1 | 2021-02-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

I wanted a nice simple menu system for pico-8 so I decided to recreate an old UI I made ages ago in Flash (my game Red Rogue uses it).

The Cardinal Menu only uses arrow keys to navigate. The menu is made of branches. Each item in a branch points to either a string (providing a description panel), a function in your code, a new branch, or nothing (disabled).

The purpose of this system is to make it as fast as possible to build a menu and add options.

In the demo you can see what each option does and there's a demonstration of an inventory system.

The menu system alone is 712 tokens.

This is about as basic I could make it without adding too much noise to the code, but I welcome suggestions for improvements and optimisations.

Cart #cardinal_menu-2 | 2021-02-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

A quick update...

Let's say you're in a shop and you have 5 gold. A sword is 5 gold and an axe is 10 gold. You want the menu to say the axe option is disabled. So now you can define a menu item that checks if it's disabled - you just point it at a function that gives an answer.

I also added a selection animation for input feedback and trimmed down my math. The menu alone is now 800 tokens but at least it's a round number and easy to build a crafting system with.

P#87982 2021-02-21 20:02 ( Edited 2021-02-22 23:47)


[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-02-28 06:29 | 0.021s | 2097k | Q:45