I don't get these logics:

BasGoodboyBasGoodboy Member, PRO Posts: 310
edited August 2013 in Working with GS (Mac)
Hey all,

My problem is,

I want that, if player click an item, there is stats to be seen.
For example, stats of a dagger will spawn.
image


When player clicks an other item, the previous clicked stats (of the dagger) should be destroyed and the stats of this next item, for example of a sword, will spawn, otherwise the stats will overlap eachother like this:
image

Problem is, I made a boolean named 'destroystats'.

Each stats of each item has a rule with 'if destroystats is true, destroy this item'

Each stat that spawns have a rule, when touch is clicked, set destroystats boolean to true (so that stats that are already displayed will be destroyed)

, problem is then, ofcourse, that the next rule, which spawns the stats of this clicked item, will not spawn cause the boolean is set to true.

So I made this:


when touch is clicked > set destroystats boolean to true > set destroystats boolean to 0 > spawn statsitem

But boolean set to 1, and boolean set to 0 in two rules after eachother don't seem to work.

How could I manage to make this work?

Comments

  • DeepBayGamesDeepBayGames Member Posts: 93
    Here's one way that would work. 1) Create a Game Attribute that's using an integer. Call it "STATnumber" for example. 2) For each clickable item, create a rule that changes STATnumber to a unique value. IE: a) When player touches the knife, it fires a rule that states: When Touch is pressed, change STATnumber to 1. b) When player touches the sword, it fires a rule that states: When Touch is pressed, change STATnumber to 2. And so on for as many items as you have.

    Then, in your actor that displays text for these stats, have a set of corresponding rules. IE: When STATnumber = 1 then Display Text (Whatever you want. When STATnumber = 2 then Distplay Text (Whatever you want next. And so on.

    In this way, you will never have an overlapped message because each Display Text rule will only fire when their number comes up. You can have as many Display Text rules associated with one actor as you want. No need to spawn or destroy anything.
  • BasGoodboyBasGoodboy Member, PRO Posts: 310
    Super mate, thanks, I couldn't think about this some way or another.
    You say you don't have to spawn an actor for displaying text. I found that's true, but actors you can spawn on a specific location, and just the display text rule I didn't found any way to spawn it on a certain location..

    Or is there a way to spawn text without spawning an actor on a certain position?
  • DeepBayGamesDeepBayGames Member Posts: 93
    edited August 2013
    You still need an actor on which to apply the Display Text rule. But you can have that actor always present in the scene, in the location you desire. If you need the text to completely disappear at any point, just change the STATnumber integer to a number that is not referenced. IE: Change attribute STATnumber to 0. If all Display Text rules are looking for numbers other than 0, then when the value = 0, text will not be displayed at all.

    If for some reason you need the location of the text to change, you could either have separate actors for each location, each with it's own Display Text rule, OR you could have one actor that Changes both X and Y positions depending on the value of the STATnumber.
  • BasGoodboyBasGoodboy Member, PRO Posts: 310
    Ya ok.. I have already made the different actors. Thanks mate! You helped a lot.
  • DeepBayGamesDeepBayGames Member Posts: 93
    NP. Glad to help.
Sign In or Register to comment.