Expression Editor

azimpactazimpact Member Posts: 112
edited November -1 in Working with GS (Mac)
I'm trying to keep my rules down and am wondering is there a way to do a OR in the expression editor.

For example, I have 3 bad guys on different locations on the screen and some higher than others so they set their own X and Y.

My good guy uses (game.BadGuyY) + (1/2*(self.size.height) -3) which allow him to jump and kill the bad guys.

Each badguy has their own x and y value.

In the PHP world, I would use || to specify OR so my rule would look like this:
(game.BadGuyY)||(game.BadGuy2Y)|| (game.BadGuy3Y)+ (1/2*(self.size.height) -3).

Is there an a expression for the editor to use for the || OR value in the above sample.

I've tried using || and it don't work.

Comments

  • AsymptoteellAsymptoteell Member Posts: 1,362
    At the top of the rule where it says all, switch it to any.
  • azimpactazimpact Member Posts: 112
    Thanks for that but it won't work.

    There is a collide rule that will cancel out the other rules.

    I should of put that in my first post that the rule plus a collide with the actor rule are what triggers it.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    A "one or another" OR in GS would be the Otherwise section. Any help?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • azimpactazimpact Member Posts: 112
    Ah yes, I forgot about the otherwise.

    Not the way I wanted to go because it does add more rules instead of handling it with one expression, but it works.

    Thanks!
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    you can also use tags. So in the home screen click on "actors" in the middle of the screen and then to the left you will see a list where you can click the "+" to add tags. Create a tag called badguys and then drag all of the different bad guys on top of that tag. Then you can use this with collide/overlap rules. That may help.
Sign In or Register to comment.