The tickcount trick

You're viewing a single comment in a conversation. View all the comments
  • 3 Comments

  • Order by
  • Hi, no worries.

    In system conditions there is a condition named "compare two values"

    Put tickcount % 2 in the first field

    = (equal) in the second (it's a dropdown)

    0 in the third

    • Thank you, that's helpful. One more question...

      What does the "% 2" mean? I'd like to understand exactly what is happening here.

      • % is the modulo operator. Basically a%b returns the rest of the euclidian division of a by b. Put in other words, you remove b from a as long as a > b

        12%7 = 5

        100%10 = 0

        3%8 = 3

        So what that means is that it will execute the action only when tickount%2 is equal to 0. This is true when tickount is even. So it will only execute the action when tickcount is even AKA every two frames.

        Changing the number after the modulo increases the number of frames it will wait before performing the action.