/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Animal/Object class var ParadeItem = Container.expand(function () { var self = Container.call(this); // Ensure assetId is set before attachAsset if (typeof self.assetId === "undefined" && _typeof(arguments[0]) === "object" && arguments[0].assetId) { self.assetId = arguments[0].assetId; } // Fallback to a default asset if assetId is still not set if (typeof self.assetId === "undefined") { // Do not fallback to 'cat', let assetId be undefined if not set } // Attach the asset for this item var asset = self.attachAsset(self.assetId, { anchorX: 0.5, anchorY: 1.0 // bottom center, so it "stands" on the ground }); // Movement pattern: set by type self.moveType = self.moveType || "walk"; self.speed = self.speed || 2 + Math.random() * 2; self.direction = self.direction || (Math.random() < 0.5 ? 1 : -1); // 1: right, -1: left // For "hop" and "fly" types self.hopTimer = 0; self.flyPhase = Math.random() * Math.PI * 2; // For "roll" types self.spin = 0; // For "wiggle" types self.wigglePhase = Math.random() * Math.PI * 2; // For "slide" types self.slideTimer = 0; // For "bounce" types self.bouncePhase = Math.random() * Math.PI * 2; // For "float" types self.floatPhase = Math.random() * Math.PI * 2; // For "crawl" types self.crawlPhase = Math.random() * Math.PI * 2; // For "zoom" types self.zoomTimer = 0; // For "spin" types self.spinSpeed = 0.01 + Math.random() * 0.02; // For "sway" types self.swayPhase = Math.random() * Math.PI * 2; // For "peek" types self.peekTimer = 0; self.isPeeking = false; // For "pop" types self.popTimer = 0; self.isPopped = false; // For "appear" types self.appearTimer = 0; self.hasAppeared = false; // For "jump" types self.jumpPhase = Math.random() * Math.PI * 2; // For "dash" types self.dashTimer = 0; // For "circle" types self.circlePhase = Math.random() * Math.PI * 2; // For "zigzag" types self.zigzagPhase = Math.random() * Math.PI * 2; // For "wave" types self.wavePhase = Math.random() * Math.PI * 2; // For "random" types self.randomTimer = 0; // For "pause" types self.pauseTimer = 0; self.isPaused = false; // For "hide" types self.hideTimer = 0; self.isHidden = false; // For "flip" types self.flipTimer = 0; self.isFlipped = false; // For "twirl" types self.twirlPhase = Math.random() * Math.PI * 2; // For "drift" types self.driftPhase = Math.random() * Math.PI * 2; // For "shake" types self.shakePhase = Math.random() * Math.PI * 2; // For "slideup" types self.slideupTimer = 0; // For "sprint" types self.sprintTimer = 0; // For "hover" types self.hoverPhase = Math.random() * Math.PI * 2; // For "bob" types self.bobPhase = Math.random() * Math.PI * 2; // For "sneak" types self.sneakPhase = Math.random() * Math.PI * 2; // For "stomp" types self.stompPhase = Math.random() * Math.PI * 2; // For "march" types self.marchPhase = Math.random() * Math.PI * 2; // For "slideleft" types self.slideleftTimer = 0; // For "slither" types self.slitherPhase = Math.random() * Math.PI * 2; // For "hopright" types self.hoprightTimer = 0; // For "hopleft" types self.hopleftTimer = 0; // For "jumpup" types self.jumpupPhase = Math.random() * Math.PI * 2; // For "jumpdown" types self.jumpdownPhase = Math.random() * Math.PI * 2; // For "rollright" types self.rollrightSpin = 0; // For "rollleft" types self.rollleftSpin = 0; // For "zoomright" types self.zoomrightTimer = 0; // For "zoomleft" types self.zoomleftTimer = 0; // For "bounceup" types self.bounceupPhase = Math.random() * Math.PI * 2; // For "bouncedown" types self.bouncedownPhase = Math.random() * Math.PI * 2; // For "floatup" types self.floatupPhase = Math.random() * Math.PI * 2; // For "floatdown" types self.floatdownPhase = Math.random() * Math.PI * 2; // For "peekright" types self.peekrightTimer = 0; // For "peekleft" types self.peekleftTimer = 0; // For "popright" types self.poprightTimer = 0; // For "popleft" types self.popleftTimer = 0; // For "appearleft" types self.appearleftTimer = 0; // For "appearright" types self.appearrightTimer = 0; // For "jumpright" types self.jumprightPhase = Math.random() * Math.PI * 2; // For "jumpleft" types self.jumpleftPhase = Math.random() * Math.PI * 2; // For "dashright" types self.dashrightTimer = 0; // For "dashleft" types self.dashleftTimer = 0; // For "circleright" types self.circlerightPhase = Math.random() * Math.PI * 2; // For "circleleft" types self.circleleftPhase = Math.random() * Math.PI * 2; // For "zigzagright" types self.zigzagrightPhase = Math.random() * Math.PI * 2; // For "zigzagleft" types self.zigzagleftPhase = Math.random() * Math.PI * 2; // For "waveright" types self.waverightPhase = Math.random() * Math.PI * 2; // For "waveleft" types self.waveleftPhase = Math.random() * Math.PI * 2; // For "randomright" types self.randomrightTimer = 0; // For "randomleft" types self.randomleftTimer = 0; // For "pauseright" types self.pauserightTimer = 0; self.isPausedRight = false; // For "pauseleft" types self.pauseleftTimer = 0; self.isPausedLeft = false; // For "hideright" types self.hiderightTimer = 0; self.isHiddenRight = false; // For "hideleft" types self.hideleftTimer = 0; self.isHiddenLeft = false; // For "flipright" types self.fliprightTimer = 0; self.isFlippedRight = false; // For "flipleft" types self.flipleftTimer = 0; self.isFlippedLeft = false; // For "twirlright" types self.twirlrightPhase = Math.random() * Math.PI * 2; // For "twirlleft" types self.twirlleftPhase = Math.random() * Math.PI * 2; // For "driftright" types self.driftrightPhase = Math.random() * Math.PI * 2; // For "driftleft" types self.driftleftPhase = Math.random() * Math.PI * 2; // For "shakeright" types self.shakerightPhase = Math.random() * Math.PI * 2; // For "shakeleft" types self.shakeleftPhase = Math.random() * Math.PI * 2; // For "slideupright" types self.slideuprightTimer = 0; // For "slideupleft" types self.slideupleftTimer = 0; // For "sprintright" types self.sprintrightTimer = 0; // For "sprintleft" types self.sprintleftTimer = 0; // For "hoverright" types self.hoverrightPhase = Math.random() * Math.PI * 2; // For "hoverleft" types self.hoverleftPhase = Math.random() * Math.PI * 2; // For "bobright" types self.bobrightPhase = Math.random() * Math.PI * 2; // For "bobleft" types self.bobleftPhase = Math.random() * Math.PI * 2; // For "sneakright" types self.sneakrightPhase = Math.random() * Math.PI * 2; // For "sneakleft" types self.sneakleftPhase = Math.random() * Math.PI * 2; // For "stompright" types self.stomprightPhase = Math.random() * Math.PI * 2; // For "stompleft" types self.stompleftPhase = Math.random() * Math.PI * 2; // For "marchright" types self.marchrightPhase = Math.random() * Math.PI * 2; // For "marchleft" types self.marchleftPhase = Math.random() * Math.PI * 2; // For "slideleftright" types self.slideleftrightTimer = 0; // For "slitherleftright" types self.slitherleftrightPhase = Math.random() * Math.PI * 2; // For "hoprightright" types self.hoprightrightTimer = 0; // For "hopleftleft" types self.hopleftleftTimer = 0; // For "jumpupright" types self.jumpuprightPhase = Math.random() * Math.PI * 2; // For "jumpupleft" types self.jumpupleftPhase = Math.random() * Math.PI * 2; // For "jumpdownright" types self.jumpdownrightPhase = Math.random() * Math.PI * 2; // For "jumpdownleft" types self.jumpdownleftPhase = Math.random() * Math.PI * 2; // For "rollrightright" types self.rollrightrightSpin = 0; // For "rollleftleft" types self.rollleftleftSpin = 0; // For "zoomrightright" types self.zoomrightrightTimer = 0; // For "zoomleftleft" types self.zoomleftleftTimer = 0; // For "bounceupright" types self.bounceuprightPhase = Math.random() * Math.PI * 2; // For "bounceupleft" types self.bounceupleftPhase = Math.random() * Math.PI * 2; // For "bouncedownright" types self.bouncedownrightPhase = Math.random() * Math.PI * 2; // For "bouncedownleft" types self.bouncedownleftPhase = Math.random() * Math.PI * 2; // For "floatupright" types self.floatuprightPhase = Math.random() * Math.PI * 2; // For "floatupleft" types self.floatupleftPhase = Math.random() * Math.PI * 2; // For "floatdownright" types self.floatdownrightPhase = Math.random() * Math.PI * 2; // For "floatdownleft" types self.floatdownleftPhase = Math.random() * Math.PI * 2; // For "peekrightright" types self.peekrightrightTimer = 0; // For "peekleftleft" types self.peekleftleftTimer = 0; // For "poprightright" types self.poprightrightTimer = 0; // For "popleftleft" types self.popleftleftTimer = 0; // For "appearleftright" types self.appearleftrightTimer = 0; // For "appearrightleft" types self.appearrightleftTimer = 0; // For "jumprightright" types self.jumprightrightPhase = Math.random() * Math.PI * 2; // For "jumpleftleft" types self.jumpleftleftPhase = Math.random() * Math.PI * 2; // For "dashrightright" types self.dashrightrightTimer = 0; // For "dashleftleft" types self.dashleftleftTimer = 0; // For "circlerightright" types self.circlerightrightPhase = Math.random() * Math.PI * 2; // For "circleleftleft" types self.circleleftleftPhase = Math.random() * Math.PI * 2; // For "zigzagrightright" types self.zigzagrightrightPhase = Math.random() * Math.PI * 2; // For "zigzagleftleft" types self.zigzagleftleftPhase = Math.random() * Math.PI * 2; // For "waverightright" types self.waverightrightPhase = Math.random() * Math.PI * 2; // For "waveleftleft" types self.waveleftleftPhase = Math.random() * Math.PI * 2; // For "randomrightright" types self.randomrightrightTimer = 0; // For "randomleftleft" types self.randomleftleftTimer = 0; // For "pauserightright" types self.pauserightrightTimer = 0; self.isPausedRightRight = false; // For "pauseleftleft" types self.pauseleftleftTimer = 0; self.isPausedLeftLeft = false; // For "hiderightright" types self.hiderightrightTimer = 0; self.isHiddenRightRight = false; // For "hideleftleft" types self.hideleftleftTimer = 0; self.isHiddenLeftLeft = false; // For "fliprightright" types self.fliprightrightTimer = 0; self.isFlippedRightRight = false; // For "flipleftleft" types self.flipleftleftTimer = 0; self.isFlippedLeftLeft = false; // For "twirlrightright" types self.twirlrightrightPhase = Math.random() * Math.PI * 2; // For "twirlleftleft" types self.twirlleftleftPhase = Math.random() * Math.PI * 2; // For "driftrightright" types self.driftrightrightPhase = Math.random() * Math.PI * 2; // For "driftleftleft" types self.driftleftleftPhase = Math.random() * Math.PI * 2; // For "shakerightright" types self.shakerightrightPhase = Math.random() * Math.PI * 2; // For "shakeleftleft" types self.shakeleftleftPhase = Math.random() * Math.PI * 2; // For "slideupleftright" types self.slideupleftrightTimer = 0; // For "slideuprightleft" types self.slideuprightleftTimer = 0; // For "sprintrightright" types self.sprintrightrightTimer = 0; // For "sprintleftleft" types self.sprintleftleftTimer = 0; // For "hoverrightright" types self.hoverrightrightPhase = Math.random() * Math.PI * 2; // For "hoverleftleft" types self.hoverleftleftPhase = Math.random() * Math.PI * 2; // For "bobrightright" types self.bobrightrightPhase = Math.random() * Math.PI * 2; // For "bobleftleft" types self.bobleftleftPhase = Math.random() * Math.PI * 2; // For "sneakrightright" types self.sneakrightrightPhase = Math.random() * Math.PI * 2; // For "sneakleftleft" types self.sneakleftleftPhase = Math.random() * Math.PI * 2; // For "stomprightright" types self.stomprightrightPhase = Math.random() * Math.PI * 2; // For "stompleftleft" types self.stompleftleftPhase = Math.random() * Math.PI * 2; // For "marchrightright" types self.marchrightrightPhase = Math.random() * Math.PI * 2; // For "marchleftleft" types self.marchleftleftPhase = Math.random() * Math.PI * 2; // For "slideleftrightright" types self.slideleftrightrightTimer = 0; // For "slitherleftrightright" types self.slitherleftrightrightPhase = Math.random() * Math.PI * 2; // For "hoprightrightright" types self.hoprightrightrightTimer = 0; // For "hopleftleftleft" types self.hopleftleftleftTimer = 0; // For "jumpuprightright" types self.jumpuprightrightPhase = Math.random() * Math.PI * 2; // For "jumpupleftleft" types self.jumpupleftleftPhase = Math.random() * Math.PI * 2; // For "jumpdownrightright" types self.jumpdownrightrightPhase = Math.random() * Math.PI * 2; // For "jumpdownleftleft" types self.jumpdownleftleftPhase = Math.random() * Math.PI * 2; // For "rollrightrightright" types self.rollrightrightrightSpin = 0; // For "rollleftleftleft" types self.rollleftleftleftSpin = 0; // For "zoomrightrightright" types self.zoomrightrightrightTimer = 0; // For "zoomleftleftleft" types self.zoomleftleftleftTimer = 0; // For "bounceuprightright" types self.bounceuprightrightPhase = Math.random() * Math.PI * 2; // For "bounceupleftleft" types self.bounceupleftleftPhase = Math.random() * Math.PI * 2; // For "bouncedownrightright" types self.bouncedownrightrightPhase = Math.random() * Math.PI * 2; // For "bouncedownleftleft" types self.bouncedownleftleftPhase = Math.random() * Math.PI * 2; // For "floatuprightright" types self.floatuprightrightPhase = Math.random() * Math.PI * 2; // For "floatupleftleft" types self.floatupleftleftPhase = Math.random() * Math.PI * 2; // For "floatdownrightright" types self.floatdownrightrightPhase = Math.random() * Math.PI * 2; // For "floatdownleftleft" types self.floatdownleftleftPhase = Math.random() * Math.PI * 2; // For "peekrightrightright" types self.peekrightrightrightTimer = 0; // For "peekleftleftleft" types self.peekleftleftleftTimer = 0; // For "poprightrightright" types self.poprightrightrightTimer = 0; // For "popleftleftleft" types self.popleftleftleftTimer = 0; // For "appearleftrightright" types self.appearleftrightrightTimer = 0; // For "appearrightleftleft" types self.appearrightleftleftTimer = 0; // For "jumprightrightright" types self.jumprightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpleftleftleft" types self.jumpleftleftleftPhase = Math.random() * Math.PI * 2; // For "dashrightrightright" types self.dashrightrightrightTimer = 0; // For "dashleftleftleft" types self.dashleftleftleftTimer = 0; // For "circlerightrightright" types self.circlerightrightrightPhase = Math.random() * Math.PI * 2; // For "circleleftleftleft" types self.circleleftleftleftPhase = Math.random() * Math.PI * 2; // For "zigzagrightrightright" types self.zigzagrightrightrightPhase = Math.random() * Math.PI * 2; // For "zigzagleftleftleft" types self.zigzagleftleftleftPhase = Math.random() * Math.PI * 2; // For "waverightrightright" types self.waverightrightrightPhase = Math.random() * Math.PI * 2; // For "waveleftleftleft" types self.waveleftleftleftPhase = Math.random() * Math.PI * 2; // For "randomrightrightright" types self.randomrightrightrightTimer = 0; // For "randomleftleftleft" types self.randomleftleftleftTimer = 0; // For "pauserightrightright" types self.pauserightrightrightTimer = 0; self.isPausedRightRightRight = false; // For "pauseleftleftleft" types self.pauseleftleftleftTimer = 0; self.isPausedLeftLeftLeft = false; // For "hiderightrightright" types self.hiderightrightrightTimer = 0; self.isHiddenRightRightRight = false; // For "hideleftleftleft" types self.hideleftleftleftTimer = 0; self.isHiddenLeftLeftLeft = false; // For "fliprightrightright" types self.fliprightrightrightTimer = 0; self.isFlippedRightRightRight = false; // For "flipleftleftleft" types self.flipleftleftleftTimer = 0; self.isFlippedLeftLeftLeft = false; // For "twirlrightrightright" types self.twirlrightrightrightPhase = Math.random() * Math.PI * 2; // For "twirlleftleftleft" types self.twirlleftleftleftPhase = Math.random() * Math.PI * 2; // For "driftrightrightright" types self.driftrightrightrightPhase = Math.random() * Math.PI * 2; // For "driftleftleftleft" types self.driftleftleftleftPhase = Math.random() * Math.PI * 2; // For "shakerightrightright" types self.shakerightrightrightPhase = Math.random() * Math.PI * 2; // For "shakeleftleftleft" types self.shakeleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideupleftrightright" types self.slideupleftrightrightTimer = 0; // For "slideuprightleftleft" types self.slideuprightleftleftTimer = 0; // For "sprintrightrightright" types self.sprintrightrightrightTimer = 0; // For "sprintleftleftleft" types self.sprintleftleftleftTimer = 0; // For "hoverrightrightright" types self.hoverrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoverleftleftleft" types self.hoverleftleftleftPhase = Math.random() * Math.PI * 2; // For "bobrightrightright" types self.bobrightrightrightPhase = Math.random() * Math.PI * 2; // For "bobleftleftleft" types self.bobleftleftleftPhase = Math.random() * Math.PI * 2; // For "sneakrightrightright" types self.sneakrightrightrightPhase = Math.random() * Math.PI * 2; // For "sneakleftleftleft" types self.sneakleftleftleftPhase = Math.random() * Math.PI * 2; // For "stomprightrightright" types self.stomprightrightrightPhase = Math.random() * Math.PI * 2; // For "stompleftleftleft" types self.stompleftleftleftPhase = Math.random() * Math.PI * 2; // For "marchrightrightright" types self.marchrightrightrightPhase = Math.random() * Math.PI * 2; // For "marchleftleftleft" types self.marchleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideleftrightrightright" types self.slideleftrightrightrightTimer = 0; // For "slitherleftrightrightright" types self.slitherleftrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoprightrightrightright" types self.hoprightrightrightrightTimer = 0; // For "hopleftleftleftleft" types self.hopleftleftleftleftTimer = 0; // For "jumpuprightrightright" types self.jumpuprightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpupleftleftleft" types self.jumpupleftleftleftPhase = Math.random() * Math.PI * 2; // For "jumpdownrightrightright" types self.jumpdownrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpdownleftleftleft" types self.jumpdownleftleftleftPhase = Math.random() * Math.PI * 2; // For "rollrightrightrightright" types self.rollrightrightrightrightSpin = 0; // For "rollleftleftleftleft" types self.rollleftleftleftleftSpin = 0; // For "zoomrightrightrightright" types self.zoomrightrightrightrightTimer = 0; // For "zoomleftleftleftleft" types self.zoomleftleftleftleftTimer = 0; // For "bounceuprightrightright" types self.bounceuprightrightrightPhase = Math.random() * Math.PI * 2; // For "bounceupleftleftleft" types self.bounceupleftleftleftPhase = Math.random() * Math.PI * 2; // For "bouncedownrightrightright" types self.bouncedownrightrightrightPhase = Math.random() * Math.PI * 2; // For "bouncedownleftleftleft" types self.bouncedownleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatuprightrightright" types self.floatuprightrightrightPhase = Math.random() * Math.PI * 2; // For "floatupleftleftleft" types self.floatupleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatdownrightrightright" types self.floatdownrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatdownleftleftleft" types self.floatdownleftleftleftPhase = Math.random() * Math.PI * 2; // For "peekrightrightrightright" types self.peekrightrightrightrightTimer = 0; // For "peekleftleftleftleft" types self.peekleftleftleftleftTimer = 0; // For "poprightrightrightright" types self.poprightrightrightrightTimer = 0; // For "popleftleftleftleft" types self.popleftleftleftleftTimer = 0; // For "appearleftrightrightright" types self.appearleftrightrightrightTimer = 0; // For "appearrightleftleftleft" types self.appearrightleftleftleftTimer = 0; // For "jumprightrightrightright" types self.jumprightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpleftleftleftleft" types self.jumpleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "dashrightrightrightright" types self.dashrightrightrightrightTimer = 0; // For "dashleftleftleftleft" types self.dashleftleftleftleftTimer = 0; // For "circlerightrightrightright" types self.circlerightrightrightrightPhase = Math.random() * Math.PI * 2; // For "circleleftleftleftleft" types self.circleleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "zigzagrightrightrightright" types self.zigzagrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "zigzagleftleftleftleft" types self.zigzagleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "waverightrightrightright" types self.waverightrightrightrightPhase = Math.random() * Math.PI * 2; // For "waveleftleftleftleft" types self.waveleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "randomrightrightrightright" types self.randomrightrightrightrightTimer = 0; // For "randomleftleftleftleft" types self.randomleftleftleftleftTimer = 0; // For "pauserightrightrightright" types self.pauserightrightrightrightTimer = 0; self.isPausedRightRightRightRight = false; // For "pauseleftleftleftleft" types self.pauseleftleftleftleftTimer = 0; self.isPausedLeftLeftLeftLeft = false; // For "hiderightrightrightright" types self.hiderightrightrightrightTimer = 0; self.isHiddenRightRightRightRight = false; // For "hideleftleftleftleft" types self.hideleftleftleftleftTimer = 0; self.isHiddenLeftLeftLeftLeft = false; // For "fliprightrightrightright" types self.fliprightrightrightrightTimer = 0; self.isFlippedRightRightRightRight = false; // For "flipleftleftleftleft" types self.flipleftleftleftleftTimer = 0; self.isFlippedLeftLeftLeftLeft = false; // For "twirlrightrightrightright" types self.twirlrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "twirlleftleftleftleft" types self.twirlleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "driftrightrightrightright" types self.driftrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "driftleftleftleftleft" types self.driftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "shakerightrightrightright" types self.shakerightrightrightrightPhase = Math.random() * Math.PI * 2; // For "shakeleftleftleftleft" types self.shakeleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideupleftrightrightright" types self.slideupleftrightrightrightTimer = 0; // For "slideuprightleftleftleft" types self.slideuprightleftleftleftTimer = 0; // For "sprintrightrightrightright" types self.sprintrightrightrightrightTimer = 0; // For "sprintleftleftleftleft" types self.sprintleftleftleftleftTimer = 0; // For "hoverrightrightrightright" types self.hoverrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoverleftleftleftleft" types self.hoverleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bobrightrightrightright" types self.bobrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bobleftleftleftleft" types self.bobleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "sneakrightrightrightright" types self.sneakrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "sneakleftleftleftleft" types self.sneakleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "stomprightrightrightright" types self.stomprightrightrightrightPhase = Math.random() * Math.PI * 2; // For "stompleftleftleftleft" types self.stompleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "marchrightrightrightright" types self.marchrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "marchleftleftleftleft" types self.marchleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideleftrightrightrightright" types self.slideleftrightrightrightrightTimer = 0; // For "slitherleftrightrightrightright" types self.slitherleftrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoprightrightrightrightright" types self.hoprightrightrightrightrightTimer = 0; // For "hopleftleftleftleftleft" types self.hopleftleftleftleftleftTimer = 0; // For "jumpuprightrightrightright" types self.jumpuprightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpupleftleftleftleft" types self.jumpupleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "jumpdownrightrightrightright" types self.jumpdownrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpdownleftleftleftleft" types self.jumpdownleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "rollrightrightrightrightright" types self.rollrightrightrightrightrightSpin = 0; // For "rollleftleftleftleftleft" types self.rollleftleftleftleftleftSpin = 0; // For "zoomrightrightrightrightright" types self.zoomrightrightrightrightrightTimer = 0; // For "zoomleftleftleftleftleft" types self.zoomleftleftleftleftleftTimer = 0; // For "bounceuprightrightrightright" types self.bounceuprightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bounceupleftleftleftleft" types self.bounceupleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bouncedownrightrightrightright" types self.bouncedownrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bouncedownleftleftleftleft" types self.bouncedownleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatuprightrightrightright" types self.floatuprightrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatupleftleftleftleft" types self.floatupleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatdownrightrightrightright" types self.floatdownrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatdownleftleftleftleft" types self.floatdownleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "peekrightrightrightrightright" types self.peekrightrightrightrightrightTimer = 0; // For "peekleftleftleftleftleft" types self.peekleftleftleftleftleftTimer = 0; // For "poprightrightrightrightright" types self.poprightrightrightrightrightTimer = 0; // For "popleftleftleftleftleft" types self.popleftleftleftleftleftTimer = 0; // For "appearleftrightrightrightright" types self.appearleftrightrightrightrightTimer = 0; // For "appearrightleftleftleftleft" types self.appearrightleftleftleftleftTimer = 0; // For "jumprightrightrightrightright" types self.jumprightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpleftleftleftleftleft" types self.jumpleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "dashrightrightrightrightright" types self.dashrightrightrightrightrightTimer = 0; // For "dashleftleftleftleftleft" types self.dashleftleftleftleftleftTimer = 0; // For "circlerightrightrightrightright" types self.circlerightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "circleleftleftleftleftleft" types self.circleleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "zigzagrightrightrightrightright" types self.zigzagrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "zigzagleftleftleftleftleft" types self.zigzagleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "waverightrightrightrightright" types self.waverightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "waveleftleftleftleftleft" types self.waveleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "randomrightrightrightrightright" types self.randomrightrightrightrightrightTimer = 0; // For "randomleftleftleftleftleft" types self.randomleftleftleftleftleftTimer = 0; // For "pauserightrightrightrightright" types self.pauserightrightrightrightrightTimer = 0; self.isPausedRightRightRightRightRight = false; // For "pauseleftleftleftleftleft" types self.pauseleftleftleftleftleftTimer = 0; self.isPausedLeftLeftLeftLeftLeft = false; // For "hiderightrightrightrightright" types self.hiderightrightrightrightrightTimer = 0; self.isHiddenRightRightRightRightRight = false; // For "hideleftleftleftleftleft" types self.hideleftleftleftleftleftTimer = 0; self.isHiddenLeftLeftLeftLeftLeft = false; // For "fliprightrightrightrightright" types self.fliprightrightrightrightrightTimer = 0; self.isFlippedRightRightRightRightRight = false; // For "flipleftleftleftleftleft" types self.flipleftleftleftleftleftTimer = 0; self.isFlippedLeftLeftLeftLeftLeft = false; // For "twirlrightrightrightrightright" types self.twirlrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "twirlleftleftleftleftleft" types self.twirlleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "driftrightrightrightrightright" types self.driftrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "driftleftleftleftleftleft" types self.driftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "shakerightrightrightrightright" types self.shakerightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "shakeleftleftleftleftleft" types self.shakeleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideupleftrightrightrightright" types self.slideupleftrightrightrightrightTimer = 0; // For "slideuprightleftleftleftleft" types self.slideuprightleftleftleftleftTimer = 0; // For "sprintrightrightrightrightright" types self.sprintrightrightrightrightrightTimer = 0; // For "sprintleftleftleftleftleft" types self.sprintleftleftleftleftleftTimer = 0; // For "hoverrightrightrightrightright" types self.hoverrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoverleftleftleftleftleft" types self.hoverleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bobrightrightrightrightright" types self.bobrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bobleftleftleftleftleft" types self.bobleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "sneakrightrightrightrightright" types self.sneakrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "sneakleftleftleftleftleft" types self.sneakleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "stomprightrightrightrightright" types self.stomprightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "stompleftleftleftleftleft" types self.stompleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "marchrightrightrightrightright" types self.marchrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "marchleftleftleftleftleft" types self.marchleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideleftrightrightrightrightright" types self.slideleftrightrightrightrightrightTimer = 0; // For "slitherleftrightrightrightrightright" types self.slitherleftrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoprightrightrightrightrightright" types self.hoprightrightrightrightrightrightTimer = 0; // For "hopleftleftleftleftleftleft" types self.hopleftleftleftleftleftleftTimer = 0; // For "jumpuprightrightrightrightright" types self.jumpuprightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpupleftleftleftleftleft" types self.jumpupleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "jumpdownrightrightrightrightright" types self.jumpdownrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpdownleftleftleftleftleft" types self.jumpdownleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "rollrightrightrightrightrightright" types self.rollrightrightrightrightrightrightSpin = 0; // For "rollleftleftleftleftleftleft" types self.rollleftleftleftleftleftleftSpin = 0; // For "zoomrightrightrightrightrightright" types self.zoomrightrightrightrightrightrightTimer = 0; // For "zoomleftleftleftleftleftleft" types self.zoomleftleftleftleftleftleftTimer = 0; // For "bounceuprightrightrightrightright" types self.bounceuprightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bounceupleftleftleftleftleft" types self.bounceupleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bouncedownrightrightrightrightright" types self.bouncedownrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bouncedownleftleftleftleftleft" types self.bouncedownleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatuprightrightrightrightright" types self.floatuprightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatupleftleftleftleftleft" types self.floatupleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatdownrightrightrightrightright" types self.floatdownrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatdownleftleftleftleftleft" types self.floatdownleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "peekrightrightrightrightrightright" types self.peekrightrightrightrightrightrightTimer = 0; // For "peekleftleftleftleftleftleft" types self.peekleftleftleftleftleftleftTimer = 0; // For "poprightrightrightrightrightright" types self.poprightrightrightrightrightrightTimer = 0; // For "popleftleftleftleftleftleft" types self.popleftleftleftleftleftleftTimer = 0; // For "appearleftrightrightrightrightright" types self.appearleftrightrightrightrightrightTimer = 0; // For "appearrightleftleftleftleftleft" types self.appearrightleftleftleftleftleftTimer = 0; // For "jumprightrightrightrightrightright" types self.jumprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpleftleftleftleftleftleft" types self.jumpleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "dashrightrightrightrightrightright" types self.dashrightrightrightrightrightrightTimer = 0; // For "dashleftleftleftleftleftleft" types self.dashleftleftleftleftleftleftTimer = 0; // For "circlerightrightrightrightrightright" types self.circlerightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "circleleftleftleftleftleftleft" types self.circleleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "zigzagrightrightrightrightrightright" types self.zigzagrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "zigzagleftleftleftleftleftleft" types self.zigzagleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "waverightrightrightrightrightright" types self.waverightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "waveleftleftleftleftleftleft" types self.waveleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "randomrightrightrightrightrightright" types self.randomrightrightrightrightrightrightTimer = 0; // For "randomleftleftleftleftleftleft" types self.randomleftleftleftleftleftleftTimer = 0; // For "pauserightrightrightrightrightright" types self.pauserightrightrightrightrightrightTimer = 0; self.isPausedRightRightRightRightRightRight = false; // For "pauseleftleftleftleftleftleft" types self.pauseleftleftleftleftleftleftTimer = 0; self.isPausedLeftLeftLeftLeftLeftLeft = false; // For "hiderightrightrightrightrightright" types self.hiderightrightrightrightrightrightTimer = 0; self.isHiddenRightRightRightRightRightRight = false; // For "hideleftleftleftleftleftleft" types self.hideleftleftleftleftleftleftTimer = 0; self.isHiddenLeftLeftLeftLeftLeftLeft = false; // For "fliprightrightrightrightrightright" types self.fliprightrightrightrightrightrightTimer = 0; self.isFlippedRightRightRightRightRightRight = false; // For "flipleftleftleftleftleftleft" types self.flipleftleftleftleftleftleftTimer = 0; self.isFlippedLeftLeftLeftLeftLeftLeft = false; // For "twirlrightrightrightrightrightright" types self.twirlrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "twirlleftleftleftleftleftleft" types self.twirlleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "driftrightrightrightrightrightright" types self.driftrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "driftleftleftleftleftleftleft" types self.driftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "shakerightrightrightrightrightright" types self.shakerightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "shakeleftleftleftleftleftleft" types self.shakeleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideupleftrightrightrightrightright" types self.slideupleftrightrightrightrightrightTimer = 0; // For "slideuprightleftleftleftleftleft" types self.slideuprightleftleftleftleftleftTimer = 0; // For "sprintrightrightrightrightrightright" types self.sprintrightrightrightrightrightrightTimer = 0; // For "sprintleftleftleftleftleftleft" types self.sprintleftleftleftleftleftleftTimer = 0; // For "hoverrightrightrightrightrightright" types self.hoverrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoverleftleftleftleftleftleft" types self.hoverleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bobrightrightrightrightrightright" types self.bobrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bobleftleftleftleftleftleft" types self.bobleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "sneakrightrightrightrightrightright" types self.sneakrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "sneakleftleftleftleftleftleft" types self.sneakleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "stomprightrightrightrightrightright" types self.stomprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "stompleftleftleftleftleftleft" types self.stompleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "marchrightrightrightrightrightright" types self.marchrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "marchleftleftleftleftleftleft" types self.marchleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideleftrightrightrightrightrightright" types self.slideleftrightrightrightrightrightrightTimer = 0; // For "slitherleftrightrightrightrightrightright" types self.slitherleftrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoprightrightrightrightrightrightright" types self.hoprightrightrightrightrightrightrightTimer = 0; // For "hopleftleftleftleftleftleftleft" types self.hopleftleftleftleftleftleftleftTimer = 0; // For "jumpuprightrightrightrightrightright" types self.jumpuprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpupleftleftleftleftleftleft" types self.jumpupleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "jumpdownrightrightrightrightrightright" types self.jumpdownrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpdownleftleftleftleftleftleft" types self.jumpdownleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "rollrightrightrightrightrightrightright" types self.rollrightrightrightrightrightrightrightSpin = 0; // For "rollleftleftleftleftleftleftleft" types self.rollleftleftleftleftleftleftleftSpin = 0; // For "zoomrightrightrightrightrightrightright" types self.zoomrightrightrightrightrightrightrightTimer = 0; // For "zoomleftleftleftleftleftleftleft" types self.zoomleftleftleftleftleftleftleftTimer = 0; // For "bounceuprightrightrightrightrightright" types self.bounceuprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bounceupleftleftleftleftleftleft" types self.bounceupleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bouncedownrightrightrightrightrightright" types self.bouncedownrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bouncedownleftleftleftleftleftleft" types self.bouncedownleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatuprightrightrightrightrightright" types self.floatuprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatupleftleftleftleftleftleft" types self.floatupleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatdownrightrightrightrightrightright" types self.floatdownrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatdownleftleftleftleftleftleft" types self.floatdownleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "peekrightrightrightrightrightrightright" types self.peekrightrightrightrightrightrightrightTimer = 0; // For "peekleftleftleftleftleftleftleft" types self.peekleftleftleftleftleftleftleftTimer = 0; // For "poprightrightrightrightrightrightright" types self.poprightrightrightrightrightrightrightTimer = 0; // For "popleftleftleftleftleftleftleft" types self.popleftleftleftleftleftleftleftTimer = 0; // For "appearleftrightrightrightrightrightright" types self.appearleftrightrightrightrightrightrightTimer = 0; // For "appearrightleftleftleftleftleftleft" types self.appearrightleftleftleftleftleftleftTimer = 0; // For "jumprightrightrightrightrightrightright" types self.jumprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpleftleftleftleftleftleftleft" types self.jumpleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "dashrightrightrightrightrightrightright" types self.dashrightrightrightrightrightrightrightTimer = 0; // For "dashleftleftleftleftleftleftleft" types self.dashleftleftleftleftleftleftleftTimer = 0; // For "circlerightrightrightrightrightrightright" types self.circlerightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "circleleftleftleftleftleftleftleft" types self.circleleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "zigzagrightrightrightrightrightrightright" types self.zigzagrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "zigzagleftleftleftleftleftleftleft" types self.zigzagleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "waverightrightrightrightrightrightright" types self.waverightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "waveleftleftleftleftleftleftleft" types self.waveleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "randomrightrightrightrightrightrightright" types self.randomrightrightrightrightrightrightrightTimer = 0; // For "randomleftleftleftleftleftleftleft" types self.randomleftleftleftleftleftleftleftTimer = 0; // For "pauserightrightrightrightrightrightright" types self.pauserightrightrightrightrightrightrightTimer = 0; self.isPausedRightRightRightRightRightRightRight = false; // For "pauseleftleftleftleftleftleftleft" types self.pauseleftleftleftleftleftleftleftTimer = 0; self.isPausedLeftLeftLeftLeftLeftLeftLeft = false; // For "hiderightrightrightrightrightrightright" types self.hiderightrightrightrightrightrightrightTimer = 0; self.isHiddenRightRightRightRightRightRightRight = false; // For "hideleftleftleftleftleftleftleft" types self.hideleftleftleftleftleftleftleftTimer = 0; self.isHiddenLeftLeftLeftLeftLeftLeftLeft = false; // For "fliprightrightrightrightrightrightright" types self.fliprightrightrightrightrightrightrightTimer = 0; self.isFlippedRightRightRightRightRightRightRight = false; // For "flipleftleftleftleftleftleftleft" types self.flipleftleftleftleftleftleftleftTimer = 0; self.isFlippedLeftLeftLeftLeftLeftLeftLeft = false; // For "twirlrightrightrightrightrightrightright" types self.twirlrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "twirlleftleftleftleftleftleftleft" types self.twirlleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "driftrightrightrightrightrightrightright" types self.driftrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "driftleftleftleftleftleftleftleft" types self.driftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "shakerightrightrightrightrightrightright" types self.shakerightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "shakeleftleftleftleftleftleftleft" types self.shakeleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideupleftrightrightrightrightrightright" types self.slideupleftrightrightrightrightrightrightTimer = 0; // For "slideuprightleftleftleftleftleftleft" types self.slideuprightleftleftleftleftleftleftTimer = 0; // For "sprintrightrightrightrightrightrightright" types self.sprintrightrightrightrightrightrightrightTimer = 0; // For "sprintleftleftleftleftleftleftleft" types self.sprintleftleftleftleftleftleftleftTimer = 0; // For "hoverrightrightrightrightrightrightright" types self.hoverrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoverleftleftleftleftleftleftleft" types self.hoverleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bobrightrightrightrightrightrightright" types self.bobrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bobleftleftleftleftleftleftleft" types self.bobleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "sneakrightrightrightrightrightrightright" types self.sneakrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "sneakleftleftleftleftleftleftleft" types self.sneakleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "stomprightrightrightrightrightrightright" types self.stomprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "stompleftleftleftleftleftleftleft" types self.stompleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "marchrightrightrightrightrightrightright" types self.marchrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "marchleftleftleftleftleftleftleft" types self.marchleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideleftrightrightrightrightrightrightright" types self.slideleftrightrightrightrightrightrightrightTimer = 0; // For "slitherleftrightrightrightrightrightrightright" types self.slitherleftrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoprightrightrightrightrightrightrightright" types self.hoprightrightrightrightrightrightrightrightTimer = 0; // For "hopleftleftleftleftleftleftleftleft" types self.hopleftleftleftleftleftleftleftleftTimer = 0; // For "jumpuprightrightrightrightrightrightright" types self.jumpuprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpupleftleftleftleftleftleftleft" types self.jumpupleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "jumpdownrightrightrightrightrightrightright" types self.jumpdownrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpdownleftleftleftleftleftleftleft" types self.jumpdownleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "rollrightrightrightrightrightrightrightright" types self.rollrightrightrightrightrightrightrightrightSpin = 0; // For "rollleftleftleftleftleftleftleftleft" types self.rollleftleftleftleftleftleftleftleftSpin = 0; // For "zoomrightrightrightrightrightrightrightright" types self.zoomrightrightrightrightrightrightrightrightTimer = 0; // For "zoomleftleftleftleftleftleftleftleft" types self.zoomleftleftleftleftleftleftleftleftTimer = 0; // For "bounceuprightrightrightrightrightrightright" types self.bounceuprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bounceupleftleftleftleftleftleftleft" types self.bounceupleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bouncedownrightrightrightrightrightrightright" types self.bouncedownrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bouncedownleftleftleftleftleftleftleft" types self.bouncedownleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatuprightrightrightrightrightrightright" types self.floatuprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatupleftleftleftleftleftleftleft" types self.floatupleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "floatdownrightrightrightrightrightrightright" types self.floatdownrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "floatdownleftleftleftleftleftleftleft" types self.floatdownleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "peekrightrightrightrightrightrightrightright" types self.peekrightrightrightrightrightrightrightrightTimer = 0; // For "peekleftleftleftleftleftleftleftleft" types self.peekleftleftleftleftleftleftleftleftTimer = 0; // For "poprightrightrightrightrightrightrightright" types self.poprightrightrightrightrightrightrightrightTimer = 0; // For "popleftleftleftleftleftleftleftleft" types self.popleftleftleftleftleftleftleftleftTimer = 0; // For "appearleftrightrightrightrightrightright" types self.appearleftrightrightrightrightrightrightrightTimer = 0; // For "appearrightleftleftleftleftleftleftleft" types self.appearrightleftleftleftleftleftleftleftTimer = 0; // For "jumprightrightrightrightrightrightrightright" types self.jumprightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "jumpleftleftleftleftleftleftleftleft" types self.jumpleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "dashrightrightrightrightrightrightrightright" types self.dashrightrightrightrightrightrightrightrightTimer = 0; // For "dashleftleftleftleftleftleftleftleft" types self.dashleftleftleftleftleftleftleftleftTimer = 0; // For "circlerightrightrightrightrightrightrightright" types self.circlerightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "circleleftleftleftleftleftleftleftleft" types self.circleleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "zigzagrightrightrightrightrightrightrightright" types self.zigzagrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "zigzagleftleftleftleftleftleftleftleft" types self.zigzagleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "waverightrightrightrightrightrightrightright" types self.waverightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "waveleftleftleftleftleftleftleftleft" types self.waveleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "randomrightrightrightrightrightrightrightright" types self.randomrightrightrightrightrightrightrightrightTimer = 0; // For "randomleftleftleftleftleftleftleftleft" types self.randomleftleftleftleftleftleftleftleftTimer = 0; // For "pauserightrightrightrightrightrightrightright" types self.pauserightrightrightrightrightrightrightrightTimer = 0; self.isPausedRightRightRightRightRightRightRightRight = false; // For "pauseleftleftleftleftleftleftleftleft" types self.pauseleftleftleftleftleftleftleftleftTimer = 0; self.isPausedLeftLeftLeftLeftLeftLeftLeftLeft = false; // For "hiderightrightrightrightrightrightrightright" types self.hiderightrightrightrightrightrightrightrightTimer = 0; self.isHiddenRightRightRightRightRightRightRightRight = false; // For "hideleftleftleftleftleftleftleftleft" types self.hideleftleftleftleftleftleftleftleftTimer = 0; self.isHiddenLeftLeftLeftLeftLeftLeftLeftLeft = false; // For "fliprightrightrightrightrightrightrightright" types self.fliprightrightrightrightrightrightrightrightTimer = 0; self.isFlippedRightRightRightRightRightRightRightRight = false; // For "flipleftleftleftleftleftleftleftleft" types self.flipleftleftleftleftleftleftleftleftTimer = 0; self.isFlippedLeftLeftLeftLeftLeftLeftLeftLeft = false; // For "twirlrightrightrightrightrightrightrightright" types self.twirlrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "twirlleftleftleftleftleftleftleftleft" types self.twirlleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "driftrightrightrightrightrightrightrightright" types self.driftrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "driftleftleftleftleftleftleftleftleft" types self.driftleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "shakerightrightrightrightrightrightrightright" types self.shakerightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "shakeleftleftleftleftleftleftleftleft" types self.shakeleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "slideupleftrightrightrightrightrightrightright" types self.slideupleftrightrightrightrightrightrightrightTimer = 0; // For "slideuprightleftleftleftleftleftleftleft" types self.slideuprightleftleftleftleftleftleftleftTimer = 0; // For "sprintrightrightrightrightrightrightrightright" types self.sprintrightrightrightrightrightrightrightrightTimer = 0; // For "sprintleftleftleftleftleftleftleftleft" types self.sprintleftleftleftleftleftleftleftleftTimer = 0; // For "hoverrightrightrightrightrightrightrightright" types self.hoverrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "hoverleftleftleftleftleftleftleftleft" types self.hoverleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "bobrightrightrightrightrightrightrightright" types self.bobrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "bobleftleftleftleftleftleftleftleft" types self.bobleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "sneakrightrightrightrightrightrightrightright" types self.sneakrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "sneakleftleftleftleftleftleftleftleft" types self.sneakleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "stomprightrightrightrightrightrightrightright" types self.stomprightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "stompleftleftleftleftleftleftleftleft" types self.stompleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // For "marchrightrightrightrightrightrightrightright" types self.marchrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2; // For "marchleftleftleftleftleftleftleftleft" types self.marchleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2; // Movement update self.update = function () { // Only move if not paused/hidden if (self.isHidden) return; // Movement patterns var t = LK.ticks; var baseY = self.baseY || self.y; var baseX = self.baseX || self.x; if (self.moveType === "walk") { self.x += self.speed * self.direction; // Bounce off edges if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "hop") { self.x += self.speed * self.direction; self.hopTimer += 1; self.y = baseY - Math.abs(Math.sin(self.hopTimer * 0.1)) * 60; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "fly") { self.x += self.speed * self.direction; self.y = baseY - Math.sin(t * 0.05 + self.flyPhase) * 80; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "roll") { self.x += self.speed * self.direction; asset.rotation += 0.1 * self.direction; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "wiggle") { self.x += self.speed * self.direction; asset.y = Math.sin(t * 0.2 + self.wigglePhase) * 10; asset.rotation = Math.sin(t * 0.1 + self.wigglePhase) * 0.2; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "slide") { self.slideTimer += 1; self.x += self.speed * self.direction * (Math.abs(Math.sin(self.slideTimer * 0.05)) + 0.5); if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "bounce") { self.x += self.speed * self.direction; self.y = baseY - Math.abs(Math.sin(t * 0.15 + self.bouncePhase)) * 40; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "float") { self.x += self.speed * self.direction * 0.5; self.y = baseY - Math.sin(t * 0.07 + self.floatPhase) * 30; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "crawl") { self.x += self.speed * self.direction * 0.7; asset.y = Math.sin(t * 0.25 + self.crawlPhase) * 5; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "zoom") { self.zoomTimer += 1; self.x += self.speed * self.direction * (1 + Math.abs(Math.sin(self.zoomTimer * 0.2))); if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "spin") { self.x += self.speed * self.direction * 0.8; asset.rotation += self.spinSpeed * self.direction; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "sway") { self.x += self.speed * self.direction * 0.6; asset.x = Math.sin(t * 0.15 + self.swayPhase) * 20; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "wave") { self.x += self.speed * self.direction * 0.7; self.y = baseY - Math.sin(t * 0.12 + self.wavePhase) * 25; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else if (self.moveType === "zigzag") { self.x += self.speed * self.direction; self.y = baseY + Math.sin(t * 0.18 + self.zigzagPhase) * 40; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } else { // Default: walk self.x += self.speed * self.direction; if (self.x < self.width / 2) { self.x = self.width / 2; self.direction = 1; } if (self.x > 2048 - self.width / 2) { self.x = 2048 - self.width / 2; self.direction = -1; } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x8fd97b // Grassy green }); /**** * Game Code ****/ // Animal and object assets for all PARADE_ITEMS // Cow asset: white ellipse, large // List of 30 spawnable items: word, assetId, movement type, color, shape, size // Chihuahua asset (replace id with actual asset id) function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } var PARADE_ITEMS = [{ word: "cat", assetId: "cat", moveType: "walk", color: 0xcccccc, shape: "ellipse", width: 120, height: 80 }, { word: "dog", assetId: "dog", moveType: "walk", color: 0x996633, shape: "ellipse", width: 140, height: 90 }, { word: "rabbit", assetId: "rabbit", moveType: "hop", color: 0xffffff, shape: "ellipse", width: 100, height: 70 }, { word: "duck", assetId: "duck", moveType: "waddle", color: 0xffee44, shape: "ellipse", width: 110, height: 80 }, { word: "sheep", assetId: "sheep", moveType: "walk", color: 0xf0f0f0, shape: "ellipse", width: 130, height: 90 }, { word: "pig", assetId: "pig", moveType: "wiggle", color: 0xffb6c1, shape: "ellipse", width: 120, height: 80 }, { word: "cow", assetId: "cow", moveType: "walk", color: 0xffffff, shape: "ellipse", width: 160, height: 100 }, { word: "horse", assetId: "horse", moveType: "gallop", color: 0x8b5a2b, shape: "ellipse", width: 170, height: 100 }, { word: "chicken", assetId: "chicken", moveType: "peck", color: 0xfff8dc, shape: "ellipse", width: 90, height: 60 }, { word: "goat", assetId: "goat", moveType: "walk", color: 0xe0e0e0, shape: "ellipse", width: 120, height: 80 }, { word: "frog", assetId: "frog", moveType: "hop", color: 0x44cc44, shape: "ellipse", width: 80, height: 60 }, { word: "mouse", assetId: "mouse", moveType: "scurry", color: 0xaaaaaa, shape: "ellipse", width: 70, height: 40 }, { word: "fox", assetId: "fox", moveType: "sneak", color: 0xff6600, shape: "ellipse", width: 110, height: 70 }, { word: "owl", assetId: "owl", moveType: "fly", color: 0x888888, shape: "ellipse", width: 100, height: 80 }, { word: "bee", assetId: "bee", moveType: "zigzag", color: 0xffee00, shape: "ellipse", width: 60, height: 40 }, { word: "butterfly", assetId: "butterfly", moveType: "wave", color: 0xff99ff, shape: "ellipse", width: 80, height: 60 }, { word: "chihuahua", assetId: "chihuahua", moveType: "walk", color: 0xf5e6da, shape: "ellipse", width: 90, height: 60 }, { word: "snail", assetId: "snail", moveType: "crawl", color: 0xcccc99, shape: "ellipse", width: 70, height: 50 }, { word: "turtle", assetId: "turtle", moveType: "crawl", color: 0x228b22, shape: "ellipse", width: 100, height: 70 }, { word: "fish", assetId: "fish", moveType: "swim", color: 0x3399ff, shape: "ellipse", width: 90, height: 50 }, { word: "bird", assetId: "bird", moveType: "fly", color: 0x87ceeb, shape: "ellipse", width: 90, height: 60 }, { word: "lion", assetId: "lion", moveType: "walk", color: 0xf4c542, shape: "ellipse", width: 150, height: 100 }, { word: "panda", assetId: "panda", moveType: "walk", color: 0xffffff, shape: "ellipse", width: 140, height: 100 }, { word: "elephant", assetId: "elephant", moveType: "walk", color: 0xaaaaaa, shape: "ellipse", width: 200, height: 120 }, { word: "giraffe", assetId: "giraffe", moveType: "walk", color: 0xffe066, shape: "ellipse", width: 120, height: 180 }, { word: "monkey", assetId: "monkey", moveType: "wiggle", color: 0x8d5524, shape: "ellipse", width: 110, height: 90 }, { word: "penguin", assetId: "penguin", moveType: "waddle", color: 0x222222, shape: "ellipse", width: 90, height: 100 }, { word: "koala", assetId: "koala", moveType: "walk", color: 0xcccccc, shape: "ellipse", width: 100, height: 90 }, { word: "deer", assetId: "deer", moveType: "walk", color: 0xc68642, shape: "ellipse", width: 130, height: 100 }, { word: "camel", assetId: "camel", moveType: "walk", color: 0xd2b48c, shape: "ellipse", width: 170, height: 110 }, { word: "zebra", assetId: "zebra", moveType: "walk", color: 0xffffff, shape: "ellipse", width: 150, height: 100 }, { word: "car", assetId: "car", moveType: "roll", color: 0x3366cc, shape: "box", width: 140, height: 60 }, { word: "bus", assetId: "bus", moveType: "roll", color: 0xffcc00, shape: "box", width: 200, height: 80 }, { word: "train", assetId: "train", moveType: "roll", color: 0x888888, shape: "box", width: 220, height: 70 }, { word: "ball", assetId: "ball", moveType: "bounce", color: 0xff3333, shape: "ellipse", width: 80, height: 80 }, { word: "robot", assetId: "robot", moveType: "slide", color: 0xcccccc, shape: "box", width: 100, height: 100 }, { word: "apple", assetId: "apple", moveType: "wiggle", color: 0xff2222, shape: "ellipse", width: 60, height: 60 }, { word: "banana", assetId: "banana", moveType: "wiggle", color: 0xffee00, shape: "ellipse", width: 80, height: 40 }, { word: "star", assetId: "star", moveType: "float", color: 0xffff00, shape: "ellipse", width: 70, height: 70 }, { word: "cloud", assetId: "cloud", moveType: "float", color: 0xffffff, shape: "ellipse", width: 180, height: 90 }, { word: "moon", assetId: "moon", moveType: "float", color: 0xffffcc, shape: "ellipse", width: 100, height: 100 }]; // Map for quick lookup var PARADE_WORDS = {}; for (var i = 0; i < PARADE_ITEMS.length; i++) { PARADE_WORDS[PARADE_ITEMS[i].word] = PARADE_ITEMS[i]; } // Track which items have been discovered var discovered = {}; // Track all parade items on screen var paradeItems = []; // Initialize assets (shapes) for all items for (var i = 0; i < PARADE_ITEMS.length; i++) { var item = PARADE_ITEMS[i]; } // Draw the "ground" as a green rectangle at the bottom var ground = LK.getAsset('ground', { width: 2048, height: 220, color: 0x5cb85c, shape: "box", anchorX: 0, anchorY: 1, x: 0, y: 2732 }); game.addChild(ground); // Title text var titleTxt = new Text2("Type & Spawn: Animal Parade", { size: 90, fill: 0xFFFFFF }); titleTxt.anchor.set(0.5, 0); LK.gui.top.addChild(titleTxt); // Discovered counter var discoveredTxt = new Text2("Discovered: 0/30", { size: 60, fill: 0xFFFFFF }); discoveredTxt.anchor.set(0.5, 0); LK.gui.top.addChild(discoveredTxt); // Instructions var instrTxt = new Text2("Type an animal name to spawn it", { size: 60, fill: 0xFFFFFF }); instrTxt.anchor.set(0.5, 0); LK.gui.bottom.addChild(instrTxt); // Input field (simulated with a Text2 and a "Spawn" button) var inputWord = ""; // Show typed letters above the keyboard var inputDisplayTxt = new Text2("", { size: 90, fill: 0x222222 }); inputDisplayTxt.anchor.set(0.5, 1.0); inputDisplayTxt.x = 2048 / 2; inputDisplayTxt.y = 2732 - 700; // Just above the keyboard rows game.addChild(inputDisplayTxt); var inputTxt = new Text2("", { size: 80, fill: 0x222222 }); inputTxt.anchor.set(0.5, 0.5); inputTxt.x = 2048 / 2; inputTxt.y = 2732 - 350; game.addChild(inputTxt); // "Spawn" button var spawnBtn = LK.getAsset('spawnBtn', { width: 320, height: 120, color: 0x4a90e2, shape: "box", anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 - 850 // Move above the keyboard rows }); game.addChild(spawnBtn); var spawnBtnTxt = new Text2("Spawn", { size: 70, fill: 0xFFFFFF }); spawnBtnTxt.anchor.set(0.5, 0.5); spawnBtnTxt.x = spawnBtn.x; spawnBtnTxt.y = spawnBtn.y; game.addChild(spawnBtnTxt); // On-screen keyboard (letters A-Z, backspace, space) var keyboardLetters = ["QWERTYUIOP", "ASDFGHJKL", "ZXCVBNM"]; var keyboardKeys = []; var keySize = 120; var keyMargin = 18; var kbStartY = 2732 - 650; for (var row = 0; row < keyboardLetters.length; row++) { var letters = keyboardLetters[row]; var y = kbStartY + row * (keySize + keyMargin); var rowWidth = letters.length * (keySize + keyMargin) - keyMargin; var x0 = (2048 - rowWidth) / 2 + keySize / 2; for (var col = 0; col < letters.length; col++) { var ch = letters[col]; var key = LK.getAsset("key_" + ch, { width: keySize, height: keySize, color: 0xffffff, shape: "box", anchorX: 0.5, anchorY: 0.5, x: x0 + col * (keySize + keyMargin), y: y }); game.addChild(key); var keyTxt = new Text2(ch, { size: 60, fill: 0x222222 }); keyTxt.anchor.set(0.5, 0.5); keyTxt.x = key.x; keyTxt.y = key.y; game.addChild(keyTxt); keyboardKeys.push({ key: key, letter: ch }); } } // Spacebar var spaceKey = LK.getAsset('key_space', { width: keySize * 4 + keyMargin * 3, height: keySize, color: 0xffffff, shape: "box", anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: kbStartY + 3 * (keySize + keyMargin) }); game.addChild(spaceKey); var spaceTxt = new Text2("SPACE", { size: 50, fill: 0x222222 }); spaceTxt.anchor.set(0.5, 0.5); spaceTxt.x = spaceKey.x; spaceTxt.y = spaceKey.y; game.addChild(spaceTxt); // Backspace var backKey = LK.getAsset('key_back', { width: keySize * 2 + keyMargin, height: keySize, color: 0xffffff, shape: "box", anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 + 350, y: kbStartY + 3 * (keySize + keyMargin) }); game.addChild(backKey); var backTxt = new Text2("⌫", { size: 60, fill: 0x222222 }); backTxt.anchor.set(0.5, 0.5); backTxt.x = backKey.x; backTxt.y = backKey.y; game.addChild(backTxt); // Clear button var clearBtn = LK.getAsset('key_clear', { width: keySize * 2 + keyMargin, height: keySize, color: 0xffffff, shape: "box", anchorX: 0.5, anchorY: 0.5, x: 2048 / 2 - 350, y: kbStartY + 3 * (keySize + keyMargin) }); game.addChild(clearBtn); var clearTxt = new Text2("Clear", { size: 50, fill: 0x222222 }); clearTxt.anchor.set(0.5, 0.5); clearTxt.x = clearBtn.x; clearTxt.y = clearBtn.y; game.addChild(clearTxt); // Keyboard input handling function handleKeyPress(ch) { if (inputWord.length < 16) { inputWord += ch; inputTxt.setText(inputWord); inputDisplayTxt.setText(inputWord); } } function handleBackspace() { inputWord = inputWord.slice(0, -1); inputTxt.setText(inputWord); inputDisplayTxt.setText(inputWord); } function handleSpace() { if (inputWord.length < 16) { inputWord += " "; inputTxt.setText(inputWord); inputDisplayTxt.setText(inputWord); } } function handleSpawn() { var word = inputWord.trim().toLowerCase(); if (PARADE_WORDS[word]) { spawnParadeItem(word); inputWord = ""; inputTxt.setText(""); inputDisplayTxt.setText(""); } else { // Flash input red for 500ms tween(inputTxt, { tint: 0xff3333 }, { duration: 100, onFinish: function onFinish() { tween(inputTxt, { tint: 0x222222 }, { duration: 400 }); } }); } } // Attach event listeners to keys for (var i = 0; i < keyboardKeys.length; i++) { (function (keyObj) { keyObj.key.down = function (x, y, obj) { handleKeyPress(keyObj.letter); }; })(keyboardKeys[i]); } spaceKey.down = function (x, y, obj) { handleSpace(); }; backKey.down = function (x, y, obj) { handleBackspace(); }; clearBtn.down = function (x, y, obj) { // Remove all parade items from the field for (var i = paradeItems.length - 1; i >= 0; i--) { if (paradeItems[i] && paradeItems[i].destroy) { paradeItems[i].destroy(); } paradeItems.splice(i, 1); } }; spawnBtn.down = function (x, y, obj) { handleSpawn(); }; inputTxt.down = function (x, y, obj) { // No-op, but could focus input if we had a real input field }; // Spawn a parade item function spawnParadeItem(word) { var item = PARADE_WORDS[word]; // Mark as discovered if (!discovered[word]) { discovered[word] = true; updateDiscoveredTxt(); // Flash discovered text green tween(discoveredTxt, { tint: 0x44ff44 }, { duration: 200, onFinish: function onFinish() { tween(discoveredTxt, { tint: 0xffffff }, { duration: 400 }); } }); } // Create ParadeItem // Use the correct assetId for cow (and all items) var parade = new ParadeItem({ assetId: item.assetId }); parade.moveType = getMoveType(item.moveType); parade.width = item.width; parade.height = item.height; // Place at random x along the ground, y at ground level parade.x = Math.random() * (2048 - parade.width) + parade.width / 2; parade.y = 2732 - 220 + 10; // Just above ground parade.baseY = parade.y; parade.baseX = parade.x; paradeItems.push(parade); game.addChild(parade); // Animate in (pop up) parade.scaleX = parade.scaleY = 0.1; tween(parade, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.bounceOut }); } // Update discovered text function updateDiscoveredTxt() { var count = 0; for (var k in discovered) if (discovered[k]) count++; discoveredTxt.setText("Discovered: " + count + "/40"); // Celebrate if all 40 discovered! if (count === 40) { // Flash the whole screen gold for 1s LK.effects.flashScreen(0xffe066, 1000); // Animate discoveredTxt rainbow tween(discoveredTxt, { tint: 0xff00ff }, { duration: 200, onFinish: function onFinish() { tween(discoveredTxt, { tint: 0x00ffff }, { duration: 200, onFinish: function onFinish() { tween(discoveredTxt, { tint: 0xffffff }, { duration: 200 }); } }); } }); } } // Map movement type string to ParadeItem moveType function getMoveType(type) { // Map some fun types to our implemented types if (type === "waddle" || type === "gallop" || type === "scurry" || type === "peck" || type === "sneak" || type === "swim") return "walk"; return type; } // Parade item update game.update = function () { for (var i = 0; i < paradeItems.length; i++) { paradeItems[i].update(); } }; // Show all discovered items on game over game.gameOver = function () { // Not needed, handled by LK }; // Show all discovered items on win game.youWin = function () { // Not needed, handled by LK };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Animal/Object class
var ParadeItem = Container.expand(function () {
var self = Container.call(this);
// Ensure assetId is set before attachAsset
if (typeof self.assetId === "undefined" && _typeof(arguments[0]) === "object" && arguments[0].assetId) {
self.assetId = arguments[0].assetId;
}
// Fallback to a default asset if assetId is still not set
if (typeof self.assetId === "undefined") {
// Do not fallback to 'cat', let assetId be undefined if not set
}
// Attach the asset for this item
var asset = self.attachAsset(self.assetId, {
anchorX: 0.5,
anchorY: 1.0 // bottom center, so it "stands" on the ground
});
// Movement pattern: set by type
self.moveType = self.moveType || "walk";
self.speed = self.speed || 2 + Math.random() * 2;
self.direction = self.direction || (Math.random() < 0.5 ? 1 : -1); // 1: right, -1: left
// For "hop" and "fly" types
self.hopTimer = 0;
self.flyPhase = Math.random() * Math.PI * 2;
// For "roll" types
self.spin = 0;
// For "wiggle" types
self.wigglePhase = Math.random() * Math.PI * 2;
// For "slide" types
self.slideTimer = 0;
// For "bounce" types
self.bouncePhase = Math.random() * Math.PI * 2;
// For "float" types
self.floatPhase = Math.random() * Math.PI * 2;
// For "crawl" types
self.crawlPhase = Math.random() * Math.PI * 2;
// For "zoom" types
self.zoomTimer = 0;
// For "spin" types
self.spinSpeed = 0.01 + Math.random() * 0.02;
// For "sway" types
self.swayPhase = Math.random() * Math.PI * 2;
// For "peek" types
self.peekTimer = 0;
self.isPeeking = false;
// For "pop" types
self.popTimer = 0;
self.isPopped = false;
// For "appear" types
self.appearTimer = 0;
self.hasAppeared = false;
// For "jump" types
self.jumpPhase = Math.random() * Math.PI * 2;
// For "dash" types
self.dashTimer = 0;
// For "circle" types
self.circlePhase = Math.random() * Math.PI * 2;
// For "zigzag" types
self.zigzagPhase = Math.random() * Math.PI * 2;
// For "wave" types
self.wavePhase = Math.random() * Math.PI * 2;
// For "random" types
self.randomTimer = 0;
// For "pause" types
self.pauseTimer = 0;
self.isPaused = false;
// For "hide" types
self.hideTimer = 0;
self.isHidden = false;
// For "flip" types
self.flipTimer = 0;
self.isFlipped = false;
// For "twirl" types
self.twirlPhase = Math.random() * Math.PI * 2;
// For "drift" types
self.driftPhase = Math.random() * Math.PI * 2;
// For "shake" types
self.shakePhase = Math.random() * Math.PI * 2;
// For "slideup" types
self.slideupTimer = 0;
// For "sprint" types
self.sprintTimer = 0;
// For "hover" types
self.hoverPhase = Math.random() * Math.PI * 2;
// For "bob" types
self.bobPhase = Math.random() * Math.PI * 2;
// For "sneak" types
self.sneakPhase = Math.random() * Math.PI * 2;
// For "stomp" types
self.stompPhase = Math.random() * Math.PI * 2;
// For "march" types
self.marchPhase = Math.random() * Math.PI * 2;
// For "slideleft" types
self.slideleftTimer = 0;
// For "slither" types
self.slitherPhase = Math.random() * Math.PI * 2;
// For "hopright" types
self.hoprightTimer = 0;
// For "hopleft" types
self.hopleftTimer = 0;
// For "jumpup" types
self.jumpupPhase = Math.random() * Math.PI * 2;
// For "jumpdown" types
self.jumpdownPhase = Math.random() * Math.PI * 2;
// For "rollright" types
self.rollrightSpin = 0;
// For "rollleft" types
self.rollleftSpin = 0;
// For "zoomright" types
self.zoomrightTimer = 0;
// For "zoomleft" types
self.zoomleftTimer = 0;
// For "bounceup" types
self.bounceupPhase = Math.random() * Math.PI * 2;
// For "bouncedown" types
self.bouncedownPhase = Math.random() * Math.PI * 2;
// For "floatup" types
self.floatupPhase = Math.random() * Math.PI * 2;
// For "floatdown" types
self.floatdownPhase = Math.random() * Math.PI * 2;
// For "peekright" types
self.peekrightTimer = 0;
// For "peekleft" types
self.peekleftTimer = 0;
// For "popright" types
self.poprightTimer = 0;
// For "popleft" types
self.popleftTimer = 0;
// For "appearleft" types
self.appearleftTimer = 0;
// For "appearright" types
self.appearrightTimer = 0;
// For "jumpright" types
self.jumprightPhase = Math.random() * Math.PI * 2;
// For "jumpleft" types
self.jumpleftPhase = Math.random() * Math.PI * 2;
// For "dashright" types
self.dashrightTimer = 0;
// For "dashleft" types
self.dashleftTimer = 0;
// For "circleright" types
self.circlerightPhase = Math.random() * Math.PI * 2;
// For "circleleft" types
self.circleleftPhase = Math.random() * Math.PI * 2;
// For "zigzagright" types
self.zigzagrightPhase = Math.random() * Math.PI * 2;
// For "zigzagleft" types
self.zigzagleftPhase = Math.random() * Math.PI * 2;
// For "waveright" types
self.waverightPhase = Math.random() * Math.PI * 2;
// For "waveleft" types
self.waveleftPhase = Math.random() * Math.PI * 2;
// For "randomright" types
self.randomrightTimer = 0;
// For "randomleft" types
self.randomleftTimer = 0;
// For "pauseright" types
self.pauserightTimer = 0;
self.isPausedRight = false;
// For "pauseleft" types
self.pauseleftTimer = 0;
self.isPausedLeft = false;
// For "hideright" types
self.hiderightTimer = 0;
self.isHiddenRight = false;
// For "hideleft" types
self.hideleftTimer = 0;
self.isHiddenLeft = false;
// For "flipright" types
self.fliprightTimer = 0;
self.isFlippedRight = false;
// For "flipleft" types
self.flipleftTimer = 0;
self.isFlippedLeft = false;
// For "twirlright" types
self.twirlrightPhase = Math.random() * Math.PI * 2;
// For "twirlleft" types
self.twirlleftPhase = Math.random() * Math.PI * 2;
// For "driftright" types
self.driftrightPhase = Math.random() * Math.PI * 2;
// For "driftleft" types
self.driftleftPhase = Math.random() * Math.PI * 2;
// For "shakeright" types
self.shakerightPhase = Math.random() * Math.PI * 2;
// For "shakeleft" types
self.shakeleftPhase = Math.random() * Math.PI * 2;
// For "slideupright" types
self.slideuprightTimer = 0;
// For "slideupleft" types
self.slideupleftTimer = 0;
// For "sprintright" types
self.sprintrightTimer = 0;
// For "sprintleft" types
self.sprintleftTimer = 0;
// For "hoverright" types
self.hoverrightPhase = Math.random() * Math.PI * 2;
// For "hoverleft" types
self.hoverleftPhase = Math.random() * Math.PI * 2;
// For "bobright" types
self.bobrightPhase = Math.random() * Math.PI * 2;
// For "bobleft" types
self.bobleftPhase = Math.random() * Math.PI * 2;
// For "sneakright" types
self.sneakrightPhase = Math.random() * Math.PI * 2;
// For "sneakleft" types
self.sneakleftPhase = Math.random() * Math.PI * 2;
// For "stompright" types
self.stomprightPhase = Math.random() * Math.PI * 2;
// For "stompleft" types
self.stompleftPhase = Math.random() * Math.PI * 2;
// For "marchright" types
self.marchrightPhase = Math.random() * Math.PI * 2;
// For "marchleft" types
self.marchleftPhase = Math.random() * Math.PI * 2;
// For "slideleftright" types
self.slideleftrightTimer = 0;
// For "slitherleftright" types
self.slitherleftrightPhase = Math.random() * Math.PI * 2;
// For "hoprightright" types
self.hoprightrightTimer = 0;
// For "hopleftleft" types
self.hopleftleftTimer = 0;
// For "jumpupright" types
self.jumpuprightPhase = Math.random() * Math.PI * 2;
// For "jumpupleft" types
self.jumpupleftPhase = Math.random() * Math.PI * 2;
// For "jumpdownright" types
self.jumpdownrightPhase = Math.random() * Math.PI * 2;
// For "jumpdownleft" types
self.jumpdownleftPhase = Math.random() * Math.PI * 2;
// For "rollrightright" types
self.rollrightrightSpin = 0;
// For "rollleftleft" types
self.rollleftleftSpin = 0;
// For "zoomrightright" types
self.zoomrightrightTimer = 0;
// For "zoomleftleft" types
self.zoomleftleftTimer = 0;
// For "bounceupright" types
self.bounceuprightPhase = Math.random() * Math.PI * 2;
// For "bounceupleft" types
self.bounceupleftPhase = Math.random() * Math.PI * 2;
// For "bouncedownright" types
self.bouncedownrightPhase = Math.random() * Math.PI * 2;
// For "bouncedownleft" types
self.bouncedownleftPhase = Math.random() * Math.PI * 2;
// For "floatupright" types
self.floatuprightPhase = Math.random() * Math.PI * 2;
// For "floatupleft" types
self.floatupleftPhase = Math.random() * Math.PI * 2;
// For "floatdownright" types
self.floatdownrightPhase = Math.random() * Math.PI * 2;
// For "floatdownleft" types
self.floatdownleftPhase = Math.random() * Math.PI * 2;
// For "peekrightright" types
self.peekrightrightTimer = 0;
// For "peekleftleft" types
self.peekleftleftTimer = 0;
// For "poprightright" types
self.poprightrightTimer = 0;
// For "popleftleft" types
self.popleftleftTimer = 0;
// For "appearleftright" types
self.appearleftrightTimer = 0;
// For "appearrightleft" types
self.appearrightleftTimer = 0;
// For "jumprightright" types
self.jumprightrightPhase = Math.random() * Math.PI * 2;
// For "jumpleftleft" types
self.jumpleftleftPhase = Math.random() * Math.PI * 2;
// For "dashrightright" types
self.dashrightrightTimer = 0;
// For "dashleftleft" types
self.dashleftleftTimer = 0;
// For "circlerightright" types
self.circlerightrightPhase = Math.random() * Math.PI * 2;
// For "circleleftleft" types
self.circleleftleftPhase = Math.random() * Math.PI * 2;
// For "zigzagrightright" types
self.zigzagrightrightPhase = Math.random() * Math.PI * 2;
// For "zigzagleftleft" types
self.zigzagleftleftPhase = Math.random() * Math.PI * 2;
// For "waverightright" types
self.waverightrightPhase = Math.random() * Math.PI * 2;
// For "waveleftleft" types
self.waveleftleftPhase = Math.random() * Math.PI * 2;
// For "randomrightright" types
self.randomrightrightTimer = 0;
// For "randomleftleft" types
self.randomleftleftTimer = 0;
// For "pauserightright" types
self.pauserightrightTimer = 0;
self.isPausedRightRight = false;
// For "pauseleftleft" types
self.pauseleftleftTimer = 0;
self.isPausedLeftLeft = false;
// For "hiderightright" types
self.hiderightrightTimer = 0;
self.isHiddenRightRight = false;
// For "hideleftleft" types
self.hideleftleftTimer = 0;
self.isHiddenLeftLeft = false;
// For "fliprightright" types
self.fliprightrightTimer = 0;
self.isFlippedRightRight = false;
// For "flipleftleft" types
self.flipleftleftTimer = 0;
self.isFlippedLeftLeft = false;
// For "twirlrightright" types
self.twirlrightrightPhase = Math.random() * Math.PI * 2;
// For "twirlleftleft" types
self.twirlleftleftPhase = Math.random() * Math.PI * 2;
// For "driftrightright" types
self.driftrightrightPhase = Math.random() * Math.PI * 2;
// For "driftleftleft" types
self.driftleftleftPhase = Math.random() * Math.PI * 2;
// For "shakerightright" types
self.shakerightrightPhase = Math.random() * Math.PI * 2;
// For "shakeleftleft" types
self.shakeleftleftPhase = Math.random() * Math.PI * 2;
// For "slideupleftright" types
self.slideupleftrightTimer = 0;
// For "slideuprightleft" types
self.slideuprightleftTimer = 0;
// For "sprintrightright" types
self.sprintrightrightTimer = 0;
// For "sprintleftleft" types
self.sprintleftleftTimer = 0;
// For "hoverrightright" types
self.hoverrightrightPhase = Math.random() * Math.PI * 2;
// For "hoverleftleft" types
self.hoverleftleftPhase = Math.random() * Math.PI * 2;
// For "bobrightright" types
self.bobrightrightPhase = Math.random() * Math.PI * 2;
// For "bobleftleft" types
self.bobleftleftPhase = Math.random() * Math.PI * 2;
// For "sneakrightright" types
self.sneakrightrightPhase = Math.random() * Math.PI * 2;
// For "sneakleftleft" types
self.sneakleftleftPhase = Math.random() * Math.PI * 2;
// For "stomprightright" types
self.stomprightrightPhase = Math.random() * Math.PI * 2;
// For "stompleftleft" types
self.stompleftleftPhase = Math.random() * Math.PI * 2;
// For "marchrightright" types
self.marchrightrightPhase = Math.random() * Math.PI * 2;
// For "marchleftleft" types
self.marchleftleftPhase = Math.random() * Math.PI * 2;
// For "slideleftrightright" types
self.slideleftrightrightTimer = 0;
// For "slitherleftrightright" types
self.slitherleftrightrightPhase = Math.random() * Math.PI * 2;
// For "hoprightrightright" types
self.hoprightrightrightTimer = 0;
// For "hopleftleftleft" types
self.hopleftleftleftTimer = 0;
// For "jumpuprightright" types
self.jumpuprightrightPhase = Math.random() * Math.PI * 2;
// For "jumpupleftleft" types
self.jumpupleftleftPhase = Math.random() * Math.PI * 2;
// For "jumpdownrightright" types
self.jumpdownrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpdownleftleft" types
self.jumpdownleftleftPhase = Math.random() * Math.PI * 2;
// For "rollrightrightright" types
self.rollrightrightrightSpin = 0;
// For "rollleftleftleft" types
self.rollleftleftleftSpin = 0;
// For "zoomrightrightright" types
self.zoomrightrightrightTimer = 0;
// For "zoomleftleftleft" types
self.zoomleftleftleftTimer = 0;
// For "bounceuprightright" types
self.bounceuprightrightPhase = Math.random() * Math.PI * 2;
// For "bounceupleftleft" types
self.bounceupleftleftPhase = Math.random() * Math.PI * 2;
// For "bouncedownrightright" types
self.bouncedownrightrightPhase = Math.random() * Math.PI * 2;
// For "bouncedownleftleft" types
self.bouncedownleftleftPhase = Math.random() * Math.PI * 2;
// For "floatuprightright" types
self.floatuprightrightPhase = Math.random() * Math.PI * 2;
// For "floatupleftleft" types
self.floatupleftleftPhase = Math.random() * Math.PI * 2;
// For "floatdownrightright" types
self.floatdownrightrightPhase = Math.random() * Math.PI * 2;
// For "floatdownleftleft" types
self.floatdownleftleftPhase = Math.random() * Math.PI * 2;
// For "peekrightrightright" types
self.peekrightrightrightTimer = 0;
// For "peekleftleftleft" types
self.peekleftleftleftTimer = 0;
// For "poprightrightright" types
self.poprightrightrightTimer = 0;
// For "popleftleftleft" types
self.popleftleftleftTimer = 0;
// For "appearleftrightright" types
self.appearleftrightrightTimer = 0;
// For "appearrightleftleft" types
self.appearrightleftleftTimer = 0;
// For "jumprightrightright" types
self.jumprightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpleftleftleft" types
self.jumpleftleftleftPhase = Math.random() * Math.PI * 2;
// For "dashrightrightright" types
self.dashrightrightrightTimer = 0;
// For "dashleftleftleft" types
self.dashleftleftleftTimer = 0;
// For "circlerightrightright" types
self.circlerightrightrightPhase = Math.random() * Math.PI * 2;
// For "circleleftleftleft" types
self.circleleftleftleftPhase = Math.random() * Math.PI * 2;
// For "zigzagrightrightright" types
self.zigzagrightrightrightPhase = Math.random() * Math.PI * 2;
// For "zigzagleftleftleft" types
self.zigzagleftleftleftPhase = Math.random() * Math.PI * 2;
// For "waverightrightright" types
self.waverightrightrightPhase = Math.random() * Math.PI * 2;
// For "waveleftleftleft" types
self.waveleftleftleftPhase = Math.random() * Math.PI * 2;
// For "randomrightrightright" types
self.randomrightrightrightTimer = 0;
// For "randomleftleftleft" types
self.randomleftleftleftTimer = 0;
// For "pauserightrightright" types
self.pauserightrightrightTimer = 0;
self.isPausedRightRightRight = false;
// For "pauseleftleftleft" types
self.pauseleftleftleftTimer = 0;
self.isPausedLeftLeftLeft = false;
// For "hiderightrightright" types
self.hiderightrightrightTimer = 0;
self.isHiddenRightRightRight = false;
// For "hideleftleftleft" types
self.hideleftleftleftTimer = 0;
self.isHiddenLeftLeftLeft = false;
// For "fliprightrightright" types
self.fliprightrightrightTimer = 0;
self.isFlippedRightRightRight = false;
// For "flipleftleftleft" types
self.flipleftleftleftTimer = 0;
self.isFlippedLeftLeftLeft = false;
// For "twirlrightrightright" types
self.twirlrightrightrightPhase = Math.random() * Math.PI * 2;
// For "twirlleftleftleft" types
self.twirlleftleftleftPhase = Math.random() * Math.PI * 2;
// For "driftrightrightright" types
self.driftrightrightrightPhase = Math.random() * Math.PI * 2;
// For "driftleftleftleft" types
self.driftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "shakerightrightright" types
self.shakerightrightrightPhase = Math.random() * Math.PI * 2;
// For "shakeleftleftleft" types
self.shakeleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideupleftrightright" types
self.slideupleftrightrightTimer = 0;
// For "slideuprightleftleft" types
self.slideuprightleftleftTimer = 0;
// For "sprintrightrightright" types
self.sprintrightrightrightTimer = 0;
// For "sprintleftleftleft" types
self.sprintleftleftleftTimer = 0;
// For "hoverrightrightright" types
self.hoverrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoverleftleftleft" types
self.hoverleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bobrightrightright" types
self.bobrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bobleftleftleft" types
self.bobleftleftleftPhase = Math.random() * Math.PI * 2;
// For "sneakrightrightright" types
self.sneakrightrightrightPhase = Math.random() * Math.PI * 2;
// For "sneakleftleftleft" types
self.sneakleftleftleftPhase = Math.random() * Math.PI * 2;
// For "stomprightrightright" types
self.stomprightrightrightPhase = Math.random() * Math.PI * 2;
// For "stompleftleftleft" types
self.stompleftleftleftPhase = Math.random() * Math.PI * 2;
// For "marchrightrightright" types
self.marchrightrightrightPhase = Math.random() * Math.PI * 2;
// For "marchleftleftleft" types
self.marchleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideleftrightrightright" types
self.slideleftrightrightrightTimer = 0;
// For "slitherleftrightrightright" types
self.slitherleftrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoprightrightrightright" types
self.hoprightrightrightrightTimer = 0;
// For "hopleftleftleftleft" types
self.hopleftleftleftleftTimer = 0;
// For "jumpuprightrightright" types
self.jumpuprightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpupleftleftleft" types
self.jumpupleftleftleftPhase = Math.random() * Math.PI * 2;
// For "jumpdownrightrightright" types
self.jumpdownrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpdownleftleftleft" types
self.jumpdownleftleftleftPhase = Math.random() * Math.PI * 2;
// For "rollrightrightrightright" types
self.rollrightrightrightrightSpin = 0;
// For "rollleftleftleftleft" types
self.rollleftleftleftleftSpin = 0;
// For "zoomrightrightrightright" types
self.zoomrightrightrightrightTimer = 0;
// For "zoomleftleftleftleft" types
self.zoomleftleftleftleftTimer = 0;
// For "bounceuprightrightright" types
self.bounceuprightrightrightPhase = Math.random() * Math.PI * 2;
// For "bounceupleftleftleft" types
self.bounceupleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bouncedownrightrightright" types
self.bouncedownrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bouncedownleftleftleft" types
self.bouncedownleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatuprightrightright" types
self.floatuprightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatupleftleftleft" types
self.floatupleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatdownrightrightright" types
self.floatdownrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatdownleftleftleft" types
self.floatdownleftleftleftPhase = Math.random() * Math.PI * 2;
// For "peekrightrightrightright" types
self.peekrightrightrightrightTimer = 0;
// For "peekleftleftleftleft" types
self.peekleftleftleftleftTimer = 0;
// For "poprightrightrightright" types
self.poprightrightrightrightTimer = 0;
// For "popleftleftleftleft" types
self.popleftleftleftleftTimer = 0;
// For "appearleftrightrightright" types
self.appearleftrightrightrightTimer = 0;
// For "appearrightleftleftleft" types
self.appearrightleftleftleftTimer = 0;
// For "jumprightrightrightright" types
self.jumprightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpleftleftleftleft" types
self.jumpleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "dashrightrightrightright" types
self.dashrightrightrightrightTimer = 0;
// For "dashleftleftleftleft" types
self.dashleftleftleftleftTimer = 0;
// For "circlerightrightrightright" types
self.circlerightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "circleleftleftleftleft" types
self.circleleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "zigzagrightrightrightright" types
self.zigzagrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "zigzagleftleftleftleft" types
self.zigzagleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "waverightrightrightright" types
self.waverightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "waveleftleftleftleft" types
self.waveleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "randomrightrightrightright" types
self.randomrightrightrightrightTimer = 0;
// For "randomleftleftleftleft" types
self.randomleftleftleftleftTimer = 0;
// For "pauserightrightrightright" types
self.pauserightrightrightrightTimer = 0;
self.isPausedRightRightRightRight = false;
// For "pauseleftleftleftleft" types
self.pauseleftleftleftleftTimer = 0;
self.isPausedLeftLeftLeftLeft = false;
// For "hiderightrightrightright" types
self.hiderightrightrightrightTimer = 0;
self.isHiddenRightRightRightRight = false;
// For "hideleftleftleftleft" types
self.hideleftleftleftleftTimer = 0;
self.isHiddenLeftLeftLeftLeft = false;
// For "fliprightrightrightright" types
self.fliprightrightrightrightTimer = 0;
self.isFlippedRightRightRightRight = false;
// For "flipleftleftleftleft" types
self.flipleftleftleftleftTimer = 0;
self.isFlippedLeftLeftLeftLeft = false;
// For "twirlrightrightrightright" types
self.twirlrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "twirlleftleftleftleft" types
self.twirlleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "driftrightrightrightright" types
self.driftrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "driftleftleftleftleft" types
self.driftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "shakerightrightrightright" types
self.shakerightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "shakeleftleftleftleft" types
self.shakeleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideupleftrightrightright" types
self.slideupleftrightrightrightTimer = 0;
// For "slideuprightleftleftleft" types
self.slideuprightleftleftleftTimer = 0;
// For "sprintrightrightrightright" types
self.sprintrightrightrightrightTimer = 0;
// For "sprintleftleftleftleft" types
self.sprintleftleftleftleftTimer = 0;
// For "hoverrightrightrightright" types
self.hoverrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoverleftleftleftleft" types
self.hoverleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bobrightrightrightright" types
self.bobrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bobleftleftleftleft" types
self.bobleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "sneakrightrightrightright" types
self.sneakrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "sneakleftleftleftleft" types
self.sneakleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "stomprightrightrightright" types
self.stomprightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "stompleftleftleftleft" types
self.stompleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "marchrightrightrightright" types
self.marchrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "marchleftleftleftleft" types
self.marchleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideleftrightrightrightright" types
self.slideleftrightrightrightrightTimer = 0;
// For "slitherleftrightrightrightright" types
self.slitherleftrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoprightrightrightrightright" types
self.hoprightrightrightrightrightTimer = 0;
// For "hopleftleftleftleftleft" types
self.hopleftleftleftleftleftTimer = 0;
// For "jumpuprightrightrightright" types
self.jumpuprightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpupleftleftleftleft" types
self.jumpupleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "jumpdownrightrightrightright" types
self.jumpdownrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpdownleftleftleftleft" types
self.jumpdownleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "rollrightrightrightrightright" types
self.rollrightrightrightrightrightSpin = 0;
// For "rollleftleftleftleftleft" types
self.rollleftleftleftleftleftSpin = 0;
// For "zoomrightrightrightrightright" types
self.zoomrightrightrightrightrightTimer = 0;
// For "zoomleftleftleftleftleft" types
self.zoomleftleftleftleftleftTimer = 0;
// For "bounceuprightrightrightright" types
self.bounceuprightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bounceupleftleftleftleft" types
self.bounceupleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bouncedownrightrightrightright" types
self.bouncedownrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bouncedownleftleftleftleft" types
self.bouncedownleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatuprightrightrightright" types
self.floatuprightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatupleftleftleftleft" types
self.floatupleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatdownrightrightrightright" types
self.floatdownrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatdownleftleftleftleft" types
self.floatdownleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "peekrightrightrightrightright" types
self.peekrightrightrightrightrightTimer = 0;
// For "peekleftleftleftleftleft" types
self.peekleftleftleftleftleftTimer = 0;
// For "poprightrightrightrightright" types
self.poprightrightrightrightrightTimer = 0;
// For "popleftleftleftleftleft" types
self.popleftleftleftleftleftTimer = 0;
// For "appearleftrightrightrightright" types
self.appearleftrightrightrightrightTimer = 0;
// For "appearrightleftleftleftleft" types
self.appearrightleftleftleftleftTimer = 0;
// For "jumprightrightrightrightright" types
self.jumprightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpleftleftleftleftleft" types
self.jumpleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "dashrightrightrightrightright" types
self.dashrightrightrightrightrightTimer = 0;
// For "dashleftleftleftleftleft" types
self.dashleftleftleftleftleftTimer = 0;
// For "circlerightrightrightrightright" types
self.circlerightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "circleleftleftleftleftleft" types
self.circleleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "zigzagrightrightrightrightright" types
self.zigzagrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "zigzagleftleftleftleftleft" types
self.zigzagleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "waverightrightrightrightright" types
self.waverightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "waveleftleftleftleftleft" types
self.waveleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "randomrightrightrightrightright" types
self.randomrightrightrightrightrightTimer = 0;
// For "randomleftleftleftleftleft" types
self.randomleftleftleftleftleftTimer = 0;
// For "pauserightrightrightrightright" types
self.pauserightrightrightrightrightTimer = 0;
self.isPausedRightRightRightRightRight = false;
// For "pauseleftleftleftleftleft" types
self.pauseleftleftleftleftleftTimer = 0;
self.isPausedLeftLeftLeftLeftLeft = false;
// For "hiderightrightrightrightright" types
self.hiderightrightrightrightrightTimer = 0;
self.isHiddenRightRightRightRightRight = false;
// For "hideleftleftleftleftleft" types
self.hideleftleftleftleftleftTimer = 0;
self.isHiddenLeftLeftLeftLeftLeft = false;
// For "fliprightrightrightrightright" types
self.fliprightrightrightrightrightTimer = 0;
self.isFlippedRightRightRightRightRight = false;
// For "flipleftleftleftleftleft" types
self.flipleftleftleftleftleftTimer = 0;
self.isFlippedLeftLeftLeftLeftLeft = false;
// For "twirlrightrightrightrightright" types
self.twirlrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "twirlleftleftleftleftleft" types
self.twirlleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "driftrightrightrightrightright" types
self.driftrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "driftleftleftleftleftleft" types
self.driftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "shakerightrightrightrightright" types
self.shakerightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "shakeleftleftleftleftleft" types
self.shakeleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideupleftrightrightrightright" types
self.slideupleftrightrightrightrightTimer = 0;
// For "slideuprightleftleftleftleft" types
self.slideuprightleftleftleftleftTimer = 0;
// For "sprintrightrightrightrightright" types
self.sprintrightrightrightrightrightTimer = 0;
// For "sprintleftleftleftleftleft" types
self.sprintleftleftleftleftleftTimer = 0;
// For "hoverrightrightrightrightright" types
self.hoverrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoverleftleftleftleftleft" types
self.hoverleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bobrightrightrightrightright" types
self.bobrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bobleftleftleftleftleft" types
self.bobleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "sneakrightrightrightrightright" types
self.sneakrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "sneakleftleftleftleftleft" types
self.sneakleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "stomprightrightrightrightright" types
self.stomprightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "stompleftleftleftleftleft" types
self.stompleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "marchrightrightrightrightright" types
self.marchrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "marchleftleftleftleftleft" types
self.marchleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideleftrightrightrightrightright" types
self.slideleftrightrightrightrightrightTimer = 0;
// For "slitherleftrightrightrightrightright" types
self.slitherleftrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoprightrightrightrightrightright" types
self.hoprightrightrightrightrightrightTimer = 0;
// For "hopleftleftleftleftleftleft" types
self.hopleftleftleftleftleftleftTimer = 0;
// For "jumpuprightrightrightrightright" types
self.jumpuprightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpupleftleftleftleftleft" types
self.jumpupleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "jumpdownrightrightrightrightright" types
self.jumpdownrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpdownleftleftleftleftleft" types
self.jumpdownleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "rollrightrightrightrightrightright" types
self.rollrightrightrightrightrightrightSpin = 0;
// For "rollleftleftleftleftleftleft" types
self.rollleftleftleftleftleftleftSpin = 0;
// For "zoomrightrightrightrightrightright" types
self.zoomrightrightrightrightrightrightTimer = 0;
// For "zoomleftleftleftleftleftleft" types
self.zoomleftleftleftleftleftleftTimer = 0;
// For "bounceuprightrightrightrightright" types
self.bounceuprightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bounceupleftleftleftleftleft" types
self.bounceupleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bouncedownrightrightrightrightright" types
self.bouncedownrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bouncedownleftleftleftleftleft" types
self.bouncedownleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatuprightrightrightrightright" types
self.floatuprightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatupleftleftleftleftleft" types
self.floatupleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatdownrightrightrightrightright" types
self.floatdownrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatdownleftleftleftleftleft" types
self.floatdownleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "peekrightrightrightrightrightright" types
self.peekrightrightrightrightrightrightTimer = 0;
// For "peekleftleftleftleftleftleft" types
self.peekleftleftleftleftleftleftTimer = 0;
// For "poprightrightrightrightrightright" types
self.poprightrightrightrightrightrightTimer = 0;
// For "popleftleftleftleftleftleft" types
self.popleftleftleftleftleftleftTimer = 0;
// For "appearleftrightrightrightrightright" types
self.appearleftrightrightrightrightrightTimer = 0;
// For "appearrightleftleftleftleftleft" types
self.appearrightleftleftleftleftleftTimer = 0;
// For "jumprightrightrightrightrightright" types
self.jumprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpleftleftleftleftleftleft" types
self.jumpleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "dashrightrightrightrightrightright" types
self.dashrightrightrightrightrightrightTimer = 0;
// For "dashleftleftleftleftleftleft" types
self.dashleftleftleftleftleftleftTimer = 0;
// For "circlerightrightrightrightrightright" types
self.circlerightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "circleleftleftleftleftleftleft" types
self.circleleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "zigzagrightrightrightrightrightright" types
self.zigzagrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "zigzagleftleftleftleftleftleft" types
self.zigzagleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "waverightrightrightrightrightright" types
self.waverightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "waveleftleftleftleftleftleft" types
self.waveleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "randomrightrightrightrightrightright" types
self.randomrightrightrightrightrightrightTimer = 0;
// For "randomleftleftleftleftleftleft" types
self.randomleftleftleftleftleftleftTimer = 0;
// For "pauserightrightrightrightrightright" types
self.pauserightrightrightrightrightrightTimer = 0;
self.isPausedRightRightRightRightRightRight = false;
// For "pauseleftleftleftleftleftleft" types
self.pauseleftleftleftleftleftleftTimer = 0;
self.isPausedLeftLeftLeftLeftLeftLeft = false;
// For "hiderightrightrightrightrightright" types
self.hiderightrightrightrightrightrightTimer = 0;
self.isHiddenRightRightRightRightRightRight = false;
// For "hideleftleftleftleftleftleft" types
self.hideleftleftleftleftleftleftTimer = 0;
self.isHiddenLeftLeftLeftLeftLeftLeft = false;
// For "fliprightrightrightrightrightright" types
self.fliprightrightrightrightrightrightTimer = 0;
self.isFlippedRightRightRightRightRightRight = false;
// For "flipleftleftleftleftleftleft" types
self.flipleftleftleftleftleftleftTimer = 0;
self.isFlippedLeftLeftLeftLeftLeftLeft = false;
// For "twirlrightrightrightrightrightright" types
self.twirlrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "twirlleftleftleftleftleftleft" types
self.twirlleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "driftrightrightrightrightrightright" types
self.driftrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "driftleftleftleftleftleftleft" types
self.driftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "shakerightrightrightrightrightright" types
self.shakerightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "shakeleftleftleftleftleftleft" types
self.shakeleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideupleftrightrightrightrightright" types
self.slideupleftrightrightrightrightrightTimer = 0;
// For "slideuprightleftleftleftleftleft" types
self.slideuprightleftleftleftleftleftTimer = 0;
// For "sprintrightrightrightrightrightright" types
self.sprintrightrightrightrightrightrightTimer = 0;
// For "sprintleftleftleftleftleftleft" types
self.sprintleftleftleftleftleftleftTimer = 0;
// For "hoverrightrightrightrightrightright" types
self.hoverrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoverleftleftleftleftleftleft" types
self.hoverleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bobrightrightrightrightrightright" types
self.bobrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bobleftleftleftleftleftleft" types
self.bobleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "sneakrightrightrightrightrightright" types
self.sneakrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "sneakleftleftleftleftleftleft" types
self.sneakleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "stomprightrightrightrightrightright" types
self.stomprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "stompleftleftleftleftleftleft" types
self.stompleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "marchrightrightrightrightrightright" types
self.marchrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "marchleftleftleftleftleftleft" types
self.marchleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideleftrightrightrightrightrightright" types
self.slideleftrightrightrightrightrightrightTimer = 0;
// For "slitherleftrightrightrightrightrightright" types
self.slitherleftrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoprightrightrightrightrightrightright" types
self.hoprightrightrightrightrightrightrightTimer = 0;
// For "hopleftleftleftleftleftleftleft" types
self.hopleftleftleftleftleftleftleftTimer = 0;
// For "jumpuprightrightrightrightrightright" types
self.jumpuprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpupleftleftleftleftleftleft" types
self.jumpupleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "jumpdownrightrightrightrightrightright" types
self.jumpdownrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpdownleftleftleftleftleftleft" types
self.jumpdownleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "rollrightrightrightrightrightrightright" types
self.rollrightrightrightrightrightrightrightSpin = 0;
// For "rollleftleftleftleftleftleftleft" types
self.rollleftleftleftleftleftleftleftSpin = 0;
// For "zoomrightrightrightrightrightrightright" types
self.zoomrightrightrightrightrightrightrightTimer = 0;
// For "zoomleftleftleftleftleftleftleft" types
self.zoomleftleftleftleftleftleftleftTimer = 0;
// For "bounceuprightrightrightrightrightright" types
self.bounceuprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bounceupleftleftleftleftleftleft" types
self.bounceupleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bouncedownrightrightrightrightrightright" types
self.bouncedownrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bouncedownleftleftleftleftleftleft" types
self.bouncedownleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatuprightrightrightrightrightright" types
self.floatuprightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatupleftleftleftleftleftleft" types
self.floatupleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatdownrightrightrightrightrightright" types
self.floatdownrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatdownleftleftleftleftleftleft" types
self.floatdownleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "peekrightrightrightrightrightrightright" types
self.peekrightrightrightrightrightrightrightTimer = 0;
// For "peekleftleftleftleftleftleftleft" types
self.peekleftleftleftleftleftleftleftTimer = 0;
// For "poprightrightrightrightrightrightright" types
self.poprightrightrightrightrightrightrightTimer = 0;
// For "popleftleftleftleftleftleftleft" types
self.popleftleftleftleftleftleftleftTimer = 0;
// For "appearleftrightrightrightrightrightright" types
self.appearleftrightrightrightrightrightrightTimer = 0;
// For "appearrightleftleftleftleftleftleft" types
self.appearrightleftleftleftleftleftleftTimer = 0;
// For "jumprightrightrightrightrightrightright" types
self.jumprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpleftleftleftleftleftleftleft" types
self.jumpleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "dashrightrightrightrightrightrightright" types
self.dashrightrightrightrightrightrightrightTimer = 0;
// For "dashleftleftleftleftleftleftleft" types
self.dashleftleftleftleftleftleftleftTimer = 0;
// For "circlerightrightrightrightrightrightright" types
self.circlerightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "circleleftleftleftleftleftleftleft" types
self.circleleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "zigzagrightrightrightrightrightrightright" types
self.zigzagrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "zigzagleftleftleftleftleftleftleft" types
self.zigzagleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "waverightrightrightrightrightrightright" types
self.waverightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "waveleftleftleftleftleftleftleft" types
self.waveleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "randomrightrightrightrightrightrightright" types
self.randomrightrightrightrightrightrightrightTimer = 0;
// For "randomleftleftleftleftleftleftleft" types
self.randomleftleftleftleftleftleftleftTimer = 0;
// For "pauserightrightrightrightrightrightright" types
self.pauserightrightrightrightrightrightrightTimer = 0;
self.isPausedRightRightRightRightRightRightRight = false;
// For "pauseleftleftleftleftleftleftleft" types
self.pauseleftleftleftleftleftleftleftTimer = 0;
self.isPausedLeftLeftLeftLeftLeftLeftLeft = false;
// For "hiderightrightrightrightrightrightright" types
self.hiderightrightrightrightrightrightrightTimer = 0;
self.isHiddenRightRightRightRightRightRightRight = false;
// For "hideleftleftleftleftleftleftleft" types
self.hideleftleftleftleftleftleftleftTimer = 0;
self.isHiddenLeftLeftLeftLeftLeftLeftLeft = false;
// For "fliprightrightrightrightrightrightright" types
self.fliprightrightrightrightrightrightrightTimer = 0;
self.isFlippedRightRightRightRightRightRightRight = false;
// For "flipleftleftleftleftleftleftleft" types
self.flipleftleftleftleftleftleftleftTimer = 0;
self.isFlippedLeftLeftLeftLeftLeftLeftLeft = false;
// For "twirlrightrightrightrightrightrightright" types
self.twirlrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "twirlleftleftleftleftleftleftleft" types
self.twirlleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "driftrightrightrightrightrightrightright" types
self.driftrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "driftleftleftleftleftleftleftleft" types
self.driftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "shakerightrightrightrightrightrightright" types
self.shakerightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "shakeleftleftleftleftleftleftleft" types
self.shakeleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideupleftrightrightrightrightrightright" types
self.slideupleftrightrightrightrightrightrightTimer = 0;
// For "slideuprightleftleftleftleftleftleft" types
self.slideuprightleftleftleftleftleftleftTimer = 0;
// For "sprintrightrightrightrightrightrightright" types
self.sprintrightrightrightrightrightrightrightTimer = 0;
// For "sprintleftleftleftleftleftleftleft" types
self.sprintleftleftleftleftleftleftleftTimer = 0;
// For "hoverrightrightrightrightrightrightright" types
self.hoverrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoverleftleftleftleftleftleftleft" types
self.hoverleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bobrightrightrightrightrightrightright" types
self.bobrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bobleftleftleftleftleftleftleft" types
self.bobleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "sneakrightrightrightrightrightrightright" types
self.sneakrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "sneakleftleftleftleftleftleftleft" types
self.sneakleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "stomprightrightrightrightrightrightright" types
self.stomprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "stompleftleftleftleftleftleftleft" types
self.stompleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "marchrightrightrightrightrightrightright" types
self.marchrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "marchleftleftleftleftleftleftleft" types
self.marchleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideleftrightrightrightrightrightrightright" types
self.slideleftrightrightrightrightrightrightrightTimer = 0;
// For "slitherleftrightrightrightrightrightrightright" types
self.slitherleftrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoprightrightrightrightrightrightrightright" types
self.hoprightrightrightrightrightrightrightrightTimer = 0;
// For "hopleftleftleftleftleftleftleftleft" types
self.hopleftleftleftleftleftleftleftleftTimer = 0;
// For "jumpuprightrightrightrightrightrightright" types
self.jumpuprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpupleftleftleftleftleftleftleft" types
self.jumpupleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "jumpdownrightrightrightrightrightrightright" types
self.jumpdownrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpdownleftleftleftleftleftleftleft" types
self.jumpdownleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "rollrightrightrightrightrightrightrightright" types
self.rollrightrightrightrightrightrightrightrightSpin = 0;
// For "rollleftleftleftleftleftleftleftleft" types
self.rollleftleftleftleftleftleftleftleftSpin = 0;
// For "zoomrightrightrightrightrightrightrightright" types
self.zoomrightrightrightrightrightrightrightrightTimer = 0;
// For "zoomleftleftleftleftleftleftleftleft" types
self.zoomleftleftleftleftleftleftleftleftTimer = 0;
// For "bounceuprightrightrightrightrightrightright" types
self.bounceuprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bounceupleftleftleftleftleftleftleft" types
self.bounceupleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bouncedownrightrightrightrightrightrightright" types
self.bouncedownrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bouncedownleftleftleftleftleftleftleft" types
self.bouncedownleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatuprightrightrightrightrightrightright" types
self.floatuprightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatupleftleftleftleftleftleftleft" types
self.floatupleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "floatdownrightrightrightrightrightrightright" types
self.floatdownrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "floatdownleftleftleftleftleftleftleft" types
self.floatdownleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "peekrightrightrightrightrightrightrightright" types
self.peekrightrightrightrightrightrightrightrightTimer = 0;
// For "peekleftleftleftleftleftleftleftleft" types
self.peekleftleftleftleftleftleftleftleftTimer = 0;
// For "poprightrightrightrightrightrightrightright" types
self.poprightrightrightrightrightrightrightrightTimer = 0;
// For "popleftleftleftleftleftleftleftleft" types
self.popleftleftleftleftleftleftleftleftTimer = 0;
// For "appearleftrightrightrightrightrightright" types
self.appearleftrightrightrightrightrightrightrightTimer = 0;
// For "appearrightleftleftleftleftleftleftleft" types
self.appearrightleftleftleftleftleftleftleftTimer = 0;
// For "jumprightrightrightrightrightrightrightright" types
self.jumprightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "jumpleftleftleftleftleftleftleftleft" types
self.jumpleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "dashrightrightrightrightrightrightrightright" types
self.dashrightrightrightrightrightrightrightrightTimer = 0;
// For "dashleftleftleftleftleftleftleftleft" types
self.dashleftleftleftleftleftleftleftleftTimer = 0;
// For "circlerightrightrightrightrightrightrightright" types
self.circlerightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "circleleftleftleftleftleftleftleftleft" types
self.circleleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "zigzagrightrightrightrightrightrightrightright" types
self.zigzagrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "zigzagleftleftleftleftleftleftleftleft" types
self.zigzagleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "waverightrightrightrightrightrightrightright" types
self.waverightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "waveleftleftleftleftleftleftleftleft" types
self.waveleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "randomrightrightrightrightrightrightrightright" types
self.randomrightrightrightrightrightrightrightrightTimer = 0;
// For "randomleftleftleftleftleftleftleftleft" types
self.randomleftleftleftleftleftleftleftleftTimer = 0;
// For "pauserightrightrightrightrightrightrightright" types
self.pauserightrightrightrightrightrightrightrightTimer = 0;
self.isPausedRightRightRightRightRightRightRightRight = false;
// For "pauseleftleftleftleftleftleftleftleft" types
self.pauseleftleftleftleftleftleftleftleftTimer = 0;
self.isPausedLeftLeftLeftLeftLeftLeftLeftLeft = false;
// For "hiderightrightrightrightrightrightrightright" types
self.hiderightrightrightrightrightrightrightrightTimer = 0;
self.isHiddenRightRightRightRightRightRightRightRight = false;
// For "hideleftleftleftleftleftleftleftleft" types
self.hideleftleftleftleftleftleftleftleftTimer = 0;
self.isHiddenLeftLeftLeftLeftLeftLeftLeftLeft = false;
// For "fliprightrightrightrightrightrightrightright" types
self.fliprightrightrightrightrightrightrightrightTimer = 0;
self.isFlippedRightRightRightRightRightRightRightRight = false;
// For "flipleftleftleftleftleftleftleftleft" types
self.flipleftleftleftleftleftleftleftleftTimer = 0;
self.isFlippedLeftLeftLeftLeftLeftLeftLeftLeft = false;
// For "twirlrightrightrightrightrightrightrightright" types
self.twirlrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "twirlleftleftleftleftleftleftleftleft" types
self.twirlleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "driftrightrightrightrightrightrightrightright" types
self.driftrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "driftleftleftleftleftleftleftleftleft" types
self.driftleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "shakerightrightrightrightrightrightrightright" types
self.shakerightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "shakeleftleftleftleftleftleftleftleft" types
self.shakeleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "slideupleftrightrightrightrightrightrightright" types
self.slideupleftrightrightrightrightrightrightrightTimer = 0;
// For "slideuprightleftleftleftleftleftleftleft" types
self.slideuprightleftleftleftleftleftleftleftTimer = 0;
// For "sprintrightrightrightrightrightrightrightright" types
self.sprintrightrightrightrightrightrightrightrightTimer = 0;
// For "sprintleftleftleftleftleftleftleftleft" types
self.sprintleftleftleftleftleftleftleftleftTimer = 0;
// For "hoverrightrightrightrightrightrightrightright" types
self.hoverrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "hoverleftleftleftleftleftleftleftleft" types
self.hoverleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "bobrightrightrightrightrightrightrightright" types
self.bobrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "bobleftleftleftleftleftleftleftleft" types
self.bobleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "sneakrightrightrightrightrightrightrightright" types
self.sneakrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "sneakleftleftleftleftleftleftleftleft" types
self.sneakleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "stomprightrightrightrightrightrightrightright" types
self.stomprightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "stompleftleftleftleftleftleftleftleft" types
self.stompleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// For "marchrightrightrightrightrightrightrightright" types
self.marchrightrightrightrightrightrightrightrightPhase = Math.random() * Math.PI * 2;
// For "marchleftleftleftleftleftleftleftleft" types
self.marchleftleftleftleftleftleftleftleftPhase = Math.random() * Math.PI * 2;
// Movement update
self.update = function () {
// Only move if not paused/hidden
if (self.isHidden) return;
// Movement patterns
var t = LK.ticks;
var baseY = self.baseY || self.y;
var baseX = self.baseX || self.x;
if (self.moveType === "walk") {
self.x += self.speed * self.direction;
// Bounce off edges
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "hop") {
self.x += self.speed * self.direction;
self.hopTimer += 1;
self.y = baseY - Math.abs(Math.sin(self.hopTimer * 0.1)) * 60;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "fly") {
self.x += self.speed * self.direction;
self.y = baseY - Math.sin(t * 0.05 + self.flyPhase) * 80;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "roll") {
self.x += self.speed * self.direction;
asset.rotation += 0.1 * self.direction;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "wiggle") {
self.x += self.speed * self.direction;
asset.y = Math.sin(t * 0.2 + self.wigglePhase) * 10;
asset.rotation = Math.sin(t * 0.1 + self.wigglePhase) * 0.2;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "slide") {
self.slideTimer += 1;
self.x += self.speed * self.direction * (Math.abs(Math.sin(self.slideTimer * 0.05)) + 0.5);
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "bounce") {
self.x += self.speed * self.direction;
self.y = baseY - Math.abs(Math.sin(t * 0.15 + self.bouncePhase)) * 40;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "float") {
self.x += self.speed * self.direction * 0.5;
self.y = baseY - Math.sin(t * 0.07 + self.floatPhase) * 30;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "crawl") {
self.x += self.speed * self.direction * 0.7;
asset.y = Math.sin(t * 0.25 + self.crawlPhase) * 5;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "zoom") {
self.zoomTimer += 1;
self.x += self.speed * self.direction * (1 + Math.abs(Math.sin(self.zoomTimer * 0.2)));
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "spin") {
self.x += self.speed * self.direction * 0.8;
asset.rotation += self.spinSpeed * self.direction;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "sway") {
self.x += self.speed * self.direction * 0.6;
asset.x = Math.sin(t * 0.15 + self.swayPhase) * 20;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "wave") {
self.x += self.speed * self.direction * 0.7;
self.y = baseY - Math.sin(t * 0.12 + self.wavePhase) * 25;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else if (self.moveType === "zigzag") {
self.x += self.speed * self.direction;
self.y = baseY + Math.sin(t * 0.18 + self.zigzagPhase) * 40;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
} else {
// Default: walk
self.x += self.speed * self.direction;
if (self.x < self.width / 2) {
self.x = self.width / 2;
self.direction = 1;
}
if (self.x > 2048 - self.width / 2) {
self.x = 2048 - self.width / 2;
self.direction = -1;
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x8fd97b // Grassy green
});
/****
* Game Code
****/
// Animal and object assets for all PARADE_ITEMS
// Cow asset: white ellipse, large
// List of 30 spawnable items: word, assetId, movement type, color, shape, size
// Chihuahua asset (replace id with actual asset id)
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
var PARADE_ITEMS = [{
word: "cat",
assetId: "cat",
moveType: "walk",
color: 0xcccccc,
shape: "ellipse",
width: 120,
height: 80
}, {
word: "dog",
assetId: "dog",
moveType: "walk",
color: 0x996633,
shape: "ellipse",
width: 140,
height: 90
}, {
word: "rabbit",
assetId: "rabbit",
moveType: "hop",
color: 0xffffff,
shape: "ellipse",
width: 100,
height: 70
}, {
word: "duck",
assetId: "duck",
moveType: "waddle",
color: 0xffee44,
shape: "ellipse",
width: 110,
height: 80
}, {
word: "sheep",
assetId: "sheep",
moveType: "walk",
color: 0xf0f0f0,
shape: "ellipse",
width: 130,
height: 90
}, {
word: "pig",
assetId: "pig",
moveType: "wiggle",
color: 0xffb6c1,
shape: "ellipse",
width: 120,
height: 80
}, {
word: "cow",
assetId: "cow",
moveType: "walk",
color: 0xffffff,
shape: "ellipse",
width: 160,
height: 100
}, {
word: "horse",
assetId: "horse",
moveType: "gallop",
color: 0x8b5a2b,
shape: "ellipse",
width: 170,
height: 100
}, {
word: "chicken",
assetId: "chicken",
moveType: "peck",
color: 0xfff8dc,
shape: "ellipse",
width: 90,
height: 60
}, {
word: "goat",
assetId: "goat",
moveType: "walk",
color: 0xe0e0e0,
shape: "ellipse",
width: 120,
height: 80
}, {
word: "frog",
assetId: "frog",
moveType: "hop",
color: 0x44cc44,
shape: "ellipse",
width: 80,
height: 60
}, {
word: "mouse",
assetId: "mouse",
moveType: "scurry",
color: 0xaaaaaa,
shape: "ellipse",
width: 70,
height: 40
}, {
word: "fox",
assetId: "fox",
moveType: "sneak",
color: 0xff6600,
shape: "ellipse",
width: 110,
height: 70
}, {
word: "owl",
assetId: "owl",
moveType: "fly",
color: 0x888888,
shape: "ellipse",
width: 100,
height: 80
}, {
word: "bee",
assetId: "bee",
moveType: "zigzag",
color: 0xffee00,
shape: "ellipse",
width: 60,
height: 40
}, {
word: "butterfly",
assetId: "butterfly",
moveType: "wave",
color: 0xff99ff,
shape: "ellipse",
width: 80,
height: 60
}, {
word: "chihuahua",
assetId: "chihuahua",
moveType: "walk",
color: 0xf5e6da,
shape: "ellipse",
width: 90,
height: 60
}, {
word: "snail",
assetId: "snail",
moveType: "crawl",
color: 0xcccc99,
shape: "ellipse",
width: 70,
height: 50
}, {
word: "turtle",
assetId: "turtle",
moveType: "crawl",
color: 0x228b22,
shape: "ellipse",
width: 100,
height: 70
}, {
word: "fish",
assetId: "fish",
moveType: "swim",
color: 0x3399ff,
shape: "ellipse",
width: 90,
height: 50
}, {
word: "bird",
assetId: "bird",
moveType: "fly",
color: 0x87ceeb,
shape: "ellipse",
width: 90,
height: 60
}, {
word: "lion",
assetId: "lion",
moveType: "walk",
color: 0xf4c542,
shape: "ellipse",
width: 150,
height: 100
}, {
word: "panda",
assetId: "panda",
moveType: "walk",
color: 0xffffff,
shape: "ellipse",
width: 140,
height: 100
}, {
word: "elephant",
assetId: "elephant",
moveType: "walk",
color: 0xaaaaaa,
shape: "ellipse",
width: 200,
height: 120
}, {
word: "giraffe",
assetId: "giraffe",
moveType: "walk",
color: 0xffe066,
shape: "ellipse",
width: 120,
height: 180
}, {
word: "monkey",
assetId: "monkey",
moveType: "wiggle",
color: 0x8d5524,
shape: "ellipse",
width: 110,
height: 90
}, {
word: "penguin",
assetId: "penguin",
moveType: "waddle",
color: 0x222222,
shape: "ellipse",
width: 90,
height: 100
}, {
word: "koala",
assetId: "koala",
moveType: "walk",
color: 0xcccccc,
shape: "ellipse",
width: 100,
height: 90
}, {
word: "deer",
assetId: "deer",
moveType: "walk",
color: 0xc68642,
shape: "ellipse",
width: 130,
height: 100
}, {
word: "camel",
assetId: "camel",
moveType: "walk",
color: 0xd2b48c,
shape: "ellipse",
width: 170,
height: 110
}, {
word: "zebra",
assetId: "zebra",
moveType: "walk",
color: 0xffffff,
shape: "ellipse",
width: 150,
height: 100
}, {
word: "car",
assetId: "car",
moveType: "roll",
color: 0x3366cc,
shape: "box",
width: 140,
height: 60
}, {
word: "bus",
assetId: "bus",
moveType: "roll",
color: 0xffcc00,
shape: "box",
width: 200,
height: 80
}, {
word: "train",
assetId: "train",
moveType: "roll",
color: 0x888888,
shape: "box",
width: 220,
height: 70
}, {
word: "ball",
assetId: "ball",
moveType: "bounce",
color: 0xff3333,
shape: "ellipse",
width: 80,
height: 80
}, {
word: "robot",
assetId: "robot",
moveType: "slide",
color: 0xcccccc,
shape: "box",
width: 100,
height: 100
}, {
word: "apple",
assetId: "apple",
moveType: "wiggle",
color: 0xff2222,
shape: "ellipse",
width: 60,
height: 60
}, {
word: "banana",
assetId: "banana",
moveType: "wiggle",
color: 0xffee00,
shape: "ellipse",
width: 80,
height: 40
}, {
word: "star",
assetId: "star",
moveType: "float",
color: 0xffff00,
shape: "ellipse",
width: 70,
height: 70
}, {
word: "cloud",
assetId: "cloud",
moveType: "float",
color: 0xffffff,
shape: "ellipse",
width: 180,
height: 90
}, {
word: "moon",
assetId: "moon",
moveType: "float",
color: 0xffffcc,
shape: "ellipse",
width: 100,
height: 100
}];
// Map for quick lookup
var PARADE_WORDS = {};
for (var i = 0; i < PARADE_ITEMS.length; i++) {
PARADE_WORDS[PARADE_ITEMS[i].word] = PARADE_ITEMS[i];
}
// Track which items have been discovered
var discovered = {};
// Track all parade items on screen
var paradeItems = [];
// Initialize assets (shapes) for all items
for (var i = 0; i < PARADE_ITEMS.length; i++) {
var item = PARADE_ITEMS[i];
}
// Draw the "ground" as a green rectangle at the bottom
var ground = LK.getAsset('ground', {
width: 2048,
height: 220,
color: 0x5cb85c,
shape: "box",
anchorX: 0,
anchorY: 1,
x: 0,
y: 2732
});
game.addChild(ground);
// Title text
var titleTxt = new Text2("Type & Spawn: Animal Parade", {
size: 90,
fill: 0xFFFFFF
});
titleTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(titleTxt);
// Discovered counter
var discoveredTxt = new Text2("Discovered: 0/30", {
size: 60,
fill: 0xFFFFFF
});
discoveredTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(discoveredTxt);
// Instructions
var instrTxt = new Text2("Type an animal name to spawn it", {
size: 60,
fill: 0xFFFFFF
});
instrTxt.anchor.set(0.5, 0);
LK.gui.bottom.addChild(instrTxt);
// Input field (simulated with a Text2 and a "Spawn" button)
var inputWord = "";
// Show typed letters above the keyboard
var inputDisplayTxt = new Text2("", {
size: 90,
fill: 0x222222
});
inputDisplayTxt.anchor.set(0.5, 1.0);
inputDisplayTxt.x = 2048 / 2;
inputDisplayTxt.y = 2732 - 700; // Just above the keyboard rows
game.addChild(inputDisplayTxt);
var inputTxt = new Text2("", {
size: 80,
fill: 0x222222
});
inputTxt.anchor.set(0.5, 0.5);
inputTxt.x = 2048 / 2;
inputTxt.y = 2732 - 350;
game.addChild(inputTxt);
// "Spawn" button
var spawnBtn = LK.getAsset('spawnBtn', {
width: 320,
height: 120,
color: 0x4a90e2,
shape: "box",
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 - 850 // Move above the keyboard rows
});
game.addChild(spawnBtn);
var spawnBtnTxt = new Text2("Spawn", {
size: 70,
fill: 0xFFFFFF
});
spawnBtnTxt.anchor.set(0.5, 0.5);
spawnBtnTxt.x = spawnBtn.x;
spawnBtnTxt.y = spawnBtn.y;
game.addChild(spawnBtnTxt);
// On-screen keyboard (letters A-Z, backspace, space)
var keyboardLetters = ["QWERTYUIOP", "ASDFGHJKL", "ZXCVBNM"];
var keyboardKeys = [];
var keySize = 120;
var keyMargin = 18;
var kbStartY = 2732 - 650;
for (var row = 0; row < keyboardLetters.length; row++) {
var letters = keyboardLetters[row];
var y = kbStartY + row * (keySize + keyMargin);
var rowWidth = letters.length * (keySize + keyMargin) - keyMargin;
var x0 = (2048 - rowWidth) / 2 + keySize / 2;
for (var col = 0; col < letters.length; col++) {
var ch = letters[col];
var key = LK.getAsset("key_" + ch, {
width: keySize,
height: keySize,
color: 0xffffff,
shape: "box",
anchorX: 0.5,
anchorY: 0.5,
x: x0 + col * (keySize + keyMargin),
y: y
});
game.addChild(key);
var keyTxt = new Text2(ch, {
size: 60,
fill: 0x222222
});
keyTxt.anchor.set(0.5, 0.5);
keyTxt.x = key.x;
keyTxt.y = key.y;
game.addChild(keyTxt);
keyboardKeys.push({
key: key,
letter: ch
});
}
}
// Spacebar
var spaceKey = LK.getAsset('key_space', {
width: keySize * 4 + keyMargin * 3,
height: keySize,
color: 0xffffff,
shape: "box",
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: kbStartY + 3 * (keySize + keyMargin)
});
game.addChild(spaceKey);
var spaceTxt = new Text2("SPACE", {
size: 50,
fill: 0x222222
});
spaceTxt.anchor.set(0.5, 0.5);
spaceTxt.x = spaceKey.x;
spaceTxt.y = spaceKey.y;
game.addChild(spaceTxt);
// Backspace
var backKey = LK.getAsset('key_back', {
width: keySize * 2 + keyMargin,
height: keySize,
color: 0xffffff,
shape: "box",
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2 + 350,
y: kbStartY + 3 * (keySize + keyMargin)
});
game.addChild(backKey);
var backTxt = new Text2("⌫", {
size: 60,
fill: 0x222222
});
backTxt.anchor.set(0.5, 0.5);
backTxt.x = backKey.x;
backTxt.y = backKey.y;
game.addChild(backTxt);
// Clear button
var clearBtn = LK.getAsset('key_clear', {
width: keySize * 2 + keyMargin,
height: keySize,
color: 0xffffff,
shape: "box",
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2 - 350,
y: kbStartY + 3 * (keySize + keyMargin)
});
game.addChild(clearBtn);
var clearTxt = new Text2("Clear", {
size: 50,
fill: 0x222222
});
clearTxt.anchor.set(0.5, 0.5);
clearTxt.x = clearBtn.x;
clearTxt.y = clearBtn.y;
game.addChild(clearTxt);
// Keyboard input handling
function handleKeyPress(ch) {
if (inputWord.length < 16) {
inputWord += ch;
inputTxt.setText(inputWord);
inputDisplayTxt.setText(inputWord);
}
}
function handleBackspace() {
inputWord = inputWord.slice(0, -1);
inputTxt.setText(inputWord);
inputDisplayTxt.setText(inputWord);
}
function handleSpace() {
if (inputWord.length < 16) {
inputWord += " ";
inputTxt.setText(inputWord);
inputDisplayTxt.setText(inputWord);
}
}
function handleSpawn() {
var word = inputWord.trim().toLowerCase();
if (PARADE_WORDS[word]) {
spawnParadeItem(word);
inputWord = "";
inputTxt.setText("");
inputDisplayTxt.setText("");
} else {
// Flash input red for 500ms
tween(inputTxt, {
tint: 0xff3333
}, {
duration: 100,
onFinish: function onFinish() {
tween(inputTxt, {
tint: 0x222222
}, {
duration: 400
});
}
});
}
}
// Attach event listeners to keys
for (var i = 0; i < keyboardKeys.length; i++) {
(function (keyObj) {
keyObj.key.down = function (x, y, obj) {
handleKeyPress(keyObj.letter);
};
})(keyboardKeys[i]);
}
spaceKey.down = function (x, y, obj) {
handleSpace();
};
backKey.down = function (x, y, obj) {
handleBackspace();
};
clearBtn.down = function (x, y, obj) {
// Remove all parade items from the field
for (var i = paradeItems.length - 1; i >= 0; i--) {
if (paradeItems[i] && paradeItems[i].destroy) {
paradeItems[i].destroy();
}
paradeItems.splice(i, 1);
}
};
spawnBtn.down = function (x, y, obj) {
handleSpawn();
};
inputTxt.down = function (x, y, obj) {
// No-op, but could focus input if we had a real input field
};
// Spawn a parade item
function spawnParadeItem(word) {
var item = PARADE_WORDS[word];
// Mark as discovered
if (!discovered[word]) {
discovered[word] = true;
updateDiscoveredTxt();
// Flash discovered text green
tween(discoveredTxt, {
tint: 0x44ff44
}, {
duration: 200,
onFinish: function onFinish() {
tween(discoveredTxt, {
tint: 0xffffff
}, {
duration: 400
});
}
});
}
// Create ParadeItem
// Use the correct assetId for cow (and all items)
var parade = new ParadeItem({
assetId: item.assetId
});
parade.moveType = getMoveType(item.moveType);
parade.width = item.width;
parade.height = item.height;
// Place at random x along the ground, y at ground level
parade.x = Math.random() * (2048 - parade.width) + parade.width / 2;
parade.y = 2732 - 220 + 10; // Just above ground
parade.baseY = parade.y;
parade.baseX = parade.x;
paradeItems.push(parade);
game.addChild(parade);
// Animate in (pop up)
parade.scaleX = parade.scaleY = 0.1;
tween(parade, {
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.bounceOut
});
}
// Update discovered text
function updateDiscoveredTxt() {
var count = 0;
for (var k in discovered) if (discovered[k]) count++;
discoveredTxt.setText("Discovered: " + count + "/40");
// Celebrate if all 40 discovered!
if (count === 40) {
// Flash the whole screen gold for 1s
LK.effects.flashScreen(0xffe066, 1000);
// Animate discoveredTxt rainbow
tween(discoveredTxt, {
tint: 0xff00ff
}, {
duration: 200,
onFinish: function onFinish() {
tween(discoveredTxt, {
tint: 0x00ffff
}, {
duration: 200,
onFinish: function onFinish() {
tween(discoveredTxt, {
tint: 0xffffff
}, {
duration: 200
});
}
});
}
});
}
}
// Map movement type string to ParadeItem moveType
function getMoveType(type) {
// Map some fun types to our implemented types
if (type === "waddle" || type === "gallop" || type === "scurry" || type === "peck" || type === "sneak" || type === "swim") return "walk";
return type;
}
// Parade item update
game.update = function () {
for (var i = 0; i < paradeItems.length; i++) {
paradeItems[i].update();
}
};
// Show all discovered items on game over
game.gameOver = function () {
// Not needed, handled by LK
};
// Show all discovered items on win
game.youWin = function () {
// Not needed, handled by LK
};
Cow. In-Game asset. 2d. High contrast. No shadows
Chicken Alive. In-Game asset. 2d. High contrast. No shadows
Banana. In-Game asset. 2d. High contrast. No shadows
Cat. In-Game asset. 2d. High contrast. No shadows
Dog. In-Game asset. 2d. High contrast. No shadows
Rabbit. In-Game asset. 2d. High contrast. No shadows
Duck. In-Game asset. 2d. High contrast. No shadows
Sheep. In-Game asset. 2d. High contrast. No shadows
Pig. In-Game asset. 2d. High contrast. No shadows
Horse. In-Game asset. 2d. High contrast. No shadows
Mouse animal. In-Game asset. 2d. High contrast. No shadows
Owl. In-Game asset. 2d. High contrast. No shadows
Bee. In-Game asset. 2d. High contrast. No shadows
Butterfly. In-Game asset. 2d. High contrast. No shadows
Chihuahua. In-Game asset. 2d. High contrast. No shadows
Bird. In-Game asset. 2d. High contrast. No shadows
Snail. In-Game asset. 2d. High contrast. No shadows
Fish. In-Game asset. 2d. High contrast. No shadows
Car. In-Game asset. 2d. High contrast. No shadows
Fox. In-Game asset. 2d. High contrast. No shadows
Bus. In-Game asset. 2d. High contrast. No shadows
Train. In-Game asset. 2d. High contrast. No shadows
bouncy ball. In-Game asset. 2d. High contrast. No shadows
Robot. In-Game asset. 2d. High contrast. No shadows
Turtle. In-Game asset. 2d. High contrast. No shadows
Apple. In-Game asset. 2d. High contrast. No shadows
Star. In-Game asset. 2d. High contrast. No shadows
Frog. In-Game asset. 2d. High contrast. No shadows
Goat. In-Game asset. 2d. High contrast. No shadows
Deer. In-Game asset. 2d. High contrast. No shadows
Cloud. In-Game asset. 2d. High contrast. No shadows
Moon. In-Game asset. 2d. High contrast. No shadows
Lion. In-Game asset. 2d. High contrast. No shadows
Panda. In-Game asset. 2d. High contrast. No shadows
Elephant. In-Game asset. 2d. High contrast. No shadows
Giraffe. In-Game asset. 2d. High contrast. No shadows
Monkey. In-Game asset. 2d. High contrast. No shadows
Penguin. In-Game asset. 2d. High contrast. No shadows
Koala. In-Game asset. 2d. High contrast. No shadows
Camel. In-Game asset. 2d. High contrast. No shadows
Zebra. In-Game asset. 2d. High contrast. No shadows