how to alternate between two different images while it is moving along the y-axis

I have two images in my sketch and it shows one moving down the y-axis and the other one is behind it so you can't see it, but how do I tell the program to alternate between the two images using the y-axis? So like my first image is shown on odd numbers and my other is shown on even numbers? Thank you!

Answers

  • edited November 2017

    If the y value is odd, draw the first image, otherwise draw the second image.

    If ( y doesn't divide by 2 evenly ) { draw the first image } else { draw the second image }

    if ( y divided by 2 has a remainder ) { image (the first one) } else { image( the second one ); }

    if( y % 2 != 0 ) { image( first_image, x, y); } else { image( second_image, x, y); }

    if( y % 2 != 0 ) {
      image(first_image, x, y);
    } else {
      image(second_image, x, y);
    }
    
Sign In or Register to comment.