Log In  

Cart #29266 | 2016-09-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

Another very basic demo of a menu and managing various gamestates.
There are better ways to do it (like an int instead of strings) but this is the most verbose and easy to read.

Even if you know how to do this basic little thing, its handy having copy-paste code material on hand...

P#29267 2016-09-24 11:27 ( Edited 2016-09-30 18:56)

update the menus to r g b , not r b g

P#29503 2016-09-27 14:06 ( Edited 2016-09-27 18:06)

But what if Red is the rising of the sun, Blue is the sleep still in your eyes, and Green is the path you walk when you're awake ?

P#29504 2016-09-27 14:28 ( Edited 2016-09-27 18:28)

then green is red, red is green and blue comes first
bgr

P#29520 2016-09-27 17:19 ( Edited 2016-09-27 21:19)

I am he as you are he as you are me and we are all together. :)

https://youtu.be/19sAewJH22I?t=24

P#29542 2016-09-27 22:01 ( Edited 2016-09-28 02:01)

ok but wtf has this have to do with this, its like saying i love siIvagunna in this conversation

P#29564 2016-09-28 02:37 ( Edited 2016-09-28 06:37)
P#29574 2016-09-28 09:34 ( Edited 2016-09-28 13:36)

lolwhat

The menu colours aren't really...based on anything :D They're just placeholder functions.

P#29620 2016-09-28 18:27 ( Edited 2016-09-28 22:27)

I'm just messing, Kq|1n. And don't mind, AlexClarke, I think he is too. :)

You've made a very solid menu here. Here's a challenge if you are up to it though. Make a multi-layer menu, that is:

WORLD
  NAME
  PROPERTIES
TILE
  GLOBAL
  LOCAL
SPRITE
  COPY
  SCRIPT

So, you would initially see 3 menus. Selecting one however brings up another with 2-more items that appear like a folder to the side. Canceling that one step brings you back to the main menu.

P#29623 2016-09-28 18:39 ( Edited 2016-09-28 22:39)

:D

Shouldn't be toooooo bad...
Do you mean so that instead of showing a whole new scene, it just expands a tree kind of thing? That might be kinda cool...

P#29628 2016-09-28 20:41 ( Edited 2016-09-29 00:41)

Yep, you've got it. In S2 I had one menu go 4-levels deep. Hitting [ESC] it would back out of each one very neatly like one piece of paper folded over another.

Here is an example from Tilemaster.

If you look carefully at the top. The primary menu is at 0,0. The next is just a bit below that so you can still see the other menu in the background; but muted.

P#29639 2016-09-28 23:22 ( Edited 2016-09-29 03:22)

Ahh, yeah, okay!

I might actually add those little boxes too and add a calculation to check what the longest string is and make the box the correct size.

I'd like to the make the thing more expandable at some point, once I've done a bit more on my main game.

P#29655 2016-09-29 05:53 ( Edited 2016-09-29 09:53)

NP, and yes, you are right. When I wrote Tilemaster I had to determine the maximum length of the text. This gets even trickier when you add special commands to the string like:

^* (enter/exit frame building mode)
^0-9 & A-z (change to alternative font set)
^# (double-size for next character, usually icon)
^[ (left justify following text)
^| (center justify following text)
^] (right justify following text)

You can go a little crazy at it, KQ|1N, but the advantage is you can use this library of yours for many other great programs.

Want to really mix it up ? Use proportional typeface. Since screens are no longer fixed at 1024x768, I am having to use pixel-fonts to handle any screen-size or dimensions.

P#29695 2016-09-29 23:19 ( Edited 2016-09-30 03:19)

uhh... im getting pico-8 for christmas

P#29734 2016-09-30 11:38 ( Edited 2016-09-30 15:38)

but already do LOVE2D

P#29735 2016-09-30 11:39 ( Edited 2016-09-30 15:39)

number ordered table of tree,
tree of menus,
its like a filesystem and a fileexplorer

P#29736 2016-09-30 11:40 ( Edited 2016-09-30 15:40)

Alex, is there a site where people post Love2D programs and you can try them out immediately - as PICO does ?

P#29742 2016-09-30 14:56 ( Edited 2016-09-30 18:56)

Thanks for this!

P#85591 2020-12-19 17:29

Very helpful for me! Thank you so much for making this!

P#98415 2021-10-09 02:51

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 19:53:41 | 0.014s | Q:37