How do I add to sprite's instance variable? (SOLVED!)

0 favourites
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • You are taking a Global variable (Tree_ID) and storing a property called Tree_Sprite.UID into it.

    Tree_Sprite.UID is = to the UID of the selected Tree_Sprite, your Global Tree_UID is = 0 because you never use it.

  • https://easyupload.io/8grb21

    Tree project uploaded

  • The problem is in your Textbox (Step 2)

    Add - In the condition

    Every 1.0 seconds

    *Tree_Sprite Pick instance with UID Tree_ID*

  • You are taking a Global variable (Tree_ID) and storing a property called Tree_Sprite.UID into it.

    Tree_Sprite.UID is = to the UID of the selected Tree_Sprite, your Global Tree_UID is = 0 because you never use it.

    I see it now. So for the 5th step, how would one only add 10 to the instance variable "leaves" for the selected tree? I removed one of the conditions on step 5 since, as you rightfully pointed out, it wasn't applied correctly.

  • Only change from your original code has the arrow

  • Only change from your original code has the arrow

    I'm dumb. Reverting change now and applying change to textbox.

  • Ya so it's the text display you were using to confirm, the actual values look fine.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Huge THANK YOU to winstreak!!! You turned the madness in my confused world into a positive learning experience. Thanks for the patience and persistence!

    lionz, I know you're busy and I appreciate your time confirming we were on the right track.

  • Since I was in there, a few other things you might like to add

    1. Every tick to display text changes is not going to effect your performance. I wouldn't worry too much about using every X instead of every tick for displaying text ever.

    2. Before we change trees we store the UID of the current tree. This way we can remove the highlight automatically

    3. Remove the highlighted tree - only if there was an old UID selected - only if it's not the same tree again

  • Since I was in there, a few other things you might like to add

    1. Every tick to display text changes is not going to effect your performance. I wouldn't worry too much about using every X instead of every tick for displaying text ever.

    2. Before we change trees we store the UID of the current tree. This way we can remove the highlight automatically

    3. Remove the highlighted tree - only if there was an old UID selected - only if it's not the same tree again

    Legendary! Thank you for the optimization and lessons as I'm trying to absorb as much as possible (actually will save/use this as a reference guide for the next time I'm stuck). Taking what I learned here and applying it to my larger project.

    I also subscribed to your YT page as I was hunting for a way to buy you a hot/cold one for all the kindness.

  • Feel free to hop on my discord - you can DM me any time

    discord.gg/NTQxEGH7Na

  • Feel free to hop on my discord - you can DM me any time

    https://discord.gg/NTQxEGH7Na

    I appreciate that and won't wear out the offer.

  • I also subscribed to your YT page as I was hunting for a way to buy you a hot/cold one for all the kindness.

    If you were serious you will be my first ever donator 😛:

    koji.to/winstreak

  • > I also subscribed to your YT page as I was hunting for a way to buy you a hot/cold one for all the kindness.

    If you were serious you will be my first ever donator 😛:

    https://koji.to/winstreak

    Completely serious. That link wasn't working from my office so I used my phone. I didn't see you posted that until I checked this morning, sorry for the delay! Thanks again for your help. I'm hopeful we get to work together again soon.

  • Feel free to hop on my discord - you can DM me any time

    https://discord.gg/NTQxEGH7Na

    Whenever you get a sec, I posted something on your Discord. Thanks.

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