How do I subtract one of the texts from a global variable?

0 favourites
  • 10 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • I am having 25 different sprites, and none of them have instances. I don't have any repeating object at all. My game consists of touching different buttons, which also don't have instances, and each button brings it's sprite in the window, all in the same position. What actions should I add to the event sheet in order to write down only the sprites that where placed in the window? With a button click , after all needed sprites are inside the window, I want a text to be created in a string and write down in it the names of these sprites. Than I do with the string what I need.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this.

    I think this is what you want.

  • that worked! my great thanks to you, spongehammer!

    and two last things. what is the command to erase a name from the global string? in case the sprite is sent back out of the window. and how do I add space or comma between names or even better - how to I make each name written in a new row?

  • Check the updated capx.

    This shows you how to add a comma and a new line.

    If you want to remove the last sprite name from the list you could copy the global variable to a temp variable, add the next sprite name, then if you need to remove the last name just copy the temp back to the global variable. Essentially make sure the temp variable is always one name behind the global variable.

  • to make c2 create each a time a temp copy of the global, when a new name is added , is easier than to add a command to the action which removes the sprite off the window?

    this is an event which makes the sprite appear and disappear from the window area. which command may I add to the first action in order to remove the name from the text?

    first action makes it stay out, second makes it be placed in a specific position inside the playing window.

  • here is the modified capx to make a better understanding. what action I add for the Is on Screen condition , for the text name to be erased? I don't believe there is no such function to delete texts from globals!

  • Subtract wouldn't be a way? But I am looking for ways to set it there

  • why this doesn't erase the name from the variable??

  • Using a 1D array would be way more easier. You can push and pop as needed then save the Array to the variable. So then it can be deleted in whatever order it needs to be deleted.

    I use a function to refresh list only when there has been something changed versus every tick.

    FYI Subtract is for integers not strings

  • As I said, you are the HERO of the day, Phoenix!

    Thank you very very very much!

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