Geometry Dash 2.2 - A platformer 

Instructions: --------------------- The DarkLands -------------------\nFollow for more Fun games!!  =)\n - Controls -\n- Arrow Keys or WASD to move\n- Up Arrow To Jump ( You can wall jump )\n- Comment your time and deaths\n- Dodge The Dangerous Things And fun dangerous stuff!! :D\nPlease Leave a ❤️ and ⭐ will be highly appreciated.\nstory-\nYou are having a big adventure through the beautiful valley but you came to the wrong place..\nTHE DARKLANDS \nescape new adventures\nescape the monsters\nDEFEAT THE BOSS\n\nI hope you enjoyed this platformer :D

@Stage\n\nwhen flag clicked\nshow list [keycontrols v]\ndelete all of [npcshit v]\ndelete all of [tile coordinates v]\ndelete all of [star coins v]\nrepeat (3)\n    add [false] to [star coins v]\nend\nset [paused v] to [false]\nset [coins v] to [0]\nset [stars collected v] to [0]\n\nwhen I receive [tick v]\nif <(length of [npcshit v]) > [0]> then\n    delete (1) of [npcshit v]\nend\nset [mousex v] to (round (((mouse x) - (scrollX)) / (24)))\nset [mousey v] to (round (((mouse y) + (scrollY)) / (24)))\n\nwhen I receive [activategame v]\nforever\n    if <key (c v) pressed?> then\n        broadcast (changeCharacter v)\n        wait until <not <key (c v) pressed?>>\n    end\nend\n\nwhen I receive [playerdefeat v]\nstop [other scripts in sprite v]\n\nwhen I receive [you got a star! v]\nstop [other scripts in sprite v]\n\nwhen I receive [activategame v]\nforever\n    if <key (k v) pressed?> then\n        start sound [pause v]\n        set [paused v] to [true]\n        Edit Key Controls\n        set [paused v] to [false]\n        start sound [pause v]\n    end\nend\n\ndefine Edit Key Controls\nhide list [keycontrols v]\nask [Type in list # to edit a key input. Leave blank to cancel] and wait\nif <not <(answer) = []>> then\n    if <<(answer) > [0]> and <(answer) < ((length of [keycontrols v]) + (1))>> then\n        Change Key Input (answer)\n    else\n        ask [Invalid input. Please try again.] and wait\n        Edit Key Controls\n    end\nend\nshow list [keycontrols v]\n\ndefine Change Key Input (#)\nask (join [Type in a key to replace the ] (join (item (#) of [keycontrols v]) [ button.])) and wait\nreplace item (#) of [keycontrols v] with (answer)\nask [Success!] and wait\n\n@Map\n\nwhen flag clicked\nset [clone? v] to [false]\nset [base_posx v] to [0]\ndelete all of [mapsections v]\nSet Up Level\nbroadcast (loadLevel v) and wait\nbroadcast (activateGame v)\nhide\n\nwhen I start as a clone\nset [clone? v] to [true]\n\ndefine scrollEngine\nset [base_posx v] to (round ([abs v] of ((scrollX) / ((600) - (480))) ))\nset [i v] to [-1]\nrepeat (4)\n    if <(item ((base_posX) + (i)) of [mapsections v]) = [false]> then\n        switch costume to ((base_posX) + (i))\n        replace item ((base_posX) + (i)) of [mapsections v] with [true]\n        create clone of (_myself_ v)\n    end\n    change [i v] by (1)\nend\n\nrepeat until <([abs v] of (((440) * (costume [number v])) + (scrollX)) ) > [719]>\n    set x to (((440) * (costume [number v])) + (scrollX))\nend\nreplace item (costume [number v]) of [mapsections v] with [false]\ndelete this clone\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    set x to (((base_posX) * (720)) + (scrollX))\n    set y to ((((base_posY) * (360)) + (12)) + ((scrollY) * (-1)))\n    if <<([abs v] of ((x position) - (scrollX)) ) = ((base_posX) * (720))> and <not <(([abs v] of ((y position) + (scrollY)) ) - (6)) > (((base_posY) * (360)) + (12))>>> then\n        show\n    else\n        hide\n    end\nend\n\ndefine Set Up Level\nswitch costume to (join [Level] (join (Level #) [_0]))\nif <(Level #) = [1]> then\n    set [base_posy v] to [0]\n    set y to (11)\n    repeat (8)\n        create clone of (_myself_ v)\n        change [base_posx v] by (1)\n        next costume\n    end\n    set [base_posy v] to [1]\n    set [base_posx v] to [5]\n    switch costume to (level1_8 v)\n    create clone of (_myself_ v)\n    set [base_posx v] to [6]\n    switch costume to (level1_9 v)\n    create clone of (_myself_ v)\n    Init Scroll Bounds [116] [-5168] [385] [132]\nend\n\ndefine Init Scroll Bounds (startx) (endx) (endy) (spawnx)\nset [scrollx_start v] to (startx)\nset [scrollx_end v] to (endx)\nset [scrolly_end v] to (endy)\nset [scrollx v] to (spawnx)\nset [scrolly v] to [0]\nset [scrolllockx v] to [false]\nset [scrolllocky v] to [false]\n\nwait until <<not <key (left arrow v) pressed?>> and <not <key (right arrow v) pressed?>>>\n\nset [scrollx v] to (scrollX_End)\n\n@Map (Background)\n\nwhen I start as a clone\ngo to [back v] layer\nset [clone? v] to [true]\nset y to (11)\n\nwhen flag clicked\nswitch costume to (level1_0 v)\nset [clone? v] to [false]\nset [base_posx v] to [0]\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    set x to (((base_posX) * (720)) + (scrollX))\n    set y to ((((base_posY) * (360)) + (11)) + ((scrollY) * (-1)))\n    if <([abs v] of ((x position) - (scrollX)) ) = ((base_posX) * (720))> then\n        show\n    else\n        hide\n    end\nend\n\ndefine Set Up Layer\nif <(Level #) = [1]> then\n    set [base_posx v] to [0]\n    set [base_posy v] to [0]\n    repeat (8)\n        create clone of (_myself_ v)\n        change [base_posx v] by (1)\n        next costume\n    end\n    set [base_posx v] to [4]\n    set [base_posy v] to [1]\n    switch costume to (level1_8 v)\n    repeat (1)\n        create clone of (_myself_ v)\n        change [base_posx v] by (1)\n        next costume\n    end\n    set [base_posx v] to [5]\n    switch costume to (level1_9 v)\n    create clone of (_myself_ v)\n    set [base_posx v] to [6]\n    switch costume to (level1_10 v)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [loadlevel v]\nSet Up Layer\n\n@Player\n\ndefine Controls - Left and Right <blockedleft> <blockedright> <onfloor> <btnsdown>\nControls - Ground/Air Speed <key ((item (5) of [keycontrols v]) v) pressed?> <onfloor>\nif <<not <<(ducking?) = [true]> and <onfloor>>> and <not <(sliding?) = [true]>>> then\n    if <btnsdown> then\n        set [speed x v] to ((speed x) * (0.75))\n        if <<key ((item (1) of [keycontrols v]) v) pressed?> and <not <blockedleft>>> then\n            if <<<onfloor> and <(direction) = [90]>> and <<(dashTimer) > [9]> or <(Character) = [Luigi]>>> then\n                set [braking? v] to [true]\n                if <not <(holdingItem?) = [true]>> then\n                    Play Sound Effect [Braking]\n                end\n                if <(Character) = [Luigi]> then\n                    change [speed x v] by ((setSpeed) * (0.12))\n                else\n                    change [speed x v] by ((setSpeed) * (-0.1))\n                end\n            else\n                if <not <<(direction) = [-90]> and <(braking?) = [true]>>> then\n                    Controls - Aerial Momentum <onfloor> ((setSpeed) * (-1))\n                end\n            end\n        end\n        if <<key ((item (2) of [keycontrols v]) v) pressed?> and <not <blockedright>>> then\n            if <<<onfloor> and <(direction) = [-90]>> and <<(dashTimer) > [9]> or <(Character) = [Luigi]>>> then\n                set [braking? v] to [true]\n                if <not <(holdingItem?) = [true]>> then\n                    Play Sound Effect [Braking]\n                end\n                if <(Character) = [Luigi]> then\n                    change [speed x v] by ((setSpeed) * (-0.12))\n                else\n                    change [speed x v] by ((setSpeed) * (0.1))\n                end\n            else\n                if <not <<(direction) = [90]> and <(braking?) = [true]>>> then\n                    Controls - Aerial Momentum <onfloor> (setSpeed)\n                end\n            end\n        end\n    else\n        if <onfloor> then\n            if <(Character) = [Luigi]> then\n                set [speed x v] to ((speed x) * (0.95))\n            else\n                set [speed x v] to ((speed x) * (0.85))\n            end\n        else\n            set [speed x v] to ((speed x) * (1))\n        end\n    end\nelse\n    if <onfloor> then\n        if <(sliding?) = [true]> then\n            Controls - Sliding <onfloor>\n        else\n            set [speed x v] to ((speed x) * (0.9))\n        end\n    end\nend\n\ndefine Controls - Jump, Crouch\nif <<key ((item (3) of [keycontrols v]) v) pressed?> or <key ((item (6) of [keycontrols v]) v) pressed?>> then\n    if <not <(physicsType) = [water]>> then\n        if <<(jump key) = [0]> and <(falling?) < [3]>> then\n            if <(physicsType) = [default]> then\n                set [speed y v] to ((setJumpHeight) + (([abs v] of (speed x) ) * (0.2)))\n            else\n                Controls - Low Gravity\n            end\n            Play Sound Effect [Jump]\n            set [falling? v] to [6]\n            if <(sliding?) = [true]> then\n                set [sliding? v] to [false]\n                if <<<key ((item (1) of [keycontrols v]) v) pressed?> and <(speed x) < [0]>> or <<key ((item (2) of [keycontrols v]) v) pressed?> and <(speed x) > [0]>>> then\n                    set [speed x v] to ((speed x) * (2.5))\n                else\n                    set [speed x v] to ((speed x) * (0.4))\n                end\n            end\n            set [jump key v] to [1]\n        end\n    else\n        Controls - Swim Stroke <<(jump key) = [0]> and <not <(ducking?) = [true]>>>\n    end\nelse\n    set [jump key v] to [0]\nend\nif <(falling?) < [3]> then\n    if <<key ((item (4) of [keycontrols v]) v) pressed?> and <<not <(sliding?) = [true]>> and <(animOverride) = [none]>>> then\n        set [ducking? v] to [true]\n        if <<<<touching (gentle slope \(-\) v)?> or <touching (gentle slope \(+\) v)?>> or <<touching (steep slope \(-\) v)?> or <touching (steep slope \(+\) v)?>>> and <not <(sliding?) = [true]>>> then\n            set [sliding? v] to [true]\n            set [speed x v] to [0]\n        end\n    else\n        if <<(ducking?) = [true]> and <(item (1) of [playersensing v]) = [true]>> then\n            set [ducking? v] to [true]\n        else\n            set [ducking? v] to [false]\n        end\n    end\nend\n\ndefine Gravity\nif <(falling?) < [3]> then\n    set [setfallspeed v] to [-2]\nelse\n    set [setfallspeed v] to (initFallSpeed)\n    if <(physicsType) = [water]> then\n        set [setfallspeed v] to ((setFallSpeed) * (0.6))\n    end\n    if <(physicsType) = [space]> then\n        if <not <(Character) = [Luigi]>> then\n            set [setfallspeed v] to ((setFallSpeed) * (0.55))\n        else\n            set [setfallspeed v] to ((setFallSpeed) * (0.58))\n        end\n    end\nend\nif <not <(wallSlide?) = [true]>> then\n    if <(speed y) > [-35]> then\n        if <<(speed y) < [4]> or <<key ((item (3) of [keycontrols v]) v) pressed?> or <key ((item (6) of [keycontrols v]) v) pressed?>>> then\n            change [speed y v] by ((setFallSpeed) + (1))\n        else\n            change [speed y v] by (setFallSpeed)\n        end\n    end\nelse\n    if <(speed y) < [0]> then\n        set [speed y v] to [-2.5]\n    end\nend\nScrollY Check <(scrollLockY) = [false]> (speed y)\nif <not <(wallSlide?) = [true]>> then\n    change [falling? v] by (1)\nelse\n    set [falling? v] to [7]\nend\n\ndefine Check Hit Ceiling / Floor <up?> <collisionactive>\nGet Touching \nif <(touch) = [0]> then\n    set [in platforrm v] to [1]\nelse\n    if <<up?> and <(touch) = [1]>> then\n        set [in platforrm v] to [2]\n    end\nend\nrepeat until <(touch) < (in platforrm)>\n    change [collisiontimeout v] by (1)\n    if <(collisionTimeout) > [99]> then\n        broadcast (playerDefeat v)\n    end\n    if <up?> then\n        ScrollY Check <(scrollLockY) = [false]> [-1]\n    else\n        ScrollY Check <(scrollLockY) = [false]> [1]\n        set [falling? v] to [0]\n    end\n    Get Touching <not <up?>>\n    set [speed y v] to [0]\nend\nset [collisiontimeout v] to [0]\nif <not <(scrollLockY) = [true]>> then\n    set y to (0)\nend\n\ndefine Get Touching <check platform?>\nif <<touching (map v)?> or <<touching (terrain v)?> or <touching (blocks v)?>>> then\n    set [touch v] to [9]\nelse\n    if <<check platform?> and <touching (semi-solids v)?>> then\n        set [touch v] to [1]\n    else\n        set [touch v] to [0]\n    end\nend\n\ndefine Reset Level\nset size to (200) %\npoint in direction (90)\nset rotation style [left-right v]\ngo to x: (-100) y: (-25)\nreset timer\nshow\nset [setdirection v] to [90]\nset [speed x v] to [0]\nset [speed y v] to [0]\nInit Player Stats\nset [collisiontimeout v] to [0]\nset [recoverytimer v] to [0]\nset [mousejustdown v] to [false]\nset [braking? v] to [false]\nset [falling? v] to [10]\nset [sliding? v] to [false]\nset [wallslide? v] to [false]\nset [holdingitem? v] to [false]\nset [in platforrm v] to [1]\nset [setfallspeed v] to [0]\nset [frame v] to [0]\nset [wall jump v] to [0]\nset [initseperation v] to [false]\nset [ducking? v] to [false]\nset [running? v] to [false]\nset [framespeed v] to [0.87]\nset [dashtimer v] to [0]\nset [status v] to [none]\nset [physicstype v] to [default]\nset [mousenumpress v] to [0]\nset [numfireballs v] to [0]\nset [fireball_cooldown v] to [0]\nset [animoverride v] to [none]\n\ndefine ScrollX Check <withinscrollrange> (speed)\nif <withinscrollrange> then\n    change [scrollx v] by ((speed) * (-1))\n    change x by (speed)\nelse\n    change x by (speed)\nend\n\ndefine ScrollLock Check (orgscrolllock)\nif < (orgscrolllock) contains [X: false]?> then\n    if <<(scrollX) > ((scrollX_Start) - (1))> or <(scrollX) < ((scrollX_End) + (1))>> then\n        if <(scrollX) > ((scrollX_Start) - (1))> then\n            set [scrollx v] to (scrollX_Start)\n        else\n            set [scrollx v] to (scrollX_End)\n        end\n        set [scrolllockx v] to [true]\n    end\nelse\n    if <<(x position) > [0]> and <(scrollX) > ((scrollX_Start) - (1))>> then\n        set [scrolllockx v] to [false]\n        set x to (0)\n    else\n        if <<(x position) < [0]> and <(scrollX) < ((scrollX_End) + (1))>> then\n            set [scrolllockx v] to [false]\n            set x to (0)\n        end\n    end\nend\nif < (orgscrolllock) contains [Y: false]?> then\n    if <<(scrollY) < [1]> or <(scrollY) > ((scrollY_End) - (1))>> then\n        if <(scrollY) < [1]> then\n            set [scrolly v] to [0]\n        else\n            set [scrolly v] to (scrollY_End)\n        end\n        set [scrolllocky v] to [true]\n    end\nelse\n    if <<(y position) > [0]> and <<(scrollY) > [-1]> and <(scrollY) < (scrollY_End)>>> then\n        set [scrolllocky v] to [false]\n        set y to (0)\n    else\n        if <<(y position) < [0]> and <((scrollY) + (1)) > (scrollY_End)>> then\n            set [scrolllocky v] to [false]\n            set y to (0)\n        end\n    end\nend\n\nset y to (0)\nset [scrolllocky v] to [true]\n\ndefine ScrollY Check <withinscrollrange> (speed)\nif <withinscrollrange> then\n    change [scrolly v] by (speed)\n    change y by (speed)\nelse\n    change y by (speed)\nend\n\ndefine Set Hitbox\nif <(Power) = [Small]> then\n    if <not <(ducking?) = [true]>> then\n        switch costume to (small v)\n    else\n        switch costume to (small_duck v)\n    end\nelse\n    if <not <(ducking?) = [true]>> then\n        switch costume to (main v)\n    else\n        switch costume to (small v)\n    end\nend\n\ndefine Controls - Ground/Air Speed <dashbtndown> <onfloor>\nif <(physicsType) = [default]> then\n    if <onfloor> then\n        set [setspeed v] to (initSpeed)\n    else\n        set [setspeed v] to ((initSpeed) - (0.1))\n    end\nelse\n    set [setspeed v] to ((initSpeed) * (0.5))\nend\nif <(braking?) = [true]> then\n    if <<<(direction) = [90]> and <(speed x) < [1]>> or <<(direction) = [-90]> and <(speed x) > [-1]>>> then\n        point in direction ((direction) * (-1))\n        set [speed x v] to [0]\n        set [dashtimer v] to [0]\n        set [braking? v] to [false]\n    end\nend\nif <<dashbtndown> and <not <(ducking?) = [true]>>> then\n    if <<(dashTimer) < (dashTimerTarget)> and <<onfloor> and <<([abs v] of (round (speed x)) ) > [1]> and <not <(braking?) = [true]>>>>> then\n        change [dashtimer v] by (1)\n    end\n    if <(dashTimer) > ((dashTimer) - (1))> then\n        set [setspeed v] to ((setSpeed) * (1.5))\n    else\n        set [setspeed v] to ((setSpeed) * ((1) + ((dashTimer) / (100))))\n    end\nelse\n    if <onfloor> then\n        if <<(dashTimer) > [0]> and <not <(ducking?) = [true]>>> then\n            change [dashtimer v] by (-1)\n        else\n            set [dashtimer v] to [0]\n        end\n    end\nend\nset [running? v] to <<<(dashTimer) = (dashTimerTarget)> or <(dashTimer) > (dashTimerTarget)>> and <not <(physicsType) = [water]>>>\n\ndefine Controls - Wall KIck (vectorx) <hitceiling> <facingwall>\nif <<<<key ((item (3) of [keycontrols v]) v) pressed?> or <key ((item (6) of [keycontrols v]) v) pressed?>> and <facingwall>> and <<(jump key) = [0]> and <not <hitceiling>>>> then\n    if <(vectorx) > [0]> then\n        set [speed x v] to [-6]\n        Create Effect (round ((((x position) + (12)) - (scrollX)) / (24))) (round ((((y position) + (12)) + (scrollY)) / (24)))\n    else\n        set [speed x v] to [6]\n        Create Effect ((round (((x position) + (12)) - (scrollX))) / (24)) (round ((((y position) + (12)) + (scrollY)) / (24)))\n    end\n    set [speed y v] to [11]\n    set [falling? v] to [6]\n    set [wall jump v] to [15]\n    set [jump key v] to [1]\n    set [setdirection v] to ((setDirection) * (-1))\n    Play Sound Effect [Jump]\nelse\n    set [speed x v] to [0]\nend\nif <(running?) = [true]> then\n    set [dashtimer v] to [0]\n    set [running? v] to [false]\nend\n\ndefine Check Wall Collision <!onfloor> <hitleft> <hitright>\nif <<!onfloor> and <(wall jump) = [0]>> then\n    if <<hitleft> and <(item (2) of [playersensing v]) = [true]>> then\n        ScrollX Check <(scrollLockX) = [false]> [1]\n    else\n        if <<hitright> and <(item (3) of [playersensing v]) = [true]>> then\n            ScrollX Check <(scrollLockX) = [false]> [-1]\n        end\n    end\nend\n\nCheck Wall Collision <(falling?) > [3]> <<(direction) = [-90]> and <(speed x) < [0]>> <<(direction) = [90]> and <(speed x) > [0]>>\n\ndefine Init Player Stats\nif <(Character) = [Mario]> then\n    set [initspeed v] to [1.25]\n    set [setjumpheight v] to [14]\n    set [dashtimertarget v] to [30]\n    set [initfallspeed v] to [-2]\nend\nif <(Character) = [Luigi]> then\n    set [initspeed v] to [1.15]\n    set [setjumpheight v] to [13.5]\n    set [dashtimertarget v] to [35]\n    set [initfallspeed v] to [-1.85]\nend\nif <(Character) = [Toad]> then\n    set [initspeed v] to [1.38]\n    set [setjumpheight v] to [16.25]\n    set [dashtimertarget v] to [40]\n    set [initfallspeed v] to [-2.5]\nend\n\ndefine Controls - Swim Stroke <keyup>\nif <keyup> then\n    if <(Character) = [Toad]> then\n        set [speed y v] to ((setJumpHeight) * (0.45))\n    else\n        set [speed y v] to ((setJumpHeight) * (0.3))\n    end\n    set [falling? v] to [6]\n    set [jump key v] to [1]\nend\n\nset [character v] to [Mario]\nInit Player Stats\n\nset [character v] to [Mario]\n\ndefine Controls - Low Gravity\nif <(Character) = [Mario]> then\n    set [speed y v] to (((setJumpHeight) * (0.35)) + (([abs v] of (speed x) ) * (0.2)))\nend\nif <(Character) = [Luigi]> then\n    set [speed y v] to (((setJumpHeight) * (0.38)) + (([abs v] of (speed x) ) * (0.2)))\nend\nif <(Character) = [Toad]> then\n    set [speed y v] to (((setJumpHeight) * (0.6)) + (([abs v] of (speed x) ) * (0.2)))\nend\n\nset [setjumpheight v] to [16.25]\nset [dashtimertarget v] to [40]\nset [initfallspeed v] to [-2.5]\n\ndefine Walk (direction) (speed) max steep (max steep) <hitceiling> (framespeed)\nif <<not <(braking?) = [true]>> and <not <(sliding?) = [true]>>> then\n    point in direction (direction)\nend\nScrollX Check <(scrollLockX) = [false]> (speed)\nchange [frame v] by (([abs v] of (speed) ) / (framespeed))\nset [slope v] to [0]\nGet Touching <(in platforrm) = [1]>\nrepeat until <<(slope) = (max steep)> or <(touch) = [0]>>\n    ScrollY Check <(scrollLockY) = [false]> [1]\n    change [slope v] by (1)\n    Get Touching <(in platforrm) = [1]>\nend\nif <(slope) = (max steep)> then\n    ScrollX Check <(scrollLockX) = [false]> ((0) - (speed))\n    ScrollY Check <(scrollLockY) = [false]> ((0) - (slope))\n    if <<(touch) = [1]> and <(in platforrm) = [1]>> then\n        set [in platforrm v] to [2]\n        Walk (direction) (speed) max steep (max steep) <> (frameSpeed)\n        if <(speed x) = [0]> then\n            set [in platforrm v] to [1]\n        end\n    else\n        set [speed x v] to [0]\n    end\nend\nif <not <(scrollLockX) = [true]>> then\n    set x to (0)\nend\n\nwhen I receive [playerstomp v]\nPlay Sound Effect [Stomp]\nif <<key ((item (3) of [keycontrols v]) v) pressed?> or <key ((item (6) of [keycontrols v]) v) pressed?>> then\n    set [speed y v] to ((setJumpHeight) * (0.98))\nelse\n    set [speed y v] to ((setJumpHeight) * (0.8))\nend\n\nwhen I receive [playerdefeat v]\nstop [other scripts in sprite v]\nswitch costume to (main v)\nstart sound [Defeat v]\nwait (0.8) seconds\nstart sound (join (Character) [_Defeat])\nset [falling? v] to [0]\nset [speed y v] to [25]\nif <(y position) > [-172]> then\n    repeat until <(y position) < [-178]>\n        set [falling? v] to [0]\n        Gravity\n    end\nend\n\ndefine Controls - Aerial Momentum <onfloor> (speed)\nif <onfloor> then\n    change [speed x v] by (speed)\nelse\n    if <<<(speed) < [0]> and <(speed x) < [0]>> or <<(speed) > [0]> and <(speed x) > [0]>>> then\n        change [speed x v] by (speed)\n    else\n        if <not <(Character) = [Toad]>> then\n            change [speed x v] by ((speed) * (0.25))\n        else\n            change [speed x v] by ((speed) * (0.15))\n        end\n    end\nend\n\ndefine Direction Config <onfloor>\nif <(wall jump) = [0]> then\n    if <key ((item (1) of [keycontrols v]) v) pressed?> then\n        set [setdirection v] to [-90]\n    else\n        if <key ((item (2) of [keycontrols v]) v) pressed?> then\n            set [setdirection v] to [90]\n        end\n    end\nelse\n    if <(speed x) < [0]> then\n        set [setdirection v] to [-90]\n    else\n        set [setdirection v] to [90]\n    end\nend\n\ndefine Mouse Input Config\nif <mouse down?> then\n    if <(mouseNumPress) < [100]> then\n        change [mousenumpress v] by (1)\n    end\nelse\n    set [mousenumpress v] to [0]\nend\nset [mousejustdown v] to <(mouseNumPress) = [1]>\n\ndefine Controls - Sliding <onfloor>\nif <touching (gentle slope \(-\) v)?> then\n    change [speed x v] by ((initSpeed) / (-2.2))\nelse\n    if <touching (gentle slope \(+\) v)?> then\n        change [speed x v] by ((initSpeed) / (2.2))\n    else\n        if <touching (steep slope \(-\) v)?> then\n            change [speed x v] by ((initSpeed) / (-1))\n        else\n            if <touching (steep slope \(+\) v)?> then\n                change [speed x v] by ((initSpeed) / (1))\n            else\n                if <onfloor> then\n                    if <(speed x) > [0]> then\n                        change [speed x v] by ((initSpeed) / (-1.4))\n                    else\n                        change [speed x v] by ((initSpeed) / (1.4))\n                    end\n                    if <([abs v] of (speed x) ) < [2]> then\n                        set [sliding? v] to [false]\n                    end\n                else\n                    set [sliding? v] to [false]\n                end\n            end\n        end\n    end\nend\nchange [speed y v] by (-10)\n\ndefine Controls - Wall Slide <facingleft> <facingright>\nif <<not <hitceiling>> and <(speed y) < [0]>> then\n    set [wallslide? v] to <<<<facingleft> and <(item (2) of [playersensing v]) = [true]>> or <<facingright> and <(item (3) of [playersensing v]) = [true]>>> and <not <(holdingItem?) = [true]>>>\nelse\n    set [wallslide? v] to [false]\nend\nif <(wallSlide?) = [true]> then\n    set [ducking? v] to [false]\n    set [speed x v] to [0]\n    Controls - Wall KIck (direction) <(item (1) of [playersensing v]) = [true]> <<facingleft> or <facingright>>\nend\n\nset [power v] to [Small]\n\ndefine Play Sound Effect (type)\nif <(type) = [Jump]> then\n    start sound [Jump v]\n    if <<not <(Power) = [Small]>> and <not <(ducking?) = [true]>>> then\n        start sound (join (join (Character) [_Jump]) (pick random (0) to (2)))\n    end\nelse\n    if <(type) = [Hurt]> then\n        start sound [Hurt v]\n        start sound (join (join (Character) [_Hurt]) (pick random (0) to (1)))\n    else\n        if <(type) = [Defeat]> then\n            start sound [Defeat v]\n        else\n            start sound (type)\n        end\n    end\nend\n\nwhen I receive [setholdingitem v]\nset [holdingitem? v] to [true]\n\ndefine Controls - Carrying Item <btndown>\nif <(holdingItem?) = [true]> then\n    if <not <btndown>> then\n        set [holdingitem? v] to [false]\n    end\nend\n\nwhen I receive [deactivateholdingitem v]\nset [holdingitem? v] to [false]\n\ndefine Controls - Launch Projectile (btn)\nif <(fireball_Cooldown) > [0]> then\n    change [fireball_cooldown v] by (-1)\n    if <(fireball_Cooldown) = [0]> then\n        set [fireball_cooldown v] to [0]\n        set [numfireballs v] to [0]\n    end\nend\nif <key ((btn) v) pressed?> then\n    if <<not <(holdingItem?) = [true]>> and <<<not <(wallSlide?) = [true]>> and <(launch key) = [0]>> and <not <<(fireball_Cooldown) > [0]> and <(numFireballs) = [2]>>>>> then\n        if <(Power) = [Fire]> then\n            change [numfireballs v] by (1)\n            if <(numFireballs) = [1]> then\n                set [fireball_cooldown v] to [10]\n            end\n            if <(numFireballs) = [2]> then\n                set [fireball_cooldown v] to [30]\n            end\n            broadcast (playerProjectile v)\n            set [animoverride v] to [Shoot]\n            broadcast (animOverride v)\n        end\n    end\n    set [launch key v] to [1]\nelse\n    set [launch key v] to [0]\nend\n\nwhen I receive [activategame v]\nset [ghost v] effect to (100)\nset [character v] to [Mario]\nset [power v] to [Small]\nReset Level\nforever\n    Controls - Jump, Crouch\n    Gravity\n    Check Hit Ceiling / Floor <(speed y) > [0]> <(initSeperation) = [true]>\n    Player Recovery\n    if <(y position) < [-175]> then\n        broadcast (playerDefeat v)\n    end\n    if <(wall jump) > [0]> then\n        change [wall jump v] by (-1)\n    else\n        Controls - Left and Right <(item (2) of [playersensing v]) = [true]> <(item (3) of [playersensing v]) = [true]> <(falling?) < [3]> <<key ((item (1) of [keycontrols v]) v) pressed?> or <key ((item (2) of [keycontrols v]) v) pressed?>>\n    end\n    Mouse Input Config\n    Direction Config <(falling?) < [3]>\n    if <(speed x) < [-0.5]> then\n        Walk (setDirection) (speed x) max steep (([ceiling v] of ([abs v] of ((speed x) * (1.3)) ) ) + (1)) <(item (1) of [playersensing v]) = [true]> (frameSpeed)\n    else\n        if <(speed x) > [0.5]> then\n            Walk (setDirection) (speed x) max steep (([ceiling v] of ([abs v] of ((speed x) * (1.3)) ) ) + (1)) <(item (3) of [playersensing v]) = [true]> (frameSpeed)\n        else\n            set [frame v] to [0]\n        end\n    end\n    Controls - Launch Projectile (item (5) of [keycontrols v])\n    Controls - Carrying Item <key ((item (5) of [keycontrols v]) v) pressed?>\n    Controls - Wall Slide <<(direction) = [-90]> and <key ((item (1) of [keycontrols v]) v) pressed?>> <<(direction) = [90]> and <key ((item (2) of [keycontrols v]) v) pressed?>>\n    ScrollLock Check (join (join [X: ] (scrollLockX)) (join [, Y: ] (scrollLockY)))\n    Set Hitbox\n    broadcast (tick v)\n    wait until <not <(Paused) = [true]>>\nend\n\nwhen I receive [power_mushroom v]\nset [power v] to [Super]\n\nwhen I receive [power_fire v]\nset [power v] to [Fire]\n\nwhen I receive [playerdamage v]\nif <(recoveryTimer) = [0]> then\n    if <(Power) = [Small]> then\n        broadcast (playerDefeat v)\n    else\n        Play Sound Effect [Hurt]\n        if <(Power) = [Super]> then\n            set [power v] to [Small]\n        else\n            set [power v] to [Super]\n        end\n        set [recoverytimer v] to [1]\n    end\nend\n\ndefine Player Recovery\nif <(recoveryTimer) > [0]> then\n    change [recoverytimer v] by (1)\n    if <(recoveryTimer) > [99]> then\n        set [recoverytimer v] to [0]\n    end\nend\n\ndefine Create Effect (x) (y)\nadd (join [1:] (join (x) (join [,] (y)))) to [effectsgroup v]\n\nset [setjumpheight v] to [50]\n\nset y to (0)\n\nwhen I receive [you got a star! v]\nstop [other scripts in sprite v]\n\nwhen I receive [changecharacter v]\nif <(Character) = [Mario]> then\n    set [character v] to [Luigi]\nelse\n    if <(Character) = [Luigi]> then\n        set [character v] to [Toad]\n    else\n        set [character v] to [Mario]\n    end\nend\nInit Player Stats\n\n@Border\n\nwhen I receive [tick v]\ngo to [front v] layer\n\nwhen flag clicked\nset [brightness v] effect to (100)\n\nwhen I receive [playerdefeat v]\nwait (0.01) seconds\ngo to [front v] layer\n\n@Sensors\n\nwhen flag clicked\nswitch costume to (top_small v)\nset [clone? v] to [false]\nset [sensor # v] to [1]\ndelete all of [playersensing v]\nrepeat (3)\n    add [false] to [playersensing v]\n    create clone of (_myself_ v)\n    change [sensor # v] by (1)\n    next costume\nend\n\nwhen I start as a clone\nset [clone? v] to [true]\nset [ghost v] effect to (100)\nset size to (150) %\nshow\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    replace item (Sensor #) of [playersensing v] with <<touching (map v)?> or <touching (blocks v)?>>\n    Costume Config ([power v] of [player v]) <([ducking? v] of [player v]) = [true]>\n    go to (player v)\nend\n\ndefine Costume Config (ppower) <crouchactive>\nif <(Sensor #) = [1]> then\n    if <(ppower) = [Small]> then\n        if <not <crouchactive>> then\n            switch costume to (top_small v)\n        else\n            switch costume to (top_smallduck v)\n        end\n    else\n        if <not <crouchactive>> then\n            switch costume to (top_main v)\n        else\n            switch costume to (top_small v)\n        end\n    end\nend\nif <(Sensor #) = [2]> then\n    if <<(ppower) = [Small]> or <crouchactive>> then\n        switch costume to (left_small v)\n    else\n        switch costume to (left_main v)\n    end\nend\nif <(Sensor #) = [3]> then\n    if <<(ppower) = [Small]> or <crouchactive>> then\n        switch costume to (right_small v)\n    else\n        switch costume to (right_main v)\n    end\nend\n\n@Mario\n\nwhen I receive [tick v]\nif <(Character) = [Mario]> then\n    if <(animOverride) = [none]> then\n        point in direction ([direction v] of [player v])\n    end\n    set rotation style [left-right v]\n    Set Position ([power v] of [player v])\n    if <(animOverrideLoop) = [0]> then\n        if <([status v] of [player v]) = [none]> then\n            if <not <([holdingitem? v] of [player v]) = [true]>> then\n                Basic Animation Config\n            else\n                Holding Item Anim ([power v] of [player v])\n            end\n        else\n            Status Anim Config ([status v] of [player v])\n        end\n    else\n        animOverride Config\n    end\n    show\nelse\n    hide\nend\n\ndefine Basic Animation Config\nif <<not <([ducking? v] of [player v]) = [true]>> and <not <([sliding? v] of [player v]) = [true]>>> then\n    if <([falling? v] of [player v]) < [6]> then\n        if <not <([braking? v] of [player v]) = [true]>> then\n            if <([frame v] of [player v]) = [0]> then\n                Play Anim [Idle] [1]\n            else\n                if <not <([running? v] of [player v]) = [true]>> then\n                    if <([power v] of [player v]) = [Small]> then\n                        Play Anim [Walk] [2]\n                    else\n                        Play Anim [Walk] [3]\n                    end\n                else\n                    if <([power v] of [player v]) = [Small]> then\n                        Play Anim [Run] [2]\n                    else\n                        Play Anim [Run] [3]\n                    end\n                end\n            end\n        else\n            Play Anim [Brake] [1]\n        end\n    else\n        if <not <([running? v] of [player v]) = [true]>> then\n            if <not <([wallslide? v] of [player v]) = [true]>> then\n                Play Anim [Jump] [1]\n            else\n                Play Anim [Brake] [1]\n            end\n        else\n            Play Anim [RunJump] [1]\n        end\n    end\nelse\n    if <([sliding? v] of [player v]) = [true]> then\n        Play Anim [Slide] [1]\n    else\n        Play Anim [Duck] [1]\n    end\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (join ([power v] of [player v]) (join [_] (costume))) ([floor v] of (([frame v] of [player v]) mod (framecount)) ))\n    if <([power v] of [player v]) = [Small]> then\n        set [framespeed v] to ((framecount) * (10))\n    else\n        set [framespeed v] to ((framecount) * (6))\n    end\nelse\n    switch costume to (join ([power v] of [player v]) (join [_] (costume)))\n    set [framespeed v] to [1]\nend\n\ndefine Set Position (ppower)\nset x to ([x position v] of [player v])\nif <(ppower) = [Small]> then\n    set y to (([y position v] of [player v]) - (2))\nelse\n    set y to (([y position v] of [player v]) + (8))\nend\n\ndefine Status Anim Config (pstate)\nif <(pstate) = [Swim]> then\n    Swim Anim Config ([power v] of [player v]) <([falling? v] of [player v]) < [3]>\nelse\n    if <(ppower) = [Small]> then\n        Play Anim (pstate) [2]\n    else\n        Play Anim (pstate) [3]\n    end\nend\n\ndefine Swim Anim Config (ppower) <onfloor>\nif <not <onfloor>> then\n    if <(ppower) = [Small]> then\n        Play Anim [Swim] [2]\n    else\n        Play Anim [Swim] [2]\n    end\nelse\n    Basic Animation Config\nend\n\nwhen flag clicked\nhide\n\ndefine animOverride Config\nif <(animOverride) = [Shoot]> then\n    change [animoverrideloop v] by ((3) / (12))\n    Play Special Anim [Shoot] [2] [0]\n    if <(animOverrideLoop) > [3]> then\n        set [animoverrideloop v] to [0]\n        set [animoverride v] to [none]\n    end\nelse\n    change [animoverrideloop v] by (1)\n    Play Anim (animOverride) [1]\n    if <(animOverrideLoop) > [10]> then\n        set [animoverrideloop v] to [0]\n        set [animoverride v] to [none]\n    end\nend\n\ndefine Play Special Anim (costume) (framecount) (rate)\nswitch costume to (join (join ([power v] of [player v]) (join [_] (costume))) ([floor v] of ((animOverrideLoop) mod (framecount)) ))\n\nwhen I receive [animoverride v]\nif <not <(animOverride) = [none]>> then\n    if <(Character) = [Mario]> then\n        if <(animOverride) = [Shoot]> then\n            set [animoverrideloop v] to [2]\n        else\n            set [animoverrideloop v] to [1]\n        end\n    end\nend\n\ndefine Holding Item Anim (ppower)\nif <not <([ducking? v] of [player v]) = [true]>> then\n    if <([falling? v] of [player v]) < [6]> then\n        if <(ppower) = [Small]> then\n            Play Anim [Grab] [2]\n        else\n            Play Anim [Grab] [3]\n        end\n    else\n        if <(ppower) = [Small]> then\n            Play Anim [Grab1] [1]\n        else\n            Play Anim [Grab2] [1]\n        end\n    end\nelse\n    Play Anim [CarryDuck] [1]\nend\n\nwhen I receive [playerdefeat v]\nif <(Character) = [Mario]> then\n    stop [other scripts in sprite v]\n    clear graphic effects\n    switch costume to (small_defeat v)\n    go to [front v] layer\n    repeat until <([y position v] of [player v]) < [-178]>\n        Set Position [Small]\n    end\n    hide\nend\n\nwhen I receive [playerdamage v]\nif <(Character) = [Mario]> then\n    wait (0.001) seconds\n    repeat until <([recoverytimer v] of [player v]) = [0]>\n        set [ghost v] effect to (100)\n        wait ((1) / ([recoverytimer v] of [player v])) seconds\n        set [ghost v] effect to (0)\n    end\n    set [ghost v] effect to (0)\nend\n\n@Luigi\n\nwhen I receive [tick v]\nif <(Character) = [Luigi]> then\n    if <(animOverride) = [none]> then\n        point in direction ([direction v] of [player v])\n    end\n    set rotation style [left-right v]\n    Set Position ([power v] of [player v])\n    if <(animOverrideLoop) = [0]> then\n        if <([status v] of [player v]) = [none]> then\n            if <not <([holdingitem? v] of [player v]) = [true]>> then\n                Basic Animation Config\n            else\n                Holding Item Anim ([power v] of [player v])\n            end\n        else\n            Status Anim Config ([status v] of [player v])\n        end\n    else\n        animOverride Config\n    end\n    show\nelse\n    hide\nend\n\ndefine Basic Animation Config\nif <<not <([ducking? v] of [player v]) = [true]>> and <not <([sliding? v] of [player v]) = [true]>>> then\n    if <([falling? v] of [player v]) < [6]> then\n        if <not <([braking? v] of [player v]) = [true]>> then\n            if <([frame v] of [player v]) = [0]> then\n                Play Anim [Idle] [1]\n            else\n                if <not <([running? v] of [player v]) = [true]>> then\n                    if <([power v] of [player v]) = [Small]> then\n                        Play Anim [Walk] [2]\n                    else\n                        Play Anim [Walk] [3]\n                    end\n                else\n                    if <([power v] of [player v]) = [Small]> then\n                        Play Anim [Run] [2]\n                    else\n                        Play Anim [Run] [3]\n                    end\n                end\n            end\n        else\n            Play Anim [Brake] [1]\n        end\n    else\n        if <not <([running? v] of [player v]) = [true]>> then\n            if <not <([wallslide? v] of [player v]) = [true]>> then\n                Play Anim [Jump] [1]\n            else\n                Play Anim [Brake] [1]\n            end\n        else\n            Play Anim [RunJump] [1]\n        end\n    end\nelse\n    if <([sliding? v] of [player v]) = [true]> then\n        Play Anim [Slide] [1]\n    else\n        Play Anim [Duck] [1]\n    end\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (join ([power v] of [player v]) (join [_] (costume))) ([floor v] of (([frame v] of [player v]) mod (framecount)) ))\n    if <([power v] of [player v]) = [Small]> then\n        set [framespeed v] to ((framecount) * (10))\n    else\n        set [framespeed v] to ((framecount) * (6))\n    end\nelse\n    switch costume to (join ([power v] of [player v]) (join [_] (costume)))\n    set [framespeed v] to [1]\nend\n\ndefine Set Position (ppower)\nset x to ([x position v] of [player v])\nif <(ppower) = [Small]> then\n    set y to (([y position v] of [player v]) - (2))\nelse\n    set y to (([y position v] of [player v]) + (11))\nend\n\ndefine Status Anim Config (pstate)\nif <(pstate) = [Swim]> then\n    Swim Anim Config ([power v] of [player v]) <([falling? v] of [player v]) < [3]>\nelse\n    if <(ppower) = [Small]> then\n        Play Anim (pstate) [2]\n    else\n        Play Anim (pstate) [3]\n    end\nend\n\ndefine Swim Anim Config (ppower) <onfloor>\nif <not <onfloor>> then\n    if <(ppower) = [Small]> then\n        Play Anim [Swim] [2]\n    else\n        Play Anim [Swim] [2]\n    end\nelse\n    Basic Animation Config\nend\n\nwhen flag clicked\nset [animoverrideloop v] to [0]\nhide\n\ndefine Play Special Anim (costume) (framecount) (rate)\nswitch costume to (join (join ([power v] of [player v]) (join [_] (costume))) ([floor v] of ((animOverrideLoop) mod (framecount)) ))\n\ndefine animOverride Config\nif <(animOverride) = [Shoot]> then\n    change [animoverrideloop v] by ((3) / (12))\n    Play Special Anim [Shoot] [2] [0]\n    if <(animOverrideLoop) > [3]> then\n        set [animoverrideloop v] to [0]\n        set [animoverride v] to [none]\n    end\nelse\n    change [animoverrideloop v] by (1)\n    Play Anim (animOverride) [1]\n    if <(animOverrideLoop) > [10]> then\n        set [animoverrideloop v] to [0]\n        set [animoverride v] to [none]\n    end\nend\n\nwhen I receive [animoverride v]\nif <not <(animOverride) = [none]>> then\n    if <(Character) = [Luigi]> then\n        if <(animOverride) = [Shoot]> then\n            set [animoverrideloop v] to [2]\n        else\n            set [animoverrideloop v] to [1]\n        end\n    end\nend\n\nwhen I receive [playerdefeat v]\nif <(Character) = [Luigi]> then\n    stop [other scripts in sprite v]\n    switch costume to (small_defeat v)\n    clear graphic effects\n    go to [front v] layer\n    repeat until <([y position v] of [player v]) < [-178]>\n        Set Position [Small]\n    end\n    hide\nend\n\ndefine Holding Item Anim (ppower)\nif <not <([ducking? v] of [player v]) = [true]>> then\n    if <([falling? v] of [player v]) < [6]> then\n        if <(ppower) = [Small]> then\n            Play Anim [Grab] [2]\n        else\n            Play Anim [Grab] [3]\n        end\n    else\n        if <(ppower) = [Small]> then\n            Play Anim [Grab1] [1]\n        else\n            Play Anim [Grab2] [1]\n        end\n    end\nelse\n    Play Anim [CarryDuck] [1]\nend\n\nwhen I receive [playerdamage v]\nif <(Character) = [Luigi]> then\n    wait (0.001) seconds\n    repeat until <([recoverytimer v] of [player v]) = [0]>\n        set [ghost v] effect to (100)\n        wait ((1) / ([recoverytimer v] of [player v])) seconds\n        set [ghost v] effect to (0)\n    end\n    set [ghost v] effect to (0)\nend\n\n@Toad\n\nwhen I receive [tick v]\nif <(Character) = [Toad]> then\n    if <(animOverride) = [none]> then\n        point in direction ([direction v] of [player v])\n    end\n    set rotation style [left-right v]\n    Set Position ([power v] of [player v])\n    if <(animOverrideLoop) = [0]> then\n        if <([status v] of [player v]) = [none]> then\n            if <not <([holdingitem? v] of [player v]) = [true]>> then\n                Basic Animation Config\n            else\n                Holding Item Anim ([power v] of [player v])\n            end\n        else\n            Status Anim Config ([status v] of [player v])\n        end\n    else\n        animOverride Config\n    end\n    show\nelse\n    hide\nend\n\ndefine Basic Animation Config\nif <<not <([ducking? v] of [player v]) = [true]>> and <not <([sliding? v] of [player v]) = [true]>>> then\n    if <([falling? v] of [player v]) < [6]> then\n        if <not <([braking? v] of [player v]) = [true]>> then\n            if <([frame v] of [player v]) = [0]> then\n                Play Anim [Idle] [1]\n            else\n                if <not <([running? v] of [player v]) = [true]>> then\n                    Play Anim [Walk] [3]\n                else\n                    Play Anim [Run] [3]\n                end\n            end\n        else\n            Play Anim [Brake] [1]\n        end\n    else\n        if <not <([running? v] of [player v]) = [true]>> then\n            if <not <([wallslide? v] of [player v]) = [true]>> then\n                Play Anim [Jump] [1]\n            else\n                Play Anim [Brake] [1]\n            end\n        else\n            Play Anim [RunJump] [1]\n        end\n    end\nelse\n    if <([sliding? v] of [player v]) = [true]> then\n        Play Anim [Slide] [1]\n    else\n        Play Anim [Duck] [1]\n    end\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (join ([power v] of [player v]) (join [_] (costume))) ([floor v] of (([frame v] of [player v]) mod (framecount)) ))\n    if <([power v] of [player v]) = [Small]> then\n        set [framespeed v] to ((framecount) * (10))\n    else\n        set [framespeed v] to ((framecount) * (6))\n    end\nelse\n    switch costume to (join ([power v] of [player v]) (join [_] (costume)))\n    set [framespeed v] to [1]\nend\n\ndefine Set Position (ppower)\nset x to ([x position v] of [player v])\nif <(ppower) = [Small]> then\n    set y to (([y position v] of [player v]) - (2))\nelse\n    set y to (([y position v] of [player v]) + (6))\nend\n\ndefine Status Anim Config (pstate)\nif <(pstate) = [Swim]> then\n    Swim Anim Config ([power v] of [player v]) <([falling? v] of [player v]) < [3]>\nelse\n    if <(ppower) = [Small]> then\n        Play Anim (pstate) [2]\n    else\n        Play Anim (pstate) [3]\n    end\nend\n\ndefine Swim Anim Config (ppower) <onfloor>\nif <not <onfloor>> then\n    if <(ppower) = [Small]> then\n        Play Anim [Swim] [2]\n    else\n        Play Anim [Swim] [2]\n    end\nelse\n    Basic Animation Config\nend\n\nwhen flag clicked\nset [animoverride v] to []\nset size to (175) %\nhide\n\ndefine animOverride Config\nif <(animOverride) = [Shoot]> then\n    change [animoverrideloop v] by ((3) / (12))\n    Play Special Anim [Shoot] [2] [0]\n    if <(animOverrideLoop) > [3]> then\n        set [animoverrideloop v] to [0]\n        set [animoverride v] to [none]\n    end\nelse\n    change [animoverrideloop v] by (1)\n    Play Anim (animOverride) [1]\n    if <(animOverrideLoop) > [10]> then\n        set [animoverrideloop v] to [0]\n        set [animoverride v] to [none]\n    end\nend\n\ndefine Play Special Anim (costume) (framecount) (rate)\nswitch costume to (join (join ([power v] of [player v]) (join [_] (costume))) ([floor v] of ((animOverrideLoop) mod (framecount)) ))\n\nwhen I receive [playerdefeat v]\nif <(Character) = [Toad]> then\n    stop [other scripts in sprite v]\n    clear graphic effects\n    set size to (200) %\n    go to [front v] layer\n    switch costume to (small_defeat v)\n    repeat until <([y position v] of [player v]) < [-178]>\n        Set Position [Small]\n    end\n    hide\nend\n\ndefine Holding Item Anim (ppower)\nif <not <([ducking? v] of [player v]) = [true]>> then\n    if <([falling? v] of [player v]) < [6]> then\n        if <(ppower) = [Small]> then\n            Play Anim [Carry] [2]\n        else\n            Play Anim [Carry] [3]\n        end\n    else\n        if <(ppower) = [Small]> then\n            Play Anim [Carry1] [1]\n        else\n            Play Anim [Carry2] [1]\n        end\n    end\nelse\n    Play Anim [CarryDuck] [1]\nend\n\nwhen I receive [animoverride v]\nif <not <(animOverride) = [none]>> then\n    if <(Character) = [Toad]> then\n        if <(animOverride) = [Shoot]> then\n            set [animoverrideloop v] to [2]\n        else\n            set [animoverrideloop v] to [1]\n        end\n    end\nend\n\nwhen I receive [playerdamage v]\nif <(Character) = [Toad]> then\n    wait (0.001) seconds\n    repeat until <([recoverytimer v] of [player v]) = [0]>\n        set [ghost v] effect to (100)\n        wait ((1) / ([recoverytimer v] of [player v])) seconds\n        set [ghost v] effect to (0)\n    end\n    set [ghost v] effect to (0)\nend\n\n@Background\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    go to [back v] layer\n    go to x: (((scrollX) * (0.5)) mod (scrollFactorX)) y: ((offsetY) - ((scrollY) * (0.5)))\nend\n\nwhen flag clicked\nset [clone? v] to [false]\nCreate Background Layer [720] [-32] [X]\nCreate Background Layer [-720] [-32] [X]\nCreate Background Layer [720] [368] [Y]\nCreate Background Layer [-720] [368] [Y]\n\nwhen I start as a clone\nset [clone? v] to [true]\nshow\n\ndefine Create Background Layer (factorx) (offsety) (costume)\nset [scrollfactorx v] to (factorx)\nset [offsety v] to (offsety)\nswitch costume to (join (costume) (join [_] (levelTheme)))\ncreate clone of (_myself_ v)\n\ndefine Spawn NPC (x) (y) (speed)\nset [startx v] to ((x) * (32))\nset [starty v] to ((y) * (32))\nset [setspeed v] to (speed)\ncreate clone of (_myself_ v)\n\nwhen I receive [editormode v]\nif <(Clone?) = [true]> then\n    go to [back v] layer\n    go to x: (((scrollX) * (0.5)) mod (scrollFactorX)) y: ((offsetY) - ((scrollY) * (0.5)))\nend\n\nwhen I receive [you got a star! v]\nset [brightness v] effect to (-50)\n\n@Goomba\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <<not <touching (map v)?>> and <<not <touching (blocks v)?>> and <<not <touching (terrain v)?>> and <not <touching (semi-solids v)?>>>>>\n    if <up?> then\n        change y by (-1)\n        change [thisy v] by (-1)\n    else\n        change y by (1)\n        change [thisy v] by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\nwhen flag clicked\nset [child? v] to [false]\nhide\n\nwhen I start as a clone\nset [thisx v] to (startX)\nset [thisy v] to (startY)\nset [thisframe v] to [0]\nset [off-screen? v] to [false]\nset [speed x v] to (setSpeed)\nset [speed y v] to [0]\nset [touch v] to [0]\nset [child? v] to [true]\nset [touch v] to [0]\nset [status v] to [none]\nset [animtimer v] to [0]\nset [prevscrolly v] to (scrollY)\nset [onsemi-solid? v] to [false]\nset [delayverticalscroll v] to [false]\nset rotation style [left-right v]\nif <(setSpeed) < [0]> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\ngo to x: ((thisX) + (scrollX)) y: ((thisY) - (scrollY))\nwait (0.05) seconds\nshow\n\nwhen I receive [tick v]\nif <(Child?) = [true]> then\n    set [delayverticalscroll v] to <<<not <(scrollLockY) = [true]>> and <([falling? v] of [player v]) > [2]>> and <not <(onSemi-Solid?) = [true]>>>\n    if <not <(delayVerticalScroll) = [true]>> then\n        set y to ((thisY) - (scrollY))\n    end\n    switch costume to (hitbox v)\n    BlockHit Below (round ((thisX) / (24))) (round ((thisY) / (24)))\n    change [thisframe v] by (([abs v] of (speed x) ) / (12))\n    set [prevscrolly v] to (scrollY)\n    if <(Status) = [none]> then\n        if <not <(off-screen?) = [true]>> then\n            Player Collision <<([y position v] of [player v]) > (y position)> and <<([speed y v] of [player v]) < [0]> and <([falling? v] of [player v]) > [5]>>>\n            Shell Collision ([floor v] of (thisX) ) ([floor v] of (thisY) )\n            Gravity\n            Touch Ground <(speed y) > [0]>\n            change [thisx v] by (speed x)\n            Projectile Collision\n            Wall Collision <([abs v] of (speed y) ) < [2]>\n            Semi-Solid Check <([abs v] of (speed y) ) < [2]>\n            Play Anim [Walk] [2]\n            if <(Status) = [Hit]> then\n                Init Defeat Anim\n            end\n        end\n        Off-Screen <([abs v] of (x position) ) > [234]> <([abs v] of (y position) ) > [177]> <<(thisY) < [-250]> and <(scrollY) = [0]>>\n    else\n        if <(Status) = [defeat]> then\n            Stomped Anim\n        end\n        if <(Status) = [off-screen]> then\n            set [speed y v] to [0]\n            Respawn NPC ([abs v] of ((startX) + (scrollX)) )\n        end\n        if <(Status) = [Hit]> then\n            Hit Anim\n        end\n    end\n    set x to ((thisX) + (scrollX))\n    if <(delayVerticalScroll) = [true]> then\n        set y to ((thisY) - (scrollY))\n    end\nend\n\ndefine Gravity\nif <(speed y) > [-35]> then\n    change [speed y v] by (-2)\nend\nchange [thisy v] by (speed y)\nchange [falling? v] by (1)\n\ndefine Wall Collision <onfloor>\nswitch costume to (wall_sensor v)\nif <<<touching (map v)?> or <touching (blocks v)?>> or <<touching (terrain v)?> or <<touching (goomba v)?> or <touching (koopa troopa v)?>>>> then\n    if <(speed x) > [0]> then\n        change [thisx v] by (([abs v] of (speed x) ) * (-1))\n        change x by (([abs v] of (speed x) ) * (-1))\n    else\n        change [thisx v] by ([abs v] of (speed x) )\n        change x by ([abs v] of (speed x) )\n    end\n    if <onfloor> then\n        set [speed x v] to ((speed x) * (-1))\n        point in direction ((direction) * (-1))\n    end\nend\n\ndefine Player Collision <pabove>\nif <touching (player v)?> then\n    if <([sliding? v] of [player v]) = [true]> then\n        set [status v] to [Hit]\n        start sound [defeat v]\n    else\n        if <pabove> then\n            broadcast (playerStomp v)\n            set [speed x v] to [0]\n            set [status v] to [defeat]\n            set [animtimer v] to [0]\n            Create Effect (round (((((([x position v] of [player v]) - (scrollX)) + (thisX)) / (2)) + (12)) / (24))) (round ((thisY) / (24)))\n        else\n            broadcast (playerDamage v)\n        end\n    end\nend\n\ndefine Stomped Anim\nchange [animtimer v] by (1)\nPlay Anim [Stomped] [1]\nif <(animTimer) > [9]> then\n    delete this clone\nend\n\ndefine Off-Screen <offscreenx> <offscreeny> <bottompit>\nset [off-screen? v] to <<offscreenx> or <offscreeny>>\nif <<<offscreenx> and <([abs v] of ((thisX) + (scrollX)) ) > [480]>> or <bottompit>> then\n    set [status v] to [off-screen]\n    set [thisx v] to (startX)\n    set [thisy v] to (startY)\n    hide\nelse\n    if <<offscreeny> and <(off-screen?) = [true]>> then\n        hide\n    else\n        if <(costume [name v]) = [hitbox]> then\n            switch costume to (walk0 v)\n        end\n        show\n    end\nend\n\ndefine Respawn NPC (rangex)\nif <<([abs v] of ((thisX) + (scrollX)) ) < [240]> and <([abs v] of ((thisX) + (scrollX)) ) > [230]>> then\n    set [status v] to [none]\n    if <(x position) > ([x position v] of [player v])> then\n        set [speed x v] to (([abs v] of (setSpeed) ) * (-1))\n        point in direction (90)\n    else\n        set [speed x v] to ([abs v] of (setSpeed) )\n        point in direction (-90)\n    end\n    switch costume to (walk0 v)\n    Touch Ground <>\n    show\nend\n\ndefine Semi-Solid Check <onfloor>\nif <onfloor> then\n    switch costume to (bottom_sensor v)\n    set [onsemi-solid? v] to <touching (semi-solids v)?>\nend\n\ndefine BlockHit Below (x) (y)\nif <(falling?) < [3]> then\n    if <[blockshit v] contains (join (x) (join [,] ((y) - (1))))?> then\n        set [status v] to [Hit]\n        set [hitx v] to (((x) * (24)) + (scrollX))\n        start sound [defeat v]\n        Init Defeat Anim\n    end\nend\n\ndefine Hit Anim\nset rotation style [all around v]\nif <(speed x) > [0]> then\n    turn right (25) degrees\nelse\n    turn left (25) degrees\nend\nchange [thisx v] by (speed x)\nGravity\nPlay Anim [Walk] [2]\nif <(y position) < [-178]> then\n    delete this clone\nend\n\ndefine Projectile Collision\nif <touching (player_projectiles v)?> then\n    set [hitx v] to ([x position v] of [player v])\n    set [status v] to [Hit]\n    start sound [defeat v]\n    Init Defeat Anim\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (costume) ([floor v] of ((thisFrame) mod (framecount)) ))\nelse\n    switch costume to (costume)\nend\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [factora v] to (letter (i) of (code))\n    Spawn NPC (spawnX) (spawnY) <(factorA) = [1]>\n    change [i v] by (2)\nend\n\nAdd Coordinate [21] [-2] [0] [1]\n\nset [setspeed v] to [-2]\n\ndefine Create Effect (x) (y)\nadd (join [1:] (join (x) (join [,] (y)))) to [effectsgroup v]\n\ndefine Init Defeat Anim\nif <(x position) > (hitX)> then\n    set [speed x v] to [3]\nelse\n    set [speed x v] to [-3]\nend\nset [speed y v] to [15]\ngo to [front v] layer\n\ndefine Spawn NPC (x) (y) <flipx>\nset [startx v] to ((x) * (24))\nset [starty v] to (((y) * (24)) - (12))\nif <not <flipx>> then\n    set [setspeed v] to [-2]\nelse\n    set [setspeed v] to [2]\nend\ncreate clone of (_myself_ v)\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\ndefine Shell Collision (x) (y)\nif <<(length of [npcshit v]) > [0]> and <touching (koopa troopa v)?>> then\n    set [collisionx v] to []\n    set [collisiony v] to []\n    set [i v] to [1]\n    repeat until <(letter (i) of (item (1) of [npcshit v])) = [,]>\n        set [collisionx v] to (join (collisionX) (letter (i) of (item (1) of [npcshit v])))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    repeat until <(i) > (length of (item (1) of [npcshit v]))>\n        set [collisiony v] to (join (collisionY) (letter (i) of (item (1) of [npcshit v])))\n        change [i v] by (1)\n    end\n    if <<([abs v] of ((x) - (collisionX)) ) < [40]> and <([abs v] of ((y) - (collisionY)) ) < [40]>> then\n        set [hitx v] to ((collisionX) + (scrollX))\n        set [status v] to [Hit]\n        start sound [defeat v]\n    end\nend\n\ndefine Add Coordinate (x) (y) (flipx) (list #)\nset [tileorigin v] to (join (join (join (x) (join [.] (y))) [^]) (flipx))\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\n@Koopa Troopa\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <<not <touching (map v)?>> and <<not <touching (terrain v)?>> and <<not <touching (blocks v)?>> and <not <touching (semi-solids v)?>>>>>\n    change [collisiontimeout v] by (1)\n    if <(collisionTimeout) > [49]> then\n        delete this clone\n    end\n    if <up?> then\n        change y by (-1)\n        change [thisy v] by (-1)\n    else\n        change y by (1)\n        change [thisy v] by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\nset [collisiontimeout v] to [0]\n\nwhen flag clicked\nset [child? v] to [false]\nhide\n\nwhen I start as a clone\nset [thisx v] to (startX)\nset [thisy v] to (startY)\nset [thisframe v] to [0]\nset [off-screen? v] to [false]\nset [speed x v] to (setSpeed)\nset [speed y v] to [0]\nset [touch v] to [0]\nset [child? v] to [true]\nset [touch v] to [0]\nset [status v] to [none]\nset [animtimer v] to [0]\nset [prevscrolly v] to (scrollY)\nset [onsemi-solid? v] to [false]\nset [delayverticalscroll v] to [false]\nset [shellrecovery v] to [0]\nset [touchingnpc? v] to [false]\nset [hitnpc? v] to [false]\nset [shelltimer v] to [0]\nset [defeatdelay v] to [0]\nset rotation style [left-right v]\nif <(setSpeed) < [0]> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\ngo to x: ((thisX) + (scrollX)) y: ((thisY) - (scrollY))\nwait (0.1) seconds\nshow\n\nwhen I receive [tick v]\nif <(Child?) = [true]> then\n    set [delayverticalscroll v] to <<<not <(scrollLockY) = [true]>> and <<([falling? v] of [player v]) > [2]> and <(onSemi-Solid?) = [false]>>> or <(Status) = [held]>>\n    if <not <(delayVerticalScroll) = [true]>> then\n        set y to ((thisY) - (scrollY))\n    end\n    switch costume to (hitbox v)\n    BlockHit Below (round ((thisX) / (24))) (round ((thisY) / (24)))\n    change [thisframe v] by (([abs v] of (speed x) ) / (12))\n    set [prevscrolly v] to (scrollY)\n    if <<(Status) = [none]> or <<(Status) = [shell]> or <(Status) = [launch]>>> then\n        if <not <(off-screen?) = [true]>> then\n            if <(shellRecovery) = [0]> then\n                Player Collision <<([y position v] of [player v]) > (y position)> and <([speed y v] of [player v]) < [0]>>\n            end\n            Shell Collision ([floor v] of (thisX) ) ([floor v] of (thisY) )\n            Gravity\n            if <not <(off-screen?) = [true]>> then\n                Touch Ground <(speed y) > [0]>\n            end\n            change [thisx v] by (speed x)\n            NPC Collision\n            Projectile Collision\n            Wall Collision <([abs v] of (speed y) ) < [2]> <>\n            Semi-Solid Check <([abs v] of (speed y) ) < [2]>\n            if <(npcType) = [Red]> then\n                Edge Detection <([abs v] of (speed y) ) < [2]>\n            end\n            if <(shellRecovery) > [0]> then\n                change [shellrecovery v] by (1)\n                if <(shellRecovery) > [4]> then\n                    set [shellrecovery v] to [0]\n                end\n            end\n            if <(Status) = [none]> then\n                Play Anim [Walk] [2]\n            else\n                if <(Status) = [shell]> then\n                    In-Shell Timer ((450) - (1))\n                    Play Anim [Shell0] [1]\n                else\n                    if <(Status) = [launch]> then\n                        Play Anim [Shell] [4]\n                    else\n                        Init Defeat Anim\n                    end\n                end\n            end\n        end\n        Off-Screen <([abs v] of (x position) ) > [234]> <([abs v] of (y position) ) > [177]> <<(thisY) < [-250]> and <(scrollY) = [0]>>\n    else\n        if <(Status) = [off-screen]> then\n            set [speed y v] to [0]\n            Respawn NPC ([abs v] of ((startX) + (scrollX)) )\n        end\n        if <(Status) = [held]> then\n            In-Shell Timer ((450) - (1))\n            if <(Status) = [held]> then\n                Held By Player Anim\n                NPC Collision\n                Player Holding Item Check <([holdingitem? v] of [player v]) = [true]>\n            end\n            Play Anim [Shell0] [1]\n        end\n        if <(Status) = [defeatDelay]> then\n            change [defeatdelay v] by (1)\n            if <(defeatDelay) > [1]> then\n                if <([direction v] of [player v]) = [90]> then\n                    set [hitx v] to ((x position) - (200))\n                else\n                    set [hitx v] to ((x position) - (48))\n                end\n                set [status v] to [Hit]\n            end\n        end\n        if <(Status) = [Hit]> then\n            Hit Anim\n        end\n    end\n    set x to ((thisX) + (scrollX))\n    if <(delayVerticalScroll) = [true]> then\n        set y to ((thisY) - (scrollY))\n    end\nend\n\ndefine Gravity\nif <(speed y) > [-35]> then\n    change [speed y v] by (-2)\nend\nchange [thisy v] by (speed y)\nchange [falling? v] by (1)\n\ndefine Wall Collision <onfloor> <touchnpc>\nswitch costume to (wall_sensor v)\nset [touchingnpc? v] to <<touching (goomba v)?> or <<touching (koopa troopa v)?> or <touching (piranha plant v)?>>>\nif <<<<touching (map v)?> or <touching (blocks v)?>> or <touching (terrain v)?>> or <<(touchingNPC?) = [true]> and <(Status) = [none]>>> then\n    if <<touching (blocks v)?> and <(Status) = [launch]>> then\n        BlockHit Side (round ((thisX) / (24))) (round (((thisY) + (12)) / (24)))\n        BlockHit Side (round ((thisX) / (24))) (round (((thisY) + (12)) / (24)))\n    end\n    if <(speed x) > [0]> then\n        change [thisx v] by (([abs v] of (speed x) ) * (-1))\n        change x by (([abs v] of (speed x) ) * (-1))\n    else\n        change [thisx v] by ([abs v] of (speed x) )\n        change x by ([abs v] of (speed x) )\n    end\n    if <<onfloor> or <(Status) = [launch]>> then\n        set [speed x v] to ((speed x) * (-1))\n        point in direction ((direction) * (-1))\n    end\nend\n\ndefine Player Collision <pabove>\nif <touching (player v)?> then\n    if <([sliding? v] of [player v]) = [true]> then\n        set [status v] to [Hit]\n        start sound [defeat v]\n    else\n        if <<(Status) = [none]> or <(Status) = [launch]>> then\n            if <pabove> then\n                broadcast (playerStomp v)\n                set [speed x v] to [0]\n                set [status v] to [shell]\n                set [shelltimer v] to [0]\n                set [shellrecovery v] to [1]\n                Create Effect (round (((((([x position v] of [player v]) - (scrollX)) + (thisX)) / (2)) + (12)) / (24))) (round ((thisY) / (24)))\n            else\n                if <(Status) = [none]> then\n                    broadcast (playerDamage v)\n                else\n                    Player-Shell Collision ([x position v] of [player v])\n                end\n            end\n        else\n            Init Shell Launch ([x position v] of [player v]) <key ((item (5) of [keycontrols v]) v) pressed?> [6]\n        end\n    end\nend\n\ndefine Off-Screen <offscreenx> <offscreeny> <bottompit>\nif <<<(off-screen?) = [true]> and <(Status) = [launch]>> and <not <offscreenx>>> then\n    Wall Collision <[1] = [1]> <>\nend\nset [off-screen? v] to <<offscreenx> or <offscreeny>>\nif <<<offscreenx> and <([abs v] of ((thisX) + (scrollX)) ) > [480]>> or <bottompit>> then\n    set [status v] to [off-screen]\n    set [thisx v] to (startX)\n    set [thisy v] to (startY)\n    hide\nelse\n    if <<offscreeny> and <(off-screen?) = [true]>> then\n        set [shelltimer v] to [0]\n        hide\n    else\n        if <(costume [name v]) = [hitbox]> then\n            Play Anim [Walk0] [1]\n        end\n        show\n    end\nend\n\ndefine Respawn NPC (rangex)\nif <<([abs v] of ((thisX) + (scrollX)) ) < [240]> and <([abs v] of ((thisX) + (scrollX)) ) > [230]>> then\n    set [status v] to [none]\n    set [speed x v] to (setSpeed)\n    set [shelltimer v] to [0]\n    set [shellrecovery v] to [0]\n    Play Anim [Walk0] [1]\n    if <(x position) > ([x position v] of [player v])> then\n        set [speed x v] to (([abs v] of (setSpeed) ) * (-1))\n        point in direction (90)\n    else\n        set [speed x v] to ([abs v] of (setSpeed) )\n        point in direction (-90)\n    end\n    show\nend\n\ndefine Semi-Solid Check <onfloor>\nif <onfloor> then\n    switch costume to (bottom_sensor v)\n    set [onsemi-solid? v] to <touching (semi-solids v)?>\nend\n\ndefine BlockHit Below (x) (y)\nif <(falling?) < [3]> then\n    if <[blockshit v] contains (join (x) (join [,] ((y) - (1))))?> then\n        set [status v] to [Hit]\n        set [hitx v] to (((x) * (24)) + (scrollX))\n        start sound [defeat v]\n        Init Defeat Anim\n    end\nend\n\ndefine Hit Anim\nset rotation style [all around v]\nif <(speed x) > [0]> then\n    turn right (25) degrees\nelse\n    turn left (25) degrees\nend\nchange [thisx v] by (speed x)\nGravity\nPlay Anim [Shell0] [1]\nif <(y position) < [-178]> then\n    delete this clone\nend\n\ndefine Create Effect (x) (y)\nadd (join [1:] (join (x) (join [,] (y)))) to [effectsgroup v]\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (npcType) (join [_] (join (costume) ([floor v] of ((thisFrame) mod (framecount)) ))))\nelse\n    switch costume to (join (npcType) (join [_] (costume)))\nend\n\ndefine Init Defeat Anim\nif <(x position) > (hitX)> then\n    set [speed x v] to [3]\nelse\n    set [speed x v] to [-3]\nend\nset [speed y v] to [15]\ngo to [front v] layer\n\ndefine Spawn NPC (x) (y) <flipx> (type)\nset [startx v] to ((x) * (24))\nset [starty v] to (((y) * (24)) + (12))\nif <not <flipx>> then\n    set [setspeed v] to [-2]\nelse\n    set [setspeed v] to [2]\nend\nset [npctype v] to (item ((type) + (1)) of [npctypes v])\ncreate clone of (_myself_ v)\n\ndefine Init Shell Launch (px) <btndown> (speed)\nif <not <<btndown> and <not <([holdingitem? v] of [player v]) = [true]>>>> then\n    if <(px) < (x position)> then\n        set [speed x v] to (speed)\n        point in direction (-90)\n    else\n        set [speed x v] to ((speed) * (-1))\n        point in direction (90)\n    end\n    set [status v] to [launch]\n    set [shellrecovery v] to [1]\n    set [animoverride v] to [Kick]\n    start sound [shell-hit v]\n    if <([x position v] of [player v]) < (x position)> then\n        Create Effect (round (((((([x position v] of [player v]) - (scrollX)) + (thisX)) / (2)) + (12)) / (24))) (round ((thisY) / (24)))\n    else\n        Create Effect (round (((((([x position v] of [player v]) - (scrollX)) + (thisX)) / (2)) + (0)) / (24))) (round ((thisY) / (24)))\n    end\n    broadcast (animOverride v)\nelse\n    set [status v] to [held]\n    set [speed x v] to [0]\n    set [speed y v] to [0]\n    broadcast (setHoldingItem v)\nend\n\ndefine Player-Shell Collision (px)\nif <(speed x) < [0]> then\n    if <(px) < (x position)> then\n        broadcast (playerDamage v)\n    else\n        change [speed x v] by (-1)\n        change x by (-1)\n        change [thisx v] by (-1)\n    end\nelse\n    if <(px) > (x position)> then\n        broadcast (playerDamage v)\n    else\n        change [speed x v] by (1)\n        change x by (1)\n        change [thisx v] by (1)\n    end\nend\n\ndefine Held By Player Anim\nif <not <([ducking? v] of [player v]) = [true]>> then\n    if <<(Character) = [Mario]> or <(Character) = [Luigi]>> then\n        if <([direction v] of [player v]) = [90]> then\n            set [thisx v] to ((([x position v] of [player v]) + (18)) - (scrollX))\n        else\n            set [thisx v] to ((([x position v] of [player v]) - (18)) - (scrollX))\n        end\n        if <<(Character) = [Luigi]> and <not <([power v] of [player v]) = [Small]>>> then\n            set [thisy v] to ((([y position v] of [player v]) + (5)) + (scrollY))\n        else\n            set [thisy v] to (([y position v] of [player v]) + (scrollY))\n        end\n    end\n    if <(Character) = [Toad]> then\n        set [thisx v] to (([x position v] of [player v]) - (scrollX))\n        if <([power v] of [player v]) = [Small]> then\n            set [thisy v] to ((([y position v] of [player v]) + (24)) + (scrollY))\n        else\n            set [thisy v] to ((([y position v] of [player v]) + (30)) + (scrollY))\n        end\n    end\nelse\n    set [thisx v] to (([x position v] of [player v]) - (scrollX))\n    if <([power v] of [player v]) = [Small]> then\n        if <(Character) = [Toad]> then\n            set [thisy v] to ((([y position v] of [player v]) + (12)) + (scrollY))\n        else\n            set [thisy v] to ((([y position v] of [player v]) + (15)) + (scrollY))\n        end\n    else\n        if <(Character) = [Toad]> then\n            set [thisy v] to ((([y position v] of [player v]) + (20)) + (scrollY))\n        else\n            set [thisy v] to ((([y position v] of [player v]) + (26)) + (scrollY))\n        end\n    end\nend\n\ndefine Player Holding Item Check <itemheld>\nif <not <itemheld>> then\n    if <<(Character) = [Toad]> or <([ducking? v] of [player v]) = [true]>> then\n        if <([direction v] of [player v]) = [90]> then\n            set [thisx v] to ((([x position v] of [player v]) + (18)) - (scrollX))\n        else\n            set [thisx v] to ((([x position v] of [player v]) - (18)) - (scrollX))\n        end\n        set x to ((thisX) + (scrollX))\n        set [thisy v] to (([y position v] of [player v]) + (scrollY))\n    end\n    if <touching (map v)?> then\n        if <([direction v] of [player v]) > [0]> then\n            change [thisx v] by (-24)\n            change x by (-24)\n        else\n            change [thisx v] by (24)\n            change x by (24)\n        end\n    end\n    Wall Collision <[1] = [1]> <[1] = [2]>\n    Init Shell Launch ([x position v] of [player v]) <[1] = [2]> ((([abs v] of ([speed x v] of [player v]) ) / (2)) + (6))\n    set [speed y v] to [0]\nend\n\ndefine BlockHit Side (tile x) (tile y)\nif <(speed x) < [0]> then\n    if <not <[usedblocks v] contains (join ((tile x) - (1)) (join [,] (tile y)))?>> then\n        add (join ((tile x) - (1)) (join [,] (tile y))) to [blockshit v]\n    end\nelse\n    if <not <[usedblocks v] contains (join ((tile x) + (1)) (join [,] (tile y)))?>> then\n        add (join ((tile x) + (1)) (join [,] (tile y))) to [blockshit v]\n    end\nend\n\ndefine NPC Collision\nif <<(Status) = [launch]> or <(Status) = [held]>> then\n    set [touchingnpc? v] to <<touching (goomba v)?> or <<touching (koopa troopa v)?> or <touching (piranha plant v)?>>>\n    if <(touchingNPC?) = [true]> then\n        add (join ([floor v] of (thisX) ) (join [,] ([floor v] of (thisY) ))) to [npcshit v]\n        add (join ([floor v] of (thisX) ) (join [,] ([floor v] of (thisY) ))) to [npcshit v]\n        set [hitnpc? v] to [true]\n        if <(Status) = [held]> then\n            set [status v] to [defeatDelay]\n            set [shelltimer v] to [0]\n            broadcast (deactivateHoldingItem v)\n            start sound [defeat v]\n        end\n    end\n    if <(Status) = [launch]> then\n        if <touching (coins v)?> then\n            if <not <[npcshit v] contains (join ([floor v] of (thisX) ) (join [,] ([floor v] of (thisY) )))?>> then\n                add (join ([floor v] of (thisX) ) (join [,] ([floor v] of (thisY) ))) to [npcshit v]\n                add (join ([floor v] of (thisX) ) (join [,] ([floor v] of (thisY) ))) to [npcshit v]\n            end\n        end\n    end\nend\n\ndefine In-Shell Timer (limit)\nchange [shelltimer v] by (1)\nif <(shellTimer) > (limit)> then\n    if <(Status) = [held]> then\n        set [speed y v] to [0]\n        broadcast (deactivateHoldingItem v)\n    end\n    set [status v] to [none]\n    set [speed x v] to ((setSpeed) * (-1))\n    if <(speed x) < [0]> then\n        point in direction (90)\n    else\n        point in direction (-90)\n    end\nend\n\ndefine Reset Anim\nif <<(costume [name v]) = [hitbox]> or <(costume [name v]) = [Wall_Sensor]>> then\n    if <(Status) = [none]> then\n        switch costume to (green_walk0 v)\n    else\n        switch costume to (green_shell0 v)\n    end\n    set y to ((thisY) - (scrollY))\nend\n\ndefine Projectile Collision\nif <touching (player_projectiles v)?> then\n    set [hitx v] to ([x position v] of [player v])\n    set [status v] to [Hit]\n    start sound [defeat v]\n    Init Defeat Anim\nend\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [factora v] to (letter (i) of (code))\n    change [i v] by (2)\n    set [factorb v] to (letter (i) of (code))\n    Spawn NPC (spawnX) (spawnY) <(factorA) = [1]> (factorB)\n    change [i v] by (2)\nend\n\nSpawn NPC [29] [-4] <> [0]\n\nAdd Coordinate [29] [-4] [0] [0] [1]\n\nset [thisy v] to (startY)\n\ndefine Edge Detection <onfloor>\nif <(Status) = [none]> then\n    switch costume to (edge_sensor v)\n    if <<<not <touching (map v)?>> and <not <touching (semi-solids v)?>>> and <not <touching (blocks v)?>>> then\n        set [speed x v] to ((speed x) * (-1))\n        point in direction ((direction) * (-1))\n    end\nend\n\nset [setspeed v] to [0]\n\nAdd Coordinate [55] [1] [0] [1] [1]\n\ndefine Shell Collision (x) (y)\nif <<(length of [npcshit v]) > [0]> and <<touching (koopa troopa v)?> and <not <(hitNPC?) = [true]>>>> then\n    set [collisionx v] to []\n    set [collisiony v] to []\n    set [i v] to [1]\n    repeat until <(letter (i) of (item (1) of [npcshit v])) = [,]>\n        set [collisionx v] to (join (collisionX) (letter (i) of (item (1) of [npcshit v])))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    repeat until <(i) > (length of (item (1) of [npcshit v]))>\n        set [collisiony v] to (join (collisionY) (letter (i) of (item (1) of [npcshit v])))\n        change [i v] by (1)\n    end\n    if <<([abs v] of ((x) - (collisionX)) ) < [40]> and <([abs v] of ((y) - (collisionY)) ) < [40]>> then\n        set [hitx v] to ((collisionX) + (scrollX))\n        set [status v] to [Hit]\n        start sound [defeat v]\n    end\nend\nif <<(length of [npcshit v]) = [0]> and <(hitNPC?) = [true]>> then\n    set [hitnpc? v] to [false]\nend\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\ndefine Add Coordinate (x) (y) (flipx) (type) (list #)\nset [tileorigin v] to (join (join (join (join (x) (join [.] (y))) [^]) (flipx)) (join [_] (type)))\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\n@Piranha Plant\n\nwhen flag clicked\nset size to (175) %\nset [child? v] to [false]\nhide\n\nwhen I start as a clone\nset [child? v] to [true]\nset [thisx v] to (startX)\nset [thisy v] to (startY)\nset [thisframe v] to [0]\nset [pipetimer v] to [0]\nset [off-screen? v] to [false]\nset [status v] to [Exit]\nwait (0.05) seconds\ngo [backward v] (0) layers\nshow\n\nwhen I receive [tick v]\nif <(Child?) = [true]> then\n    if <not <(Status) = [off-screen]>> then\n        if <(Status) = [Exit]> then\n            Exit Pipe\n        else\n            if <(Status) = [Enter]> then\n                Enter Pipe\n            else\n                Hit Anim\n            end\n        end\n        if <not <(Status) = [Hit]>> then\n            Player Sensing\n        end\n        Shell Collision ([floor v] of (thisX) ) ([floor v] of (thisY) )\n        Projectile Collision\n        Frame Rate Config [0.2] [2]\n        Play Anim (plantType) [2]\n        Off-Screen <([abs v] of (x position) ) > [234]> <([abs v] of (y position) ) > [177]>\n    else\n        Respawn NPC ([abs v] of ((startX) + (scrollX)) )\n    end\n    go to x: ((thisX) + (scrollX)) y: ((thisY) - (scrollY))\nend\n\ndefine Exit Pipe\nif <(pipeDirection) = [Up]> then\n    if <(thisY) < ((startY) + (54))> then\n        change [thisy v] by (1)\n    else\n        change [pipetimer v] by (1)\n        set [thisy v] to ((startY) + (54))\n        if <(pipeTimer) = [50]> then\n            set [pipetimer v] to [0]\n            set [status v] to [Enter]\n        end\n    end\nend\n\ndefine Enter Pipe\nif <(pipeDirection) = [Up]> then\n    if <(thisY) > (startY)> then\n        change [thisy v] by (-1)\n    else\n        change [pipetimer v] by (1)\n        set [thisy v] to (startY)\n        if <(pipeTimer) > [49]> then\n            if <([abs v] of (distance to [player v]) ) > [48]> then\n                set [pipetimer v] to [0]\n                set [status v] to [Exit]\n            else\n                change [pipetimer v] by (-1)\n            end\n        end\n    end\nend\n\ndefine Frame Rate Config (rate) (framecount)\nif <(thisFrame) = (framecount)> then\n    set [thisframe v] to [0]\nelse\n    change [thisframe v] by (rate)\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (costume) (join [_] ([floor v] of ((thisFrame) mod (framecount)) )))\nelse\n    switch costume to (costume)\nend\n\ndefine Player Sensing\nif <touching (player v)?> then\n    if <([sliding? v] of [player v]) = [true]> then\n        set [status v] to [Hit]\n        set [hitx v] to ([x position v] of [player v])\n        start sound [defeat v]\n        Init Defeat Anim\n    else\n        broadcast (playerDamage v)\n    end\nend\n\ndefine Gravity\nif <(speed y) > [-35]> then\n    change [speed y v] by (-2)\nend\nchange [thisy v] by (speed y)\n\ndefine Hit Anim\nset rotation style [all around v]\nif <(speed x) > [0]> then\n    turn right (25) degrees\nelse\n    turn left (25) degrees\nend\nchange [thisx v] by (speed x)\nGravity\nif <(y position) < [-178]> then\n    delete this clone\nend\n\ndefine Shell Collision (x) (y)\nif <<(length of [npcshit v]) > [0]> and <touching (koopa troopa v)?>> then\n    set [collisionx v] to []\n    set [collisiony v] to []\n    set [i v] to [1]\n    repeat until <(letter (i) of (item (1) of [npcshit v])) = [,]>\n        set [collisionx v] to (join (collisionX) (letter (i) of (item (1) of [npcshit v])))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    repeat until <(i) > (length of (item (1) of [npcshit v]))>\n        set [collisiony v] to (join (collisionY) (letter (i) of (item (1) of [npcshit v])))\n        change [i v] by (1)\n    end\n    if <<([abs v] of ((x) - (collisionX)) ) < [40]> and <([abs v] of ((y) - (collisionY)) ) < [40]>> then\n        set [hitx v] to ((collisionX) + (scrollX))\n        set [status v] to [Hit]\n        start sound [defeat v]\n    end\n    if <(Status) = [Hit]> then\n        Init Defeat Anim\n    end\nend\n\ndefine Off-Screen <offscreenx> <offscreeny>\nset [off-screen? v] to <<offscreenx> or <offscreeny>>\nif <<<offscreenx> and <([abs v] of ((thisX) + (scrollX)) ) > [480]>> or <<offscreeny> and <([abs v] of ((thisY) - (scrollY)) ) > [360]>>> then\n    set [thisx v] to (startX)\n    set [thisy v] to (startY)\nend\nif <not <(off-screen?) = [true]>> then\n    show\nelse\n    hide\nend\n\ndefine Respawn NPC (rangex)\nif <<([abs v] of ((thisX) + (scrollX)) ) < [240]> and <([abs v] of ((thisX) + (scrollX)) ) > [235]>> then\n    set [status v] to [Exit]\n    switch costume to (plant_0 v)\n    show\nend\n\ndelete this clone\n\ndefine Projectile Collision\nif <touching (player_projectiles v)?> then\n    set [hitx v] to ([x position v] of [player v])\n    set [status v] to [Hit]\n    start sound [defeat v]\n    Init Defeat Anim\nend\n\ndefine Add Coordinate (x) (y) (type) (direction) (list #)\nset [tileorigin v] to (join (join (join (join (join (x) (join [.] (y))) [^]) (type)) [_]) (direction))\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [factora v] to (letter (i) of (code))\n    change [i v] by (2)\n    set [factorb v] to (letter (i) of (code))\n    Spawn NPC (spawnX) (spawnY) (factorA) (factorB)\n    change [i v] by (2)\nend\n\nAdd Coordinate [40] [-3] [0] [0] [1]\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\ndefine Spawn NPC (x) (y) (direction) (type)\nset [startx v] to ((x) * (24))\nset [starty v] to (((y) * (24)) - (36))\nset [pipedirection v] to (item ((direction) + (1)) of [plantdirections v])\nset [planttype v] to (item ((type) + (1)) of [planttypes v])\ncreate clone of (_myself_ v)\n\ndefine Init Defeat Anim\nif <(x position) > (hitX)> then\n    set [speed x v] to [3]\nelse\n    set [speed x v] to [-3]\nend\nset [speed y v] to [15]\ngo to [front v] layer\n\nAdd Coordinate [134] [-2] [0] [0] [1]\n\n@Coins\n\nwhen flag clicked\nset size to (75) %\nset [child? v] to [false]\nhide\n\ndefine Spawn NPC (x) (y) (type) (coin #)\nset [startx v] to (((x) * (24)) + (12))\nset [starty v] to (((y) * (24)) - (12))\nif <(type) = [0]> then\n    set [itemtype v] to [Coin]\nelse\n    set [itemtype v] to [StarCoin]\n    set [star coin # v] to (coin #)\n    change [startx v] by (12)\nend\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [child? v] to [true]\nset [thisframe v] to [0]\nif <(itemType) = [StarCoin]> then\n    if <(item (Star Coin #) of [star coins v]) = [true]> then\n        set [color v] effect to (90)\n        set [ghost v] effect to (25)\n    end\nend\nwait (0.05) seconds\nshow\n\nwhen I receive [tick v]\nif <(Child?) = [true]> then\n    if <touching (player v)?> then\n        Coin Collect\n    end\n    Shell Collision ([floor v] of (startX) ) ([floor v] of (startY) )\n    if <not <(itemType) = [StarCoin]>> then\n        Frame Rate Config [0.25] [4]\n        Play Anim (itemType) [4]\n    else\n        Frame Rate Config [0.375] [8]\n        Play Anim (itemType) [8]\n    end\n    go to x: ((startX) + (scrollX)) y: ((startY) - (scrollY))\nend\n\ndefine Frame Rate Config (rate) (framecount)\nif <(thisFrame) = (framecount)> then\n    set [thisframe v] to [0]\nelse\n    change [thisframe v] by (rate)\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (costume) (join [_] ([floor v] of ((thisFrame) mod (framecount)) )))\nelse\n    switch costume to (costume)\nend\n\nwhen I receive [tick v]\nif <(spawnItem) = [1]> then\n    if <(Child?) = [false]> then\n        if <(mouseJustDown) = [true]> then\n            Spawn NPC (round (((mouse x) - (scrollX)) / (24))) (round (((mouse y) + (scrollY)) / (24))) [Coin] []\n        end\n    end\nend\n\ndefine Shell Collision (x) (y)\nif <<(length of [npcshit v]) > [0]> and <touching (koopa troopa v)?>> then\n    set [collisionx v] to []\n    set [collisiony v] to []\n    set [i v] to [1]\n    repeat until <(letter (i) of (item (1) of [npcshit v])) = [,]>\n        set [collisionx v] to (join (collisionX) (letter (i) of (item (1) of [npcshit v])))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    repeat until <(i) > (length of (item (1) of [npcshit v]))>\n        set [collisiony v] to (join (collisionY) (letter (i) of (item (1) of [npcshit v])))\n        change [i v] by (1)\n    end\n    if <<([abs v] of ((x) - (collisionX)) ) < [40]> and <([abs v] of ((y) - (collisionY)) ) < [40]>> then\n        Coin Collect\n    end\nend\n\ndefine Coin Collect\nif <(itemType) = [Coin]> then\n    start sound [coin v]\n    change [coins v] by (1)\nelse\n    start sound [star coin v]\n    change [coins v] by (15)\n    if <not <(item (Star Coin #) of [star coins v]) = [true]>> then\n        replace item (Star Coin #) of [star coins v] with [true]\n    end\nend\ndelete this clone\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [factora v] to (letter (i) of (code))\n    change [i v] by (2)\n    set [factorb v] to (letter (i) of (code))\n    Spawn NPC (spawnX) (spawnY) (factorA) (factorB)\n    change [i v] by (2)\nend\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\nAdd Coordinate [206] [2] [0] [0] [1]\n\ndelete this clone\n\ndefine Add Coordinate (x) (y) (type) (coin #) (list #)\nset [tileorigin v] to (join (join (join (join (x) (join [.] (y))) [^]) (type)) (join [_] (coin #)))\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\n@Semi-Solids\n\nwhen flag clicked\nset [clone? v] to [false]\nhide\n\nwhen I start as a clone\nset [clone? v] to [true]\nset [ghost v] effect to (100)\nshow\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    if <<([abs v] of (x position) ) < [252]> and <([abs v] of (y position) ) < [195]>> then\n        show\n    else\n        hide\n    end\n    go to x: (((startX) + (scrollX)) - (0)) y: ((startY) - (scrollY))\nend\n\ndefine Spawn Platform (x) (y)\nset [startx v] to (((x) + (1)) * (24))\nset [starty v] to ((((y) - (0.5)) * (24)) - (12))\ncreate clone of (_myself_ v)\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    Spawn Platform (spawnX) (spawnY)\n    change [i v] by (2)\nend\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\ndefine Add Coordinate (x) (y) (list #)\nset [tileorigin v] to (join (join (x) (join [.] (y))) [^])\nreplace item (list #) of [spawncodes v] with (join (join (item (list #) of [spawncodes v]) [ ]) (tileOrigin))\n\nset [ghost v] effect to (100)\nshow\n\nAdd Coordinate [141] [9] [1]\n\nset [scrolly v] to [0]\n\n@Terrain\n\n@Blocks\n\nwhen flag clicked\nset size to (75) %\ndelete all of [blockshit v]\ndelete all of [usedblocks v]\nset [clone? v] to [false]\nhide\n\ndefine Place Block (x) (y) (type) (content #)\nset [startx v] to (((x) * (24)) + (12))\nset [starty v] to (((y) * (24)) - (12))\nif <(type) = [0]> then\n    set [blocktype v] to [ItemBlock]\nelse\n    set [blocktype v] to [BrickBlock]\nend\nif <(content #) = [0]> then\n    set [contents v] to [none]\nelse\n    set [contents v] to (item (content #) of [blockcontents v])\nend\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [clone? v] to [true]\nset [thisframe v] to [0]\nset [status v] to [none]\nset [changey v] to (startY)\nset [numhits v] to [0]\nset [blocktimer v] to [0]\nwait (0.1) seconds\nshow\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    if <(Status) = [none]> then\n        Frame Rate Config [0.25] [4]\n        Player Collision <([y position v] of [player v]) < (y position)> <<touching (sensors v)?> and <(item (1) of [playersensing v]) = [true]>>\n        Shell Collision (round ((startX) / (24))) (round ((startY) / (24)))\n        Play Anim (blockType) [4]\n    else\n        if <(Status) = [Hit]> then\n            Play Anim [BlockHit] [1]\n            set [changey v] to (startY)\n            set size to (75) %\n        else\n            Hit Block Anim\n        end\n    end\n    if <<(Contents) = [10x Coin]> and <(numHits) > [0]>> then\n        change [blocktimer v] by (1)\n    end\n    Off-Screen <([abs v] of (x position) ) > [238]> <([abs v] of (y position) ) > [278]>\n    go to x: ((startX) + (scrollX)) y: ((changeY) - (scrollY))\nend\n\ndefine Frame Rate Config (rate) (framecount)\nif <(thisFrame) = (framecount)> then\n    set [thisframe v] to [0]\nelse\n    change [thisframe v] by (rate)\nend\n\ndefine Player Collision <pbelow> <touchsensor>\nif <<<pbelow> and <([speed y v] of [player v]) < [0]>> and <touchsensor>> then\n    set [changey v] to (startY)\n    Hit Block (round ((startX) / (24))) (round ((startY) / (24)))\nend\n\ndefine Hit Block Anim\nif <(Status) = [BumpUp]> then\n    change [changey v] by (2)\n    change size by (7)\n    if <((changeY) - (startY)) > [8]> then\n        set [status v] to [BumpDown]\n    end\nelse\n    change [changey v] by (-2)\n    change size by (-7)\n    if <((changeY) - (startY)) < [2]> then\n        Release Block Contents (round ((startX) / (24))) (round ((startY) / (24)))\n    end\nend\nFrame Rate Config [0.25] [4]\nPlay Anim (blockType) [4]\n\ndefine Hit Block (tile x) (tile y)\nadd (join (join (tile x) [,]) (tile y)) to [blockshit v]\nif <(blockType) = [ItemBlock]> then\n    set [status v] to [BumpUp]\n    if <<(Contents) = [Coin]> or <(Contents) = [10x Coin]>> then\n        Add Coin (tile x) (tile y)\n    end\nelse\n    if <(Contents) = [none]> then\n        if <([power v] of [player v]) = [Small]> then\n            set [status v] to [BumpUp]\n        else\n            add (join [0:] (join (join (tile x) [,]) (tile y))) to [effectsgroup v]\n            start sound [block-smash v]\n            delete this clone\n        end\n    else\n        set [status v] to [BumpUp]\n        if <<(Contents) = [Coin]> or <(Contents) = [10x Coin]>> then\n            Add Coin (tile x) (tile y)\n        end\n    end\nend\n\nwhen I receive [tick v]\nif <not <(Clone?) = [true]>> then\n    if <(length of [blockshit v]) > [0]> then\n        delete (1) of [blockshit v]\n    end\nend\n\ndefine Shell Collision (tile x) (tile y)\nif <<(length of [blockshit v]) > [0]> and <(Status) = [none]>> then\n    if <<[blockshit v] contains (join (join (tile x) [,]) (tile y))?> or <[blockshit v] contains (join (join ((tile x) - (1)) [,]) (tile y))?>> then\n        Hit Block (tile x) (tile y)\n    end\nend\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [factora v] to (letter (i) of (code))\n    change [i v] by (2)\n    set [factorb v] to (letter (i) of (code))\n    Place Block (spawnX) (spawnY) (factorA) (factorB)\n    change [i v] by (2)\nend\n\ndefine Release Block Contents (tile x) (tile y)\nif <(Contents) = [none]> then\n    if <(blockType) = [ItemBlock]> then\n        set [status v] to [Hit]\n    else\n        set [status v] to [none]\n    end\nend\nif <(Contents) = [Coin]> then\n    set [status v] to [Hit]\nend\nif <(Contents) = [10x Coin]> then\n    change [numhits v] by (1)\n    if <<(numHits) = [10]> or <(blockTimer) > ((150) - (1))>> then\n        set [status v] to [Hit]\n        set [numhits v] to [0]\n        add (join (round ((startX) / (24))) (join [,] (round ((startY) / (24))))) to [usedblocks v]\n    else\n        set size to (75) %\n        set [status v] to [none]\n    end\nend\nif <(item # of (Contents) in [blockcontents v]) > [2]> then\n    add (join ((item # of (Contents) in [blockcontents v]) - (3)) (join [:] (join (tile x) (join [,] (tile y))))) to [itemspawn v]\n    set [status v] to [Hit]\nend\n\ndefine Add Coin (tile x) (tile y)\nstart sound [coin v]\nchange [coins v] by (1)\nadd (join [3:] (join (join (tile x) [,]) ((tile y) + (1)))) to [effectsgroup v]\nif <(Contents) = [Coin]> then\n    add (join (round ((startX) / (24))) (join [,] (round ((startY) / (24))))) to [usedblocks v]\nend\n\ndefine Add Coordinates (x) (y) (type) (content #) (list #)\nset [tileorigin v] to (join (join (x) (join [.] (join (y) (join [^] (type))))) (join [_] (content #)))\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\nAdd Coordinates [36] [-4] [0] [0] [1]\n\nAdd Coordinates [104] [-1] [0] [1] [1]\n\ndefine Off-Screen <offscreenx> <offscreeny>\nif <<offscreenx> or <offscreeny>> then\n    hide\nelse\n    show\nend\n\ndelete this clone\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (costume) (join [_] ([floor v] of ((thisFrame) mod (framecount)) )))\nelse\n    switch costume to (costume)\nend\n\n@Effects\n\nwhen flag clicked\ndelete all of [effectsgroup v]\nset [child? v] to [false]\nset size to (75) %\nhide\n\ndefine Effects Config (data)\nGet Spawn Coordinates (data)\nif < (data) contains [0:]?> then\n    set [i v] to [0]\n    repeat (4)\n        change [i v] by (1)\n        Spawn Brick Part (spawnX) (spawnY) (i)\n    end\nend\nif < (data) contains [1:]?> then\n    Spawn Effect (spawnX) (spawnY) [Impact]\nend\nif < (data) contains [3:]?> then\n    Spawn Effect (spawnX) (spawnY) [Coin]\nend\n\ndefine Spawn Brick Part (x) (y) (#)\nset [thisx v] to (((x) * (24)) - (12))\nset [thisy v] to ((y) * (24))\nset [effecttype v] to [BrickBust]\nset [brick # v] to (#)\ncreate clone of (_myself_ v)\n\ndefine Get Spawn Coordinates (data)\nset [i v] to [0]\nrepeat until <(letter (i) of (data)) = [:]>\n    change [i v] by (1)\nend\nchange [i v] by (1)\nset [spawnx v] to []\nrepeat until <(letter (i) of (data)) = [,]>\n    set [spawnx v] to (join (spawnX) (letter (i) of (data)))\n    change [i v] by (1)\nend\nchange [i v] by (1)\nset [spawny v] to []\nrepeat until <(i) > (length of (data))>\n    set [spawny v] to (join (spawnY) (letter (i) of (data)))\n    change [i v] by (1)\nend\n\nwhen I start as a clone\nset [child? v] to [true]\nset [thisframe v] to [0]\nif <(effectType) = [BrickBust]> then\n    if <<(Brick #) = [1]> or <(Brick #) = [3]>> then\n        set [speed x v] to [-3]\n    else\n        set [speed x v] to [3]\n    end\n    if <<(Brick #) = [1]> or <(Brick #) = [2]>> then\n        set [speed y v] to [12]\n    else\n        set [speed y v] to [6]\n    end\nend\nif <(effectType) = [Impact]> then\n    set size to (150) %\nend\nif <(effectType) = [Coin]> then\n    set [starty v] to (thisY)\n    set [speed y v] to [18]\nend\nwait (0.05) seconds\ngo to [front v] layer\nshow\n\nwhen I receive [tick v]\nif <(Child?) = [true]> then\n    if <(effectType) = [BrickBust]> then\n        set [thisframe v] to ((Brick #) - (1))\n        change [thisx v] by (speed x)\n        Play Anim [BrickBust] [1]\n        Gravity\n        if <(y position) < [-178]> then\n            delete this clone\n        end\n    end\n    if <(effectType) = [Impact]> then\n        Play Anim [ImpactEffect] [1]\n        change size by (-15)\n        if <(size) < [26]> then\n            delete this clone\n        end\n    end\n    if <(effectType) = [Coin]> then\n        if <<(thisY) < ((startY) + (12))> and <(speed y) < [0]>> then\n            change [thisframe v] by (10)\n            if <not <(costume [name v]) = [CoinSparkle_2]>> then\n                Play Anim [CoinSparkle] [3]\n            else\n                switch costume to (coinsparkle_2 v)\n                if <(thisFrame) > [18]> then\n                    delete this clone\n                end\n            end\n        else\n            change [thisframe v] by (1)\n            Play Anim [CoinEffect] [4]\n            Gravity\n        end\n    end\n    go to x: ((thisX) + (scrollX)) y: ((thisY) - (scrollY))\nend\n\ndefine Gravity\nchange [speed y v] by (-2)\nchange [thisy v] by (speed y)\n\ndefine Spawn Effect (x) (y) (effect)\nset [thisx v] to (((x) * (24)) - (12))\nset [thisy v] to ((y) * (24))\nset [effecttype v] to (effect)\ncreate clone of (_myself_ v)\n\nchange [thisx v] by (speed x)\n\nwhen I receive [tick v]\nif <(Child?) = [false]> then\n    if <(length of [effectsgroup v]) > [0]> then\n        repeat until <(length of [effectsgroup v]) = [0]>\n            Effects Config (item (1) of [effectsgroup v])\n            delete (1) of [effectsgroup v]\n        end\n    end\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (costume) (join [_] ([floor v] of ((thisFrame) mod (framecount)) )))\nelse\n    switch costume to (costume)\nend\n\n@Gentle Slope (-)\n\nwhen flag clicked\nset [clone? v] to [false]\nset [ghost v] effect to (100)\nhide\n\ndefine Place Block (x) (y)\nset [startx v] to (x)\nset [starty v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    go to x: ((startX) + (scrollX)) y: ((startY) - (scrollY))\nend\n\nwhen I start as a clone\nset [clone? v] to [true]\nset [ghost v] effect to (100)\nset size to (85) %\nshow\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    Place Block (spawnX) (spawnY)\n    change [i v] by (2)\nend\n\nwhen I receive [tick v]\n\nif <(Clone?) = [false]> then\n    set [ghost v] effect to (100)\n    say (join (round ((mouse x) - (scrollX))) (join [,] ((mouse y) + (scrollY))))\n    show\nend\n\ndefine Add Coordinate (x) (y) (list #)\nset [tileorigin v] to (join (join (x) (join [.] (y))) [^])\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\n@Gentle Slope (+)\n\nwhen flag clicked\nset [clone? v] to [false]\nhide\n\ndefine Place Block (x) (y)\nset [startx v] to (x)\nset [starty v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    go to x: ((startX) + (scrollX)) y: ((startY) - (scrollY))\nend\n\nwhen I start as a clone\nset [clone? v] to [true]\nset [ghost v] effect to (100)\nset size to (85) %\nshow\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    Place Block (spawnX) (spawnY)\n    change [i v] by (2)\nend\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\nclear graphic effects\n\nhide list [spawncodes v]\n\ndefine Add Coordinate (x) (y) (list #)\nset [tileorigin v] to (join (join (x) (join [.] (y))) [^])\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\nAdd Coordinate [3936] [432] [1]\n\ndelete this clone\n\n@Steep Slope (-)\n\nwhen flag clicked\nset [clone? v] to [false]\nset [ghost v] effect to (100)\nhide\n\ndefine Place Block (x) (y)\nset [startx v] to (x)\nset [starty v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    go to x: ((startX) + (scrollX)) y: ((startY) - (scrollY))\nend\n\nwhen I start as a clone\nset [clone? v] to [true]\nset [ghost v] effect to (100)\nset size to (85) %\nshow\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    Place Block (spawnX) (spawnY)\n    change [i v] by (2)\nend\n\nwhen I receive [tick v]\n\nif <(Clone?) = [false]> then\n    set [ghost v] effect to (100)\n    say (join (round ((mouse x) - (scrollX))) (join [,] ((mouse y) + (scrollY))))\n    show\nend\n\ndefine Add Coordinate (x) (y) (list #)\nset [tileorigin v] to (join (join (x) (join [.] (y))) [^])\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\n@Steep Slope (+)\n\nwhen flag clicked\nset [clone? v] to [false]\nset [ghost v] effect to (100)\nhide\n\ndefine Place Block (x) (y)\nset [startx v] to (x)\nset [starty v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    go to x: ((startX) + (scrollX)) y: ((startY) - (scrollY))\nend\n\nwhen I start as a clone\nset [clone? v] to [true]\nset [ghost v] effect to (100)\nset size to (85) %\nshow\n\nwhen I receive [loadlevel v]\nset [i v] to [1]\nDecode Level Coord (item (Level #) of [spawncodes v])\n\ndefine Decode Level Coord (code)\nrepeat until <(i) > ((length of (code)) - (1))>\n    set [spawnx v] to []\n    repeat until <(letter (i) of (code)) = [.]>\n        set [spawnx v] to (join (spawnX) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    change [i v] by (1)\n    set [spawny v] to []\n    repeat until <(letter (i) of (code)) = [^]>\n        set [spawny v] to (join (spawnY) (letter (i) of (code)))\n        change [i v] by (1)\n    end\n    Place Block (spawnX) (spawnY)\n    change [i v] by (2)\nend\n\nwhen I receive [tick v]\n\nif <(Clone?) = [false]> then\n    set [ghost v] effect to (100)\n    say (join (round ((mouse x) - (scrollX))) (join [,] ((mouse y) + (scrollY))))\n    show\nend\n\ndefine Add Coordinate (x) (y) (list #)\nset [tileorigin v] to (join (join (x) (join [.] (y))) [^])\nreplace item (list #) of [spawncodes v] with (join (item (list #) of [spawncodes v]) (join [ ] (tileOrigin)))\n\ndelete this clone\n\n@HUD\n\nwhen flag clicked\nset [clone? v] to [false]\nset [icon # v] to [0]\nSet Up HUD\nhide\n\nwhen I start as a clone\nset [clone? v] to [true]\nif <(tileType) = [Icon]> then\n    go to x: (-190) y: (142)\nend\nif <(tileType) = [StarCoins]> then\n    switch costume to (starcoin_empty v)\n    set size to (30) %\nend\nif <(tileType) = [CoinDigit]> then\n    switch costume to (num_0 v)\n    set size to (200) %\n    go to x: ((-105) - ((18) * ((Icon #) - (1)))) y: (147)\nend\nif <(tileType) = [StarDigit]> then\n    switch costume to (num_0 v)\n    set size to (200) %\n    go to x: ((-123) - ((18) * ((Icon #) - (1)))) y: (127)\nend\nshow\n\nwhen I receive [tick v]\nif <(Clone?) = [true]> then\n    if <(tileType) = [Icon]> then\n        switch costume to (join [Icon_] (Character))\n        set size to (15) %\n    end\n    if <(tileType) = [StarCoins]> then\n        if <(item (Icon #) of [star coins v]) = [true]> then\n            switch costume to (starcoin_get v)\n        else\n            switch costume to (starcoin_empty v)\n        end\n    end\n    if <(tileType) = [CoinDigit]> then\n        Display Counter (Coins)\n    end\n    if <(tileType) = [StarDigit]> then\n        Display Counter (Stars Collected)\n    end\n    go to [front v] layer\nend\n\ndefine Set Up HUD\nset [tiletype v] to [Icon]\ncreate clone of (_myself_ v)\nset [tiletype v] to [StarCoins]\ngo to x: (-196) y: (104)\nset [icon # v] to [1]\nrepeat (3)\n    create clone of (_myself_ v)\n    change [icon # v] by (1)\n    change x by (20)\nend\nset [tiletype v] to []\nset size to (200) %\ngo to x: (-159) y: (148)\nswitch costume to (icon_coin v)\ncreate clone of (_myself_ v)\nset size to (100) %\ngo to x: (-161) y: (129)\nswitch costume to (icon_star v)\ncreate clone of (_myself_ v)\nset [icon # v] to [1]\nset [tiletype v] to [CoinDigit]\nrepeat (3)\n    create clone of (_myself_ v)\n    change [icon # v] by (1)\nend\nset [icon # v] to [1]\nset [tiletype v] to [StarDigit]\nrepeat (2)\n    create clone of (_myself_ v)\n    change [icon # v] by (1)\nend\n\ndefine Display Counter (num)\nif <(num) > (([10 ^ v] of ((Icon #) - (1)) ) - (1))> then\n    switch costume to (join [Num_] (([floor v] of ((num) / ([10 ^ v] of ((Icon #) - (1)) )) ) mod (10)))\nelse\n    switch costume to (num_0 v)\nend\n\n@Music\n\nwhen flag clicked\nset volume to (85) %\nforever\n    play sound [Main Theme - New Super Mario Bros v] until done\nend\n\nwhen I receive [playerdefeat v]\nstop [other scripts in sprite v]\nstop all sounds\n\nwhen I receive [you got a star! v]\nstop [other scripts in sprite v]\n\nwhen I receive [tick v]\nif <not <(Paused) = [true]>> then\n    set volume to (85) %\nelse\n    set volume to (55) %\nend\n\n@Power-Ups\n\nwhen flag clicked\nset size to (75) %\nset [child? v] to [false]\nhide\n\ndefine Get Spawn Coordinates (data)\nset [i v] to [0]\nrepeat until <(letter (i) of (data)) = [:]>\n    change [i v] by (1)\nend\nchange [i v] by (1)\nset [spawnx v] to []\nrepeat until <(letter (i) of (data)) = [,]>\n    set [spawnx v] to (join (spawnX) (letter (i) of (data)))\n    change [i v] by (1)\nend\nchange [i v] by (1)\nset [spawny v] to []\nrepeat until <(i) > (length of (data))>\n    set [spawny v] to (join (spawnY) (letter (i) of (data)))\n    change [i v] by (1)\nend\n\ndefine Power-Up Config (data)\nGet Spawn Coordinates (data)\nif < (data) contains [0:]?> then\n    Spawn Power-Up (spawnX) (spawnY) [Mushroom]\nend\nif < (data) contains [1:]?> then\n    Spawn Power-Up (spawnX) (spawnY) [Fire Flower]\nend\n\nwhen I receive [tick v]\nif <(Child?) = [false]> then\n    if <(length of [itemspawn v]) > [0]> then\n        repeat until <(length of [itemspawn v]) = [0]>\n            Power-Up Config (item (1) of [itemspawn v])\n            delete (1) of [itemspawn v]\n        end\n    end\nend\n\ndefine Spawn Power-Up (x) (y) (type)\nset [startx v] to (((x) * (24)) - (12))\nset [starty v] to (((y) * (24)) - (12))\nif <([power v] of [player v]) = [Small]> then\n    set [powertype v] to [Mushroom]\nelse\n    set [powertype v] to (type)\nend\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [thisy v] to (startY)\nset [collisionactive? v] to [false]\nset [child? v] to [true]\nswitch costume to (powerType)\nstart sound [item-spawn v]\nwait (0.05) seconds\nshow\ngo [backward v] (10) layers\nrepeat (12)\n    change [thisy v] by (2)\nend\nset [collisionactive? v] to [true]\n\nwhen I receive [tick v]\nif <(Child?) = [true]> then\n    if <(collisionActive?) = [true]> then\n        Player Sensing ([power v] of [player v])\n    end\n    go to x: ((startX) + (scrollX)) y: ((thisY) - (scrollY))\nend\n\ndefine Player Sensing (ppower)\nif <touching (player v)?> then\n    if <(powerType) = [Mushroom]> then\n        if <(ppower) = [Small]> then\n            start sound [player-grow v]\n            broadcast (Power_Mushroom v)\n        else\n            start sound [has-item v]\n        end\n    end\n    if <(powerType) = [Fire Flower]> then\n        start sound [player-grow v]\n        broadcast (Power_Fire v)\n    end\n    delete this clone\nend\n\n@Player_Projectiles\n\nwhen flag clicked\nset [child? v] to [false]\nset size to (90) %\nhide\n\ndefine Spawn NPC (x) (y) (direction) (type)\nset [thisx v] to (x)\nset [thisy v] to (y)\nset [setdirection v] to (direction)\nset [npctype v] to (type)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [child? v] to [true]\ngo to x: ((thisX) + (scrollX)) y: ((thisY) - (scrollY))\nset [falling? v] to [0]\nset [collisiontimeout v] to [0]\nset [destroydelay v] to [0]\nset [thisframe v] to [0]\nset [setspeed v] to (((round ([abs v] of ([speed x v] of [player v]) )) / (3)) + (10))\nset [hitceiling? v] to [false]\nset [delayverticalscroll v] to [false]\nif <(setDirection) = [90]> then\n    set [speed x v] to (setSpeed)\nelse\n    set [speed x v] to ((setSpeed) * (-1))\nend\nset [speed y v] to [0]\nset rotation style [left-right v]\npoint in direction ((setDirection) * (-1))\nwait (0.05) seconds\nshow\n\nwhen I receive [playerprojectile v]\nif <(Child?) = [false]> then\n    if <([power v] of [player v]) = [Fire]> then\n        Spawn NPC (([x position v] of [player v]) - (scrollX)) (([y position v] of [player v]) + (scrollY)) ([direction v] of [player v]) [Fireball]\n        start sound [fireball v]\n    end\nend\n\nwhen I receive [tick v]\nif <(Child?) = [true]> then\n    set [delayverticalscroll v] to <<not <(scrollLockY) = [true]>> and <([falling? v] of [player v]) > [2]>>\n    if <not <(delayVerticalScroll) = [true]>> then\n        set y to ((thisY) - (scrollY))\n    end\n    Ceiling Collision <(speed y) > [0]>\n    switch costume to (hitbox v)\n    change [thisframe v] by (([abs v] of (speed x) ) / (12))\n    change [thisx v] by (speed x)\n    NPC Collision\n    Gravity\n    Touch Ground <(speed y) > [0]>\n    Wall Collision\n    Play Anim [Fireball] [4]\n    Off-Screen <([abs v] of (x position) ) > [235]> <([abs v] of (y position) ) > [175]>\n    set x to ((thisX) + (scrollX))\n    if <(delayVerticalScroll) = [true]> then\n        set y to ((thisY) - (scrollY))\n    end\nend\n\ndefine Gravity\nif <(speed y) > [-35]> then\n    change [speed y v] by (-2)\nend\nchange [thisy v] by (speed y)\nchange [falling? v] by (1)\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <<not <touching (map v)?>> and <<not <touching (blocks v)?>> and <not <touching (semi-solids v)?>>>>\n    change [collisiontimeout v] by (1)\n    if <<(hitCeiling?) = [true]> or <(collisionTimeout) > [49]>> then\n        delete this clone\n    else\n        change y by (1)\n        change [thisy v] by (1)\n        set [falling? v] to [0]\n        set [speed y v] to [0]\n    end\nend\nset [collisiontimeout v] to [0]\nif <(falling?) = [0]> then\n    set [speed y v] to [8]\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (join (costume) [_]) ([floor v] of ((thisFrame) mod (framecount)) ))\nelse\n    switch costume to (costume)\nend\n\ndefine Wall Collision\nswitch costume to (wall_sensor v)\nif <<touching (map v)?> or <touching (blocks v)?>> then\n    delete this clone\nend\n\ndefine Ceiling Collision <up?>\nswitch costume to (top_sensor v)\nif <up?> then\n    set [hitceiling? v] to <<touching (map v)?> or <touching (blocks v)?>>\nelse\n    set [hitceiling? v] to [false]\nend\n\ndefine Off-Screen <offscreenx> <offscreeny>\nif <<offscreenx> or <offscreeny>> then\n    delete this clone\nend\n\ndefine NPC Collision\nif <(destroyDelay) > [0]> then\n    change [destroydelay v] by (1)\n    if <(destroyDelay) > [1]> then\n        delete this clone\n    end\nelse\n    if <<touching (goomba v)?> or <<touching (koopa troopa v)?> or <touching (piranha plant v)?>>> then\n        set [destroydelay v] to [1]\n    end\nend\n\n@Stars\n\nwhen flag clicked\nset size to (80) %\nset [child? v] to [false]\nhide\n\ndefine Spawn Star (x) (y)\nset [startx v] to ((x) * (24))\nset [starty v] to ((y) * (24))\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [child? v] to [true]\ngo to x: ((startX) + (scrollX)) y: ((startY) - (scrollY))\nwait (0.05) seconds\nshow\n\nwhen I receive [tick v]\nif <(Child?) = [true]> then\n    Frame Rate Config [0.25] [8]\n    Play Anim [Star] [8]\n    if <touching (player v)?> then\n        broadcast (You Got a Star! v)\n    end\n    go to x: ((startX) + (scrollX)) y: ((startY) - (scrollY))\nend\n\ndefine Play Anim (costume) (framecount)\nif <(framecount) > [1]> then\n    switch costume to (join (costume) (join [_] ([floor v] of ((thisFrame) mod (framecount)) )))\nelse\n    switch costume to (costume)\nend\n\ndefine Frame Rate Config (rate) (framecount)\nif <(thisFrame) = (framecount)> then\n    set [thisframe v] to [0]\nelse\n    change [thisframe v] by (rate)\nend\n\nwhen I receive [loadlevel v]\nif <(Level #) = [1]> then\n    Spawn Star [216] [7]\nend\n\n@Foreground\n\nwhen flag clicked\ngo to [front v] layer\nshow\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [playerdefeat v]\nwait (3) seconds\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nwait (0.5) seconds\nstop [all v]\n\nwhen I receive [you got a star! v]\nwait (8) seconds\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nwait (0.5) seconds\nstop [all v]\n\n@Game Clear!\n\nwhen flag clicked\nhide\n\nwhen I receive [you got a star! v]\nchange [☁ numclears v] by (1)\nstop all sounds\nstart sound [got-star v]\nset size to (10) %\ngo to [front v] layer\nshow\nrepeat until <(size) = [95]>\n    change size by (5)\n    turn right (45) degrees\nend\npoint in direction (90)\nshow variable [☁ numclears v]\nwait (4) seconds\nhide variable [☁ numclears v]\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n