using game attribute to determine character select position

digitalzerodigitalzero Member, BASIC Posts: 639

hi there everyone so I was trying to come up with a character select screen that would work out for myself with the characters if you press the left but the character comes from some of that if you passed the right way to get there first will come from the right...

I know this sounds confusing so ill try to break it down.... On the scene there are two buttons... One left and one right... In a sense it's going to scroll through the characters...

In those buttons i have a rule placed if touch is pressed change attribute game.character select to ( game.character select+1)%9 of course if you're touching the other button it will be -1... This game attribute is an index attribute

What I'm thinking is that i need to compare it with two numbers which i have no idea how to do... Considering the attribute cycles between 0 and 8...

If you understand what I'm trying to say can you please help me... If not then I'll try to elaborate

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2015

    When increasing the value:

    Change attribute game.characterSelect to mod(game.characterSelect,8)+1

    When decreasing the value:

    When attribute game.characterSelect=1
         Change attribute game.characterSelect to 8
    Otherwise
         Change attribute game.characterSelect to game.characterSelect-1.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • digitalzerodigitalzero Member, BASIC Posts: 639

    I'm not understanding where to put that @tatiang and how is it supposed to know if the number is increasing or decreasing there are three actors total

    The left button which will increase game.character select

    The right button which decreases game.character select

    And there is the middle actor which is the actor that displays the character

    If the right button is pressed i want the actor to change its positron x to the left side of the screen and it will interpolate to the middle

    It will duo the opposite for the right side to make it seem as if it is scrolling through

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2015

    Okay, I guess I didn't understand what you were trying to do. It sounded like you wanted some kind of a character selection system where you click on arrows to cycle through a set number of characters. My advice probably won't help then... sorry!

    You might want to upload a sketch or screenshot that illustrates what you're wanting to do.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • digitalzerodigitalzero Member, BASIC Posts: 639

    I may have a better way of explaining this... If the right button is pressed it needs to change its position x to 100 if the left button is pressed it needs to change it to 570

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Then just change the value of a game attribute, game.characterX, to either 100 or 570 depending on which button actor is pressed and then constrain the character actor's self.Position.X to game.characterX.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.