# Processing skips forward and jumps to loop

**URL:** <https://discourse.processing.org/t/processing-skips-forward-and-jumps-to-loop/7169>\
**Category:** Coding Questions\
**Created:** [January 4, 2019, 2:56pm UTC](https://discourse.processing.org/t/processing-skips-forward-and-jumps-to-loop/7169 "2019-01-04T14:56:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlijnob](https://avatars.discourse-cdn.com/v4/letter/c/e47c2d/32.png) [@carlijnob](https://discourse.processing.org/u/carlijnob)\
**Post date:** [January 4, 2019, 2:56pm UTC](https://discourse.processing.org/t/processing-skips-forward-and-jumps-to-loop/7169/1 "2019-01-04T14:56:05Z")

</div>

Hello everybody,

I am trying to finish the code I wrote together with someone with more experience. Unfortunately, this person is on holiday right now and I cannot find the solution of my problem.

The problem is that the movie almost immediately jumps to the LOOPS and barely shows the FORWARDs of any option.

I wrote it first for KINECT and afterwards I switched to Makey Makey. Therefore, some old stuff is still in this code. It’s the first time I wrote a code so sorry if it is full of mistakes!!!

(I put a small piece of the whole code in here since its too big otherwise)

 ![38](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1f7bbe6e9c69858d9c9b344e960469d2a620e81d.png)

> **Summary**
>
> ```auto
> void checkPositions() {
> 
> if (currentState == TOP_LEFT_LOOP && !topLeft) currentState = TOP_LEFT_BWD;
> if (currentState == TOP_RIGHT_LOOP && !topRight) currentState = TOP_RIGHT_BWD;
> if (currentState == BOTTOM_RIGHT_LOOP && !bottomRight) currentState = BOTTOM_RIGHT_BWD;
> if (currentState == BOTTOM_LEFT_LOOP && !bottomLeft) currentState = BOTTOM_LEFT_BWD;
> 
> else if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP && !topRight) currentState = TOP_LEFT_LOOP_TOP_RIGHT_BWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP && !bottomRight) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_BWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP && !bottomLeft) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_BWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP && !bottomRight) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_BWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP && !bottomLeft) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_BWD;
> else if (currentState == TOP_RIGHT_LOOP_TOP_LEFT_LOOP && !topLeft) currentState = TOP_RIGHT_LOOP_TOP_LEFT_BWD;
> else if (currentState == BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP && !bottomLeft) currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_BWD;
> else if (currentState == BOTTOM_RIGHT_LOOP_TOP_LEFT_LOOP && !topLeft) currentState = BOTTOM_RIGHT_LOOP_TOP_LEFT_BWD;
> else if (currentState == BOTTOM_RIGHT_LOOP_TOP_RIGHT_LOOP && !topRight) currentState = BOTTOM_RIGHT_LOOP_TOP_RIGHT_BWD;
> else if (currentState == BOTTOM_LEFT_LOOP_TOP_LEFT_LOOP && !topLeft) currentState = BOTTOM_LEFT_LOOP_TOP_LEFT_BWD;
> else if (currentState == BOTTOM_LEFT_LOOP_TOP_RIGHT_LOOP && !topRight) currentState = BOTTOM_LEFT_LOOP_TOP_RIGHT_BWD;
> else if (currentState == BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP && !bottomRight) currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_BWD;
> 
> else if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP && !bottomRight) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_BWD;
> else if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP && !bottomLeft) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_BWD;
> else if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP && !topRight) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_RIGHT_BWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP && !bottomLeft) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_BWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_LOOP && !topRight) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_BWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP && !bottomRight) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_BWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_LOOP && !topLeft) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_BWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP && !bottomLeft) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_BWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP && !bottomRight) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_BWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_LOOP && !topLeft) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_BWD;
> else if (currentState == BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_LOOP && !topLeft) currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_BWD;
> else if (currentState == BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_LOOP && !topRight) currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_BWD;
> 
> else if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP && !bottomLeft) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_BWD;
> else if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP && !bottomRight) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_BWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_LOOP && !topRight) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_BWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_LOOP && !topLeft) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_BWD;
> 
> else {
> //standaard vormen 1 tm 13
> if (!topLeft &! topRight &! bottomLeft &! bottomRight) currentState = BEGIN;
> 
> if (topLeft &! topRight &! bottomLeft &! bottomRight) {
> if (currentState == BEGIN) currentState = TOP_LEFT_FWD;
> else currentState = TOP_LEFT_LOOP;
> }    
> if (!topLeft & topRight &! bottomLeft &! bottomRight) {
> if (currentState == BEGIN) currentState = TOP_RIGHT_FWD;
> else currentState = TOP_RIGHT_LOOP;
> }    
> if (!topLeft & !topRight &! bottomLeft & bottomRight) {
> if (currentState == BEGIN) currentState = BOTTOM_RIGHT_FWD;
> else currentState = BOTTOM_RIGHT_LOOP;
> } 
> if (!topLeft & !topRight & bottomLeft &! bottomRight) {
> if (currentState == BEGIN) currentState = BOTTOM_LEFT_FWD;
> else currentState = BOTTOM_LEFT_LOOP;
> } 
> 
> //uitgebreide vormen 14 tm 94
> // if (topLeft && topRight &! bottomLeft &! bottomRight) {
> // if (currentState == TOP_LEFT_LOOP) currentState = TOP_LEFT_LOOP_TOP_RIGHT_FWD;
> // else currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP;
> // }
> // if (topLeft && !topRight &! bottomLeft & bottomRight) {
> // if (currentState == TOP_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> // else currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP;
> // }
> // if (topLeft && !topRight & bottomLeft &! bottomRight) {
> // if (currentState == TOP_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_FWD;
> // else currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP;
> // }
> // if (!topLeft && topRight &! bottomLeft & bottomRight) {
> // if (currentState == TOP_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_FWD;
> // else currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP;
> // }
> // if (!topLeft && topRight & bottomLeft &! bottomRight) {
> // if (currentState == TOP_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> // else currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP;
> // }
> // if (topLeft && topRight &! bottomLeft &! bottomRight) {
> // if (currentState == TOP_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_TOP_LEFT_FWD;
> // else currentState = TOP_RIGHT_LOOP_TOP_LEFT_LOOP;
> // }
> // if (!topLeft && !topRight & bottomLeft & bottomRight) {
> // if (currentState == BOTTOM_RIGHT_LOOP) currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> // else currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP;
> // }
> // if (topLeft && !topRight &! bottomLeft & bottomRight) {
> // if (currentState == BOTTOM_RIGHT_LOOP) currentState = BOTTOM_RIGHT_LOOP_TOP_LEFT_FWD;
> // else currentState = BOTTOM_RIGHT_LOOP_TOP_LEFT_LOOP;
> // }
> // if (!topLeft && topRight &! bottomLeft & bottomRight) {
> // if (currentState == BOTTOM_RIGHT_LOOP) currentState = BOTTOM_RIGHT_LOOP_TOP_RIGHT_FWD;
> // else currentState = BOTTOM_RIGHT_LOOP_TOP_RIGHT_LOOP;
> // }
> // if (topLeft &! topRight & bottomLeft &! bottomRight) {
> // if (currentState == BOTTOM_LEFT_LOOP) currentState = BOTTOM_LEFT_LOOP_TOP_LEFT_FWD;
> // else currentState = BOTTOM_LEFT_LOOP_TOP_LEFT_LOOP;
> // }
> // if (!topLeft && topRight & bottomLeft & !bottomRight) {
> // if (currentState == BOTTOM_LEFT_LOOP) currentState = BOTTOM_LEFT_LOOP_TOP_RIGHT_FWD;
> // else currentState = BOTTOM_LEFT_LOOP_TOP_RIGHT_LOOP;
> // }
> // if (!topLeft && !topRight & bottomLeft & bottomRight) {
> // if (currentState == BOTTOM_LEFT_LOOP) currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> // else currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP;
>       
> }
> if (topLeft && topRight & !bottomLeft & !bottomRight) {
> if (currentState == TOP_LEFT_LOOP) currentState = TOP_LEFT_LOOP_TOP_RIGHT_FWD;
> else if (currentState == TOP_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_TOP_LEFT_FWD;
> else currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP;
> }
> if (topLeft &&! topRight & !bottomLeft & bottomRight) {
> if (currentState == TOP_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> else if (currentState == BOTTOM_RIGHT_LOOP) currentState = BOTTOM_RIGHT_LOOP_TOP_LEFT_FWD;
> else currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP;
> }
> if (topLeft &&! topRight & bottomLeft & !bottomRight) {
> if (currentState == TOP_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_FWD;
> else if (currentState == BOTTOM_LEFT_LOOP) currentState = BOTTOM_LEFT_LOOP_TOP_LEFT_FWD;
> else currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP;
> }
> if (!topLeft && topRight & !bottomLeft & bottomRight) {
> if (currentState == TOP_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_FWD;
> else if (currentState == BOTTOM_RIGHT_LOOP) currentState = BOTTOM_RIGHT_LOOP_TOP_RIGHT_FWD;
> else currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP;
> }
> if (!topLeft && topRight & bottomLeft & !bottomRight) {
> if (currentState == TOP_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> else if (currentState == BOTTOM_LEFT_LOOP) currentState = BOTTOM_LEFT_LOOP_TOP_RIGHT_FWD;
> else currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP;      
> }
> if (!topLeft && !topRight & bottomLeft & bottomRight) {
> if (currentState == BOTTOM_RIGHT_LOOP) currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> else if (currentState == BOTTOM_LEFT_LOOP) currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> else currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP;             
> 
>   
> }
> // if (topLeft && topRight &! bottomLeft & bottomRight) {
> // if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_FWD;
> // else currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP;
> // }
> // if (topLeft && topRight & bottomLeft &! bottomRight) {
> // if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> // else currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP;
> // }
> // if (topLeft && topRight &! bottomLeft & bottomRight) {
> // if (currentState == TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_RIGHT_FWD;
> // else currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_RIGHT_LOOP;
> // }
> // if (topLeft &&! topRight & bottomLeft & bottomRight) {
> // if (currentState == TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> // else currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP;
> // }
> // if (topLeft && topRight & bottomLeft &! bottomRight) {
> // if (currentState == TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_FWD;
> // else currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_LOOP;
> // }
> // if (topLeft &&! topRight & bottomLeft & bottomRight) {
> // if (currentState == TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> // else currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP;
> // }
> // if (topLeft && topRight &! bottomLeft & bottomRight) {
> // if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_FWD;
> // else currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_LOOP;
> // }
> // if (!topLeft && topRight & bottomLeft & bottomRight) {
> // if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> // else currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP;
> // }
> // if (!topLeft && topRight & bottomLeft & bottomRight) {
> // if (currentState == TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> // else currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP;
> // }
> // if (topLeft && topRight & bottomLeft &! bottomRight) {
> // if (currentState == TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_FWD;
> // else currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_LOOP;
> // }
> // if (topLeft && !topRight & bottomLeft & bottomRight) {
> // if (currentState == BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP) currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_FWD;
> // else currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_LOOP;
> // }
> // if (!topLeft && topRight & bottomLeft & bottomRight) {
> // if (currentState == BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_FWD;
> // else currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_LOOP;
> // }
>     
> if (topLeft && topRight &! bottomLeft & bottomRight) {
> if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_FWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_RIGHT_FWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_FWD;
> else currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_LOOP;
> }
> if (topLeft && topRight & bottomLeft &! bottomRight) {
> if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_FWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_FWD;
> else currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_LOOP;
> }
> if (topLeft && !topRight & bottomLeft & bottomRight) {
> if (currentState == TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> else if (currentState == BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP) currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_FWD;
> else currentState = BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP_TOP_LEFT_LOOP;
> }
> if (!topLeft && topRight & bottomLeft & bottomRight) {
> if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> else if (currentState == BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_FWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> else currentState = TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_LOOP;
> }
> if (topLeft && topRight & bottomLeft & bottomRight) {
> if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_FWD;
> else if (currentState == TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_LEFT_LOOP_TOP_RIGHT_LOOP_BOTTOM_LEFT_LOOP_BOTTOM_RIGHT_FWD;
> else if (currentState == TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_LEFT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_RIGHT_FWD;
> else if (currentState == TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP) currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_FWD;
> else if (currentState == LAST_PART_FWD) currentState = LAST_PART_FWD; 
> else if (currentState == LAST_PART_LOOP) currentState = LAST_PART_LOOP; 
> else currentState = TOP_RIGHT_LOOP_BOTTOM_RIGHT_LOOP_BOTTOM_LEFT_LOOP_TOP_LEFT_LOOP;
> }
> }
> 
> void updateState( ) {
> switch (currentState) {
> case BEGIN:
> inTime = 0.00;
> outTime = 0.50;
> break;
> case TOP_LEFT_FWD:
> inTime = 0.00;
> outTime = 3.00;
> if (myMovie.time() >= 2.8) {
> currentState = TOP_LEFT_LOOP;
> }
> break;
> case TOP_LEFT_LOOP:
> inTime = 3.58;
> outTime = 4.00;
> break;
> case TOP_LEFT_BWD:
> inTime = 362.00;
> outTime = 363.00;
> if (myMovie.time() >= 362.8) {
> currentState = BEGIN;
> }   
> break;
> case TOP_RIGHT_FWD:
> inTime = 4.00;
> outTime = 7.00;
> if (myMovie.time() >= 6.8) {
> currentState = TOP_RIGHT_LOOP;
> }
> break;
> case TOP_RIGHT_LOOP:
> inTime = 7.58;
> outTime = 8.00;
> break;
> case TOP_RIGHT_BWD:
> inTime = 364.00;
> outTime = 367.00;
> if (myMovie.time() >= 366.8) {
> currentState = BEGIN;
> }
> break;
> case BOTTOM_LEFT_FWD:
> inTime = 12.00;
> outTime = 15.00;
> if (myMovie.time() >= 14.8) {
> currentState = BOTTOM_LEFT_LOOP;
> }
> break;
> case BOTTOM_LEFT_LOOP:
> inTime = 15.58;
> outTime = 16.00;
> break;
> case BOTTOM_LEFT_BWD:
> inTime = 372.00;
> outTime = 385.00;
> if (myMovie.time() >= 384.8) {
> currentState = BEGIN;
> }
> break;
> case BOTTOM_RIGHT_FWD:
> inTime = 8.00;
> outTime = 11.00;
> if (myMovie.time() >= 10.8) {
> currentState = BOTTOM_RIGHT_LOOP;
> }
> break;
> case BOTTOM_RIGHT_LOOP:
> inTime = 11.58;
> outTime = 12.00;
> break;
> case BOTTOM_RIGHT_BWD:
> inTime = 378.00;
> outTime = 381.00;
> if (myMovie.time() >= 380.8) {
> currentState = BEGIN;
> }
> 
> ```
