public static void toggle() { isOn = !isOn; if (isOn) { sprite.play(RightName); } else { sprite.play(LeftName); } }
private static AnimatedSprite makeSprite() { final AnimatedSprite sprite = Assets.makeTileSprite(spriteClass); final int speed = 12; final String startName = "leftStopped"; sprite.addAnimation(startName, speed, new int[] {0}, false); sprite.addAnimation(LeftName, speed, new int[] {2, 1, 0}, false); sprite.addAnimation(RightName, speed, new int[] {0, 1, 2}, false); sprite.addAnimation(ForceRightName, speed, new int[] {2}, false); isOn = false; sprite.play(startName); return sprite; }