need help please, i have a problem with a game attribute.

guillefaceguilleface Member Posts: 1,014
edited November -1 in Working with GS (Mac)
being working for 2 hours and can't make it to work. ok so i have
actor1
actor2
actor3.
hero
i need when hero is touching actor1 to change game.attribute "go" to 1(this works fine)
2nd rule is when hero is touching actor1 and actor2 to change "go" to 2.
so i add 2 hero's in the scene, one hero is touching actor1 and the other actor2 but is showing the go attribute=1

Comments

  • magic101himagic101hi Member Posts: 713
    Is the "Go" integer inside the actors? The reason this is not working is because they are separate actors and thus cannot both detect at the same time what you could do is have booleans decting when the hero is touching actor 1 & 2 and then when both are true then you set go to be 2.

    Here is what you should have:
    //These are game variables
    integer go;
    boolean heroTouching1;
    boolean heroTouching2;

    //So if the hero is touching actor1 then set go to 1 and heroTouching1 to true
    if (hero "overlaps or collides" "with actor fo type" actor1)
    {
    heroTouching1 = true;
    go = 1;
    }

    //and this is for when the hero is touching actor 2 set heroTouching2 to true
    if (hero "overlaps or collides" "with actor fo type" actor2)
    {
    heroTouching2 = true;
    }

    //then if both actor1 & actor2 are touching a hero then it changes go to 2
    if (heroTouching1 == true && heroTouching2 == true)
    {
    go = 2;
    }

    Hope I helped!
    -Josh
  • guillefaceguilleface Member Posts: 1,014
    thanks it did helped me out by using some of this method :)
Sign In or Register to comment.