A way to get a boolean return to FALSE when not colliding?

Hi Guys, I'm new to GS and so was a little confused as to where to post this (but this seems a reasonable place to start!)

I know a fair bit about programming and scripting and I really like this idea of conditional statements with 'building blocks' for my dev team (it enables even some of the non-programmers to get stuck into other aspects of development)

I'm currently using GameSalad on a project. I'm having an issue where a I can't figure out a way to get a game.Boolean to reset to False when 2 actors aren't colliding.

I'm using a text box, that slides up from the bottom of the screen when you collide with a switch, it displays text based on what the 'Event Handler' object contains, e.g. "This door is seized shut". It's just a stylised standard text box which minimises user input.

I'm currently doing it in this format to make these attributes available to everything, all the time:

In the Game tab:

IsVisible: boolean
CurrentText: text

The actors are a Player, Text Box and Text Handler

When the Player collides/overlaps the Text Handler, it sets IsVisible to True and CurrentText to "Hello World", Else is set to make IsVisible False.

This in turn makes the Text Box move to the bottom of the screen and display the correct text.

HOWEVER

When you move away from the text handler the bool stays set to TRUE and the Text Box object stays on screen.

I made a toggle on a keypress to change IsVisible just to test this, the text box works fine, just not when controlled by the Text Handler.

I'm going to try these rules in the Player object and see if that makes a difference, but then its making it more complex.

There are other, simpler ways of doing this, but I've yet to find one that'll be compatible with that I intend to do in the bigger picture.

Anyway, thanks for your time in advance.

Cheers,

Joe



Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    as far as changing the boolean you should have no problem with

    When overlaps or collides
    -Change game.attribute to true
    Otherwise
    -Change game.attribute to false

    if thats not working you have another behavior in there conflicting with the rule. could be in another actor or something cause theres no reason that basic logic should not work. we use it all the time.
  • velentisvelentis Member Posts: 1
    Thanks for the fast reply!

    Ok I double checked my rules and even rewrote them to make sure but with the same result.

    I popped the same actions into the Player actor and it works just fine. Its almost like a persistence problem with it not refreshing the state (not that I know you get these in GS). I'll have to make do for now and see what I can come up with when I get to the issue.

    I know it has to be a flaw in my logic that I'm overlooking. It's always the case!

    Thank you for taking the time to confirm my sanity!

    Joe
  • ORBZORBZ Member Posts: 1,304
    GS logic is a tad diff from traditional scripting. Think of it like Finite State Machines. That's your best approach. tenrdrmr's answer should work for your needs.
Sign In or Register to comment.