*****Question about math ******

GSAnimatorGSAnimator Member Posts: 312
edited September 2012 in Working with GS (Mac)
Can anyone tell me how do I use math to change attribute between ....4, 3, 2, 1

Answers

  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Hey,

    I think you have to explain it a little bit better. Basically when you want an attribute to go from 4 to 3 etc. use a timer, every 1sec. change attribute to attribute -1

    Alex
  • GSAnimatorGSAnimator Member Posts: 312
    Hey,

    I think you have to explain it a little bit better. Basically when you want an attribute to go from 4 to 3 etc. use a timer, every 1sec. change attribute to attribute -1

    Alex
    Sorry, what I mean is that I want create a loop change between 4, 3, 2, 1 when the attribute is 1 then change back to 4
  • ultimaultima Member, PRO Posts: 1,207
    edited September 2012
    i'm sure there's a million ways to do it. this is probably a stupid way to do it.

    or use a table, and set up

    0 4
    1 3
    2 2
    3 1

    and do table (cell value(xxx,(row+1)%3,1)) and that'll loop you and return 4-1.

    or... you can do this. max(0,game.value-1) when game.value=1, change game.value = 4(instead of -1 of course)
    (i'm not sure why but simply because sometimes GS does weird things when too many things are running and skip 0 and go straight to -1 without running the change attribute)

    or do a game.value=0, and 5-((game.value+1)%3)... results will be 5-1=4, 5-2=3, 5-3=2, 5-4=1, and 5-1=4 loop

    damn i suck at math haha.
  • GSAnimatorGSAnimator Member Posts: 312
    I knew this math "(attribute+1)%X " ..I can get a loop between 1, 2, 3, .....X .. but how can I use a math to get loop between X....3, 2, 1
  • GSAnimatorGSAnimator Member Posts: 312

    or use a table
    Yes, ok I will use table
  • Yovanny369Yovanny369 Member Posts: 105
    Instead of using "(attribute +1)% X"
    use this "(attribute-1)% 5"
    attribute value = 4
  • ultimaultima Member, PRO Posts: 1,207
    edited September 2012
    yes eduard but at one point it'll return a 0... someone with brilliant mathematical mind please shed some light on shortest math equation lol..
  • GSAnimatorGSAnimator Member Posts: 312

    use this "(attribute-1)% 5"
    That's great!
Sign In or Register to comment.