can i make a attribute go like 123212321

guillefaceguilleface Member, BASIC Posts: 1,039

i know how to do like 123 then back to 1 but i need it the other way thanks.

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited March 2014

    @guilleface, in this thread I proudly presented a high brow approach, then @RThurman came along und unnecessarily simplified it ;)

    Your sollution is at the end of the thread.

    http://forums.gamesalad.com/discussion/65863/how-can-i-have-an-attribute-loop-between-3-numbers

  • guillefaceguilleface Member, BASIC Posts: 1,039

    thank you i will take a look.

  • guillefaceguilleface Member, BASIC Posts: 1,039

    so i try For 1,2,3,2,1,2,3,2,1 you can try: abs(mod( self.Time ,4)-2)+1 but it only go to 3 then 212121 and so on, i try to mess with the number but no luck.
    i need this so i can touch a actor and change y position from 50, 100, 150, so i can have a rule like when attribute 'number" =2 change y position to 100, as you can see even if the actor is on 150 the "number" value is =3 so when i touch it the "number" is =2 now so it will move down.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881

    @Hopscotch‌ -- lol 'unnecessary simplification'!

    @guilleface‌ -- create an integer attribute called 'touchCount' and then:

    Change Attribute: touchCount To: 2
    Change Attribute: self.Position.Y To: 50*(abs(mod( self.touchCount ,4)-2)+1)
    When mouse is down
    --Change Attribute: touchCount To: touchCount + 1
    --Change Attribute: self.Position.Y To: 50*(abs(mod( self.touchCount ,4)-2)+1)
    
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    edited March 2014

    when touch is pressed
    attribute = ((attribute+1)%3)+1

    edit, misread your original question. sorry!

Sign In or Register to comment.