coolsword16's Forum Posts

  • 13 posts
  • > I'm sorry, I've been trying to figure this out but I'm a bit lost here. How do I make "cur_anim" into a local value? I can't seem to find it anywhere.

    When you save to Local Storage, you can set that key name to call it back when load the game.

    So is it as simple as Local Storage > Key = "cur_anim"? Or am I missing the point here?

  • My "cur_anim" is a key of Local Value not Global variable so please check on your side again.

    I'm sorry, I've been trying to figure this out but I'm a bit lost here. How do I make "cur_anim" into a local value? I can't seem to find it anywhere.

  • You can do similar like this:

    So I tried something based of of this, but nothing I try seem to work. Every time I switch between layouts and back to the one the sprite is on, I'm getting same result as before. Here's the current code so far:

    Global String: cur_anim =

    System > On start of Layout > LocalStorage > Check Item "cur_anim" exists

    Local Storage > On Item "cur_anim" exists > Get Item "cur_anim"

    Local Storage > On Item "cur_anim" missing > Sprite > Stop animation

    Local Storage > On Item "cur_anim" get > Sprite > Set animation to LocalStorage.Item Value (play from beginning)

    Sprite > is "NewAnimation" playing > set item "cur_anim" to Sprite.AnimationName

    Is there anything I' doing wrong here?

  • You can save your current Animation into Local Storage.

    Then you can load it back when starting the game.

    Can you elaborate on this? Like what would the process for this be?

  • You could make a str variable called "CurrentAnim".

    On Layout End > Set "CurrentAnim" to "PlayerSprite.AnimationName"

    (this stores the name of the current animation as a str variable when you leave a layout)

    On Layout Start > PlayerSprite Set Animation > CurrentAnim

    (this will take your str variable, and set your player's sprite to the previously stored animation)

    Hope that helps.

    Does the str variable have to be constant or no? Also should I just set the Initial Value to 0, or just not add anything there?

  • The project I'm currently working on requires a sprite to change into different animations over time, but whenever I switch to a different layout and back to the layout the sprite is on, it goes back to the default animation. Is there a way to save whatever the current animation is between layouts? Also is there a way to save this even after closing the program?

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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?

  • 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 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.

  • Sounds like that could work, but how can I do that exactly? By ID do you mean like the UID that the sprite has?

  • 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:

  • 13 posts