Creating and tracking inventory in GB Studio

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024
  • How can you use an inventory system in your Game Boy game with GB Studio? Here's how to get started!
    #gbstudio #gamedevelopment #gameboy #inventory

ความคิดเห็น • 9

  • @ChunkySteveo
    @ChunkySteveo 2 หลายเดือนก่อน +1

    Very clean and concise explanation!!

  • @darryloliver98
    @darryloliver98 2 หลายเดือนก่อน +1

    Thanks for this, well explained!

    • @codepetersen
      @codepetersen  2 หลายเดือนก่อน +1

      @@darryloliver98 I appreciate you checking out my channel, and leaving feedback! What project are you working on?

    • @darryloliver98
      @darryloliver98 2 หลายเดือนก่อน

      @@codepetersen I have only just started using GBstudio so just getting to grips with how it works. Eventually looking to make an rpg/adventure type game

  • @nixersito190
    @nixersito190 หลายเดือนก่อน +1

    Thanks for the help.
    I have a question: How do I make an item disappear permanently once it's taken? Because when I exit and re-enter, the item respawns. How do I prevent that?

    • @nixersito190
      @nixersito190 หลายเดือนก่อน

      le pregunté a CHAT GPT y me respondió:
      En GB Studio, puedes evitar que un ítem respawnee utilizando un variable o un switch para registrar si el ítem ya fue recogido.
      Aquí tienes los pasos básicos:
      Crear una variable o switch: Ve a "Manage Variables" y crea una nueva variable (por ejemplo, ITEM_RECOGIDO).
      Configurar el ítem: En el evento de "On Interact" del ítem, agrega un comando para verificar si la variable ITEM_RECOGIDO está en 0 (esto significa que el ítem aún no ha sido recogido).
      Actualizar la variable: Si la variable está en 0, procede a ejecutar la acción de recoger el ítem (por ejemplo, dárselo al jugador) y luego establece la variable ITEM_RECOGIDO en 1.
      Evitar el respawn del ítem: En el mismo evento, agrega una condición para que si la variable ITEM_RECOGIDO es 1, el ítem no vuelva a aparecer (puedes eliminar el objeto o evitar la interacción).
      Aquí tienes un ejemplo simplificado:
      On Interact del ítem:
      Condición: Si ITEM_RECOGIDO == 0
      Acción: Dar ítem al jugador
      Acción: Establecer ITEM_RECOGIDO = 1
      Condición: Si ITEM_RECOGIDO == 1
      Acción: Eliminar ítem o hacer nada
      Este método asegura que, una vez que el ítem ha sido recogido, no vuelva a aparecer cuando el jugador regrese a la escena.

    • @codepetersen
      @codepetersen  หลายเดือนก่อน +1

      Thanks for watching, and for the question! The way I do this is I will set a global variable, maybe called gotItem. When I pick up the item, then I set the variable gotItem to true. Then on that level, on the on init tab, I use a compare variable to value event, and choose if gotItem = True, deactivate item. Does that help out? I will make a tutorial specific to that action, that's a really good idea!

    • @nixersito190
      @nixersito190 หลายเดือนก่อน +1

      @@codepetersen YES! I did exactly that last night. I created 4 ITEMS with the same script, but the problem is that when I took 1, all 4 got deleted. It's just a matter of continuing to play and learn. I'm looking forward to your video, thank you very much.
      The solution I can think of now is to create a unique variable for each item, but that would be cumbersome and would take time to set up each item one by one. I was hoping to automate the process...

    • @codepetersen
      @codepetersen  หลายเดือนก่อน

      @@nixersito190 That's how I would do it also, one variable for each item. Best part of this is figuring it out together and sharing ideas!