How to make a Main Menu - 2 - Pico 8

Поделиться
HTML-код
  • Опубликовано: 6 янв 2025
  • Follow along with this video on how to build efficient game states such as a main menu, multiple levels, gameover, and title screens!
    ▼ Code Explained at: ▼
    NerdyTeachers....
    ____________________________________________
    This video is about how to improve your state machine in your PICO-8 game, with explanations about the setup, and a working example of a main menu that starts before the actual game scene.
    ▼ View the intro to Game States at: ▼
    NerdyTeachers....
    What is on the Nerdy Teachers Website?
    NerdyTeachers.com grows alongside this channel with in-depth content, helpful resources, and a growing community of support for students and teachers. Each video has a matching tutorial in text, for those of you who want to read more detailed instructions.
    _____________________________________
    ▼ Join the Nerdy Community at: ▼
    NerdyTeachers....
    ▼ Find us on Social Media ▼
    TWITTER = @NerdyTeachers
    FACEBOOK = / nerdyteachers
    _____________________________________________
    Why learn Lua?
    Lua is a fantastic language to learn because it is so readable. Many languages take a lot of time just to memorize what all their symbols mean, but Lua uses natural words instead. So reading Lua code pretty much describes exactly what the code is doing! That is so important for beginners because it skips all the headache and frustration of tackling complex jargon, and gets you quickly into creating! And that's where the fun is!
    Why PICO-8?
    This Fantasy Console has it all! Literally, everything you need is in one place. Coding, Drawing, Maps, Sound FX, and Music are all in a single program! If you've ever tried making games before, then you know how amazing that is! Just like Lua, it also cuts out the complexity so we can get straight to creating. PICO-8 also has a lot of limitations, and that sounds bad, right? NO WAY! These limitations actually fuel your creativity because you don't have to worry about endless possibilities and tire yourself out just thinking about all of the decisions in front of you. The limits also encourage you to move on! Too many people get stuck focused only on their first coding project and this really slows down learning. Learning to code well is all about overcoming a wide variety of projects, and PICO-8 almost forces us to create many small projects instead of a single never-ending one. PICO-8 is perfect for learning code and having fun doing it!
    _____________________________________
    ▼ PICO-8 - Fantasy Console ▼
    www.lexaloffle...
    _____________________________________
    -----------
    Music - "8 Bit Grow!" by HeatleyBros
    -----------
    iTunes : goo.gl/M3b16f
    Spotify: goo.gl/5SbVuk
    License: goo.gl/jadB5E
    Twitter: goo.gl/fKqyrj
    Facebook: goo.gl/PrsTvS
    ----------

Комментарии • 32

  • @FilipeDeschamps
    @FilipeDeschamps 4 года назад +3

    Yay!!!! You’re back! 😍 very nice concepts again!!!

    • @NerdyTeachers
      @NerdyTeachers  4 года назад +1

      Felipe! Good to see you still with us! Thank you very much for the support 🤓🙏

  • @jakegibson5005
    @jakegibson5005 4 года назад +2

    Fantastic tutorial! I didn't know Lua could do this.

  • @atticusfinn8310
    @atticusfinn8310 4 года назад +2

    Looking forward to more Pico 8 videos, they've been really helpful in getting started!

  • @mutee333
    @mutee333 4 года назад +1

    Lovely to see a new Nerdy Teachers video.

  • @toimun
    @toimun 4 года назад +1

    You are back! You guys help me always so much!

    • @NerdyTeachers
      @NerdyTeachers  4 года назад

      Aww so glad to hear that! Thanks for sticking with us!

  • @CoNfUzLeDaNdLoSt
    @CoNfUzLeDaNdLoSt Год назад

    Something important to note, if you have your gamestate functions like UPDATE_MENU() in different tabs AFTER the main _INIT, _UPDATE, and _DRAW functions, you cannot use this method. The parameterized functions being passed to the main functions using the equality operator don't seem to be initialized at compile time since Lua is an interpreted language it goes line by line.

    • @NerdyTeachers
      @NerdyTeachers  Год назад

      Yes that is true, but only if you try to initialize the game state outside of any function. The separate tabs don't actually matter either.
      PICO-8 will read the entire code once, recognizing all function names and running any code that is outside of any function first. Then it will run _INIT, then _UPDATE, then _DRAW. So you could have a custom function at the very end of your code and still use that inside of your _INIT function.
      But what you are talking about is true if you try to call a custom function before the function has been read that first time, because you are calling it outside of any function, then it will error.
      So just make sure to keep your game state changes inside of functions and you can write the functions on any tab and in any order you'd like.

  • @slimandrici419
    @slimandrici419 4 года назад +1

    Great video, i hope you'll do one regarding levels :)))

    • @NerdyTeachers
      @NerdyTeachers  4 года назад +2

      Thanks! Hmm well levels could be done the same way, each level being a different state, or at least having a different init state to change the game variables or where the camera is positioned. Really depends on the game, so yeah we could make an example video at least. Good idea!

  • @OuterCraft
    @OuterCraft 3 года назад

    Really great video!

  • @widearchshark3981
    @widearchshark3981 2 года назад

    This is a nice approach.
    I have a bunch of state tables, each with their own "update" and "draw" functions, and variable that points to the "current state" table.
    Then I just call "current_state:update() and current_state:draw()".
    But I wonder if this is a better approach .... Hmmm...

    • @NerdyTeachers
      @NerdyTeachers  2 года назад +1

      That's a good approach for OOP and if it helps you keep things organized then it may be better for you anyway but OOP is token heavy, so the approach shown in the video will definitely save you tokens in the long run.

  • @bgelais
    @bgelais 4 года назад +1

    I'll use that in practice! :) thanks

    • @NerdyTeachers
      @NerdyTeachers  4 года назад

      Awesome! Good to see you again.
      We like to set up the changing of the _update and _draw "variables" in custom init functions like this:
      Function init_game()
      _update = update_game
      _draw = draw_game
      End
      State-specific variables can go there too, then when you want to change the game state its easier to call the single function: init_game()
      Setting it up like that is what we will demonstrate in the next video!

  • @jnkmal9519
    @jnkmal9519 2 года назад +1

    SWEET! didn't know you could do this. now I need to go back and rewrite all me shit! THANKS!

  • @instyxx
    @instyxx 4 года назад +1

    Yeah! Welcome back! Everything is OK for you?

    • @NerdyTeachers
      @NerdyTeachers  4 года назад +1

      Doing well over here, thanks for asking! Good to hear from you again. Hope you and your family are staying healthy.
      Following doctors orders:
      "Stay safe, stay home, play Pico-8." lol at least that's what I heard them say.

  • @eboatwright_
    @eboatwright_ 4 года назад

    Thank you so much for this tutorial also! Subscribed! :D

  • @marioguy667
    @marioguy667 3 года назад

    Make sure you make the same tutorials, But on the web version if it's released!

  • @chaseniwa7971
    @chaseniwa7971 4 года назад

    welcome back

    • @NerdyTeachers
      @NerdyTeachers  4 года назад

      Thank you! Good to see you're still with us!

  • @bernard6552
    @bernard6552 4 года назад

    Hello where do you start to learn?

    • @NerdyTeachers
      @NerdyTeachers  4 года назад

      Hi! We are still planning to do a series on the very first steps to learning how to code in Pico-8. But there are a lot of resources already out there. We made several suggestions for where to start on this page:
      NerdyTeachers.com/Explain/Pico-8/

    • @bernard6552
      @bernard6552 4 года назад +1

      ​@@NerdyTeachers Thank you but what's the first tuto to do? Can you make a video explaining how to distribute a Pico8 game? Thank you very much.

    • @NerdyTeachers
      @NerdyTeachers  4 года назад

      @@bernard6552 My tutorials can be done in any order, but they assume you know a little of the basics already. Fruit Drop is a good one to start with. But this site is a full collection of PICO-8 resources from beginner to advance:
      www.pico-ate.com/
      This one is a good write-up on intro to programming with PICO-8:
      www.infinitelimit.net/article/programming-with-pico-8-first-steps
      I can start with a write-up on distributing a PICO-8 game, but a video will have to go on the long to-do list sorry.
      Have you looked around the PICO-8 forum (BBS) yet?
      www.lexaloffle.com/bbs/?cat=7
      You can distribute your cartridge there as well so anyone with PICO-8 can find it on Splore.

    • @bernard6552
      @bernard6552 4 года назад

      @@NerdyTeachers Can you make a video explaining how to distribute a Pico8 game? Thank you very much.

  • @qurez3590
    @qurez3590 3 года назад

    i copy the video and didn’t work for me

    • @NerdyTeachers
      @NerdyTeachers  3 года назад

      Try to compare your code with the full code in our website help page to see if you can spot the difference. The link is in the description.
      If you see the difference but don't understand why its not working, let us know.