How do I make odd and even numbers?

gawakamygawakamy Member Posts: 109
edited April 2012 in Working with GS (Mac)
Hi, GS dudes.
I am gonna display images depends on odd and even numbers. How do I make it?
I tried [Attribute][PlayTime]=[game.Playtime*2+1], but it didn't work.
Please help!!

Best Answers

  • lukey5227lukey5227 Posts: 111
    Accepted Answer
    If number/2 = floor(number/2)
    Number = even
    Otherwise
    Number = odd
  • JohnPapiomitisJohnPapiomitis Posts: 6,256
    edited April 2012 Accepted Answer
    Create a seperate attribute called evenDetector

    when you want to check if another attrbute is odd or even(ill use an attribute called number as an example or a attribute you want to check)

    change attribute evenDetector to number%2

    That will change the attribute evenDetector to either a 0 or a 1. If its a 0 then number is even, if its a 1 its odd.

    So in the other actor you want to change the image have a rule
    if attribute evenDetector=0
    -change image to even image
    OTHERWISE
    -change image to odd image

    That should do it for ya

Answers

Sign In or Register to comment.