How do I create a virtual pet menu/UI?

0 favourites
  • 13 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • So for my first project, I'm trying to create a simple virtual pet that looks and functions almost exactly like a Tamagotchi. However, I quickly hit a wall when attempting to create menus/menu options for it. I want a type of UI that has the options appear and disappear when a button is pressed, so I figured toggling visibility should do the job. But that only ends up with every menu option visible/invisible when the button is pressed. Is there a way to have a system where only one option is visible at a time?

    Tagged:

  • You can set an ID for the button and menu option.

    When you pressed button, compare the ID and show the menu option that have the same ID with the button only.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sounds like that could work, but how can I do that exactly? By ID do you mean like the UID that the sprite has?

  • You add instance variable called ID(or anything you like) for your option and button.

    When clicked, call the option that have ID equal with button.

  • You add instance variable called ID(or anything you like) for your option and button.

    When clicked, call the option that have ID equal with button.

    Is it possible to assign an Instance Variable to a keyboard key? Also what action would calling the option be? I'm sorry for asking all these questions, I'm new to making games in general and I really want to learn all of this stuff before going onto a bigger project.

  • Yeah, don't hesitate to ask question.

    I will try my best to share my experience.

    Of course you can set the value of Instance Variable by your keyboard.

    Example:

    On Pressed A => Set variable to 999

    OR you can call the option that have the variable ID = 999.

  • Yeah, don't hesitate to ask question.

    I will try my best to share my experience.

    Of course you can set the value of Instance Variable by your keyboard.

    Example:

    On Pressed A => Set variable to 999

    OR you can call the option that have the variable ID = 999.

    Okay so if I'm reading this right, the events would have to be

    Keyboard => On Key Pressed => System => Set ID to 1

    (sub event)System => ID = 1 => Set Sprite1 visible

    Correct? Or am I missing something here?

  • You can Pick by comparison

    Pick Sprite with Sprite.ID = ID => Sprite Visible

    I suggest you put all sprites in a family with ID as family instance variable:

    e.g.:

  • You can Pick by comparison

    Pick Sprite with Sprite.ID = ID => Sprite Visible

    I suggest you put all sprites in a family with ID as family instance variable:

    e.g.:

    Okay, so I put in:

    Keyboard => On Key Pressed => System => Add 1 to Global Number

    (sub-event) System => Pick Family1 where Family1.ID = Global Number => Family1 => Set Visibility (Visible)

    And while this works in bringing the menu options one at a time, the other options are still visible when I move on to the next option. Also, one of the things I wanted to do with this is to have the options loop around like a regular tamagotchi, but once all the options are visible on screen, they just stay that way. Is there a way to fix all of this?

  • You can pick the family that have ID not equal the global is invisible.

    I made a demo, is this what you need?

    menu-loop.netlify.app

    Move around with arrow keys.

  • You can pick the family that have ID not equal the global is invisible.

    I made a demo, is this what you need?

    https://menu-loop.netlify.app/

    Move around with arrow keys.

    Yes, it is. But I think I found a way to pull it off after experimenting a bit. So what I did was:

    Keyboard => On Key Pressed => System => Add 1 to Global Number

    (Sub-Event)System => Pick Family1 where Global Number = Family1.ID => Family1 => Set Visibility(visible)

    (Sub-Event)System => For Each Family1 + FamilyID < Global Number => Family1 => Set Visibility(invisible)

    (Sub-Event)System => MenuSelection = 4 => System => Set Global Number to 0

    It seems to work after testing it out, but is it alright if you showed how you did the demo for the sake of comparison?

  • This is my source:

    drive.google.com/file/d/19S09tbLhVdJShCaQEyBZQff2Y373Qwuy/view

    Let me know if there is any problem :)

  • This is my source:

    https://drive.google.com/file/d/19S09tbLhVdJShCaQEyBZQff2Y373Qwuy/view?usp=drivesdk

    Let me know if there is any problem :)

    Thanks for this, it's pretty neat. I wasn't even aware that this program had else conditions, I'll have to incorporate those.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)