Scratchey - A Platformer

Instructions: ----------------------------CONTROLS----------------------------\nJump: ↑ or W or Space\nRight: → or D\nLeft: ← or A\nWall Jumping: Jump on Wall + ↑ or W or Space\n--------------------------CHANGELOG----------------------------\n2022-03-05 - Initial Release\n2022-03-06 - New Scene Added\n2022-03-06 - Boss Added\n2022-03-07 - Custom Life & Coin Counters Added\n2022-03-12 - New Scene Added\n2022-03-18 - Audio on/off Button Added\n2022-03-23 - Rotating Platforms Added\n2022-03-23 - New Scene Added\n2022-03-24 - Sliding Label Bug Fixed\n2022-03-25 - Changed Thumbnail\n2022-03-28 - Fixed Play Button Bug\n2022-04-03 - Coin Counter Bug Fixed\n2022-04-11 - Changed Starting Screen\n2022-04-27 - Inro Added\n2022-04-27 - Fixed Label Intro Bug\n2023-01-02 - Fixed Game Over Play Button Bug\n2023-02-25 - Fixed Lava Glitch\n-------------------------COMING SOON--------------------------\n- Mobile Accessibility\n- Settings Bar

@Stage\n\nwhen flag clicked\n\nswitch backdrop to (backdrop7 v)\n\nwhen I receive [scene1 v]\n\nswitch backdrop to (backdrop7 v)\n\nwhen I receive [scene2 v]\n\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [scene3 v]\n\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [scene4 v]\n\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [scene5 v]\n\nswitch backdrop to (backdrop4 v)\n\nwhen I receive [scene6 v]\n\nswitch backdrop to (backdrop5 v)\n\nwhen I receive [scene7 v]\n\nswitch backdrop to (backdrop6 v)\n\nwhen I receive [scene 101 v]\n\nswitch backdrop to (backdrop9 v)\n\nwhen I receive [scene104 v]\n\nswitch backdrop to (backdrop8 v)\n\nwhen I receive [scene102 v]\n\nswitch backdrop to (backdrop10 v)\n\nwhen I receive [main menu v]\nswitch backdrop to (backdrop11 v)\n\nwhen flag clicked\nswitch backdrop to (backdrop12 v)\n\n@Player\n\nwhen flag clicked\nset [lives v] to [3]\nset [speed v] to [0]\nbroadcast (Main Menu v)\n\ndefine Move - in steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((speed x) / (steps))\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Collide X - Slope or Wall?\n    end\n    set [last value v] to (y position)\n    change y by ((speed y) / (steps))\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Collide Y - Ceiling or Floor?\n    end\nend\n\ndefine Check Touching Solid\nif <<touching (level v)?> or <touching (platform v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick - player v]\nMoved by Moving Platform\nControls - Up and Down\nControls - Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet Costume\n\ndefine Controls - Up and Down\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> then\n    if <<(wall slide) > [0]> and <(jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [3]\n        set [wall slide v] to [0]\n        turn right (180) degrees\n        set [speed x v] to (((direction) / (90)) * (7))\n        set [long jump v] to [0]\n        start sound [Jump v]\n    end\n    if <<(falling) < [3]> and <(jumping) = [0]>> then\n        set [jumping v] to [1]\n        set [falling v] to [12]\n        start sound [Jump v]\n    end\n    if <<(jumping) > [0]> and <(jumping) < (JUMP DURATION)>> then\n        change [jumping v] by (1)\n        set [speed y v] to (JUMP FORCE)\n    end\nelse\n    set [jumping v] to [0]\nend\nchange [speed y v] by (GRAVITY)\nif <(wall slide) > [0]> then\n    Check Can Wall Slide\n    if <(speed y) < [0]> then\n        set [speed y v] to ((speed y) * (.6))\n    end\nend\n\ndefine Controls - Left and Right\ngo [forward v] (10000000000000) layers\ngo to [front v] layer\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to (<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>)\nif <(KEY X) = [0]> then\n    if <<(falling) > [2]> and <(wall slide) < [1]>> then\n        set [speed x v] to ((speed x) * (0.98))\n        stop [this script v]\n    end\n    if <([abs v] of (speed x) ) < [1]> then\n        set [frame v] to [0]\n        set [speed x v] to [0]\n    else\n        change [frame v] by (0.5)\n    end\nelse\n    change [speed x v] by ((KEY X) * (ACCELERATION))\n    if <not <(direction) = ((KEY X) * (90))>> then\n        set [wallslide v] to [0]\n    end\n    point in direction ((KEY X) * (90))\n    change [frame v] by (1)\nend\nset [speed x v] to ((speed x) * (RESISTANCE))\n\nset [speed x v] to ((speed x) * (RESISTANCE))\n\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to [0]\n\ndefine Reset and Begin Level\nset [invulnerable v] to [0]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\nset [wall slide v] to [0]\nset [jumping v] to [0]\nset [long jump v] to [0]\npoint in direction (90)\nBegin Scene # (SPAWN SCENE) go to x, y: (SPAWN X) (SPAWN Y)\n\nwhen I receive [game loop v]\nset [ghost v] effect to (0)\nforever\n    broadcast (Tick - First v)\n    broadcast (Tick - Platforms v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((Scene #) + (1)) go to x, y: [-235] []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((Scene #) + (-1)) go to x, y: [235] []\nend\nif <(y position) > [180]> then\n    Begin Scene # ((Scene #) + (100)) go to x, y: [] [-160]\nend\nif <(y position) < [-177]> then\n    Begin Scene # ((Scene #) - (100)) go to x, y: [] [180]\nend\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Scene # (scene #) go to x, y: (x) (y)\nset [scene # v] to (scene #)\nif <(x) > []> then\n    set x to (x)\nend\nif <(y) > []> then\n    set y to (y)\nend\nbroadcast (About to Change Scene v)\nbroadcast (Change Scene v)\ngo [forward v] (456576) layers\ngo to [front v] layer\nstop [other scripts in sprite v]\nwait (0) seconds\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nif <(x) > []> then\n    Fix Collision in Direction [0]\nelse\n    Fix Collision in Direction [90]\nend\nSet Costume\nbroadcast (Game Loop v)\n\ndefine Fix Collision in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (128)\n    Check Touching Solid\n    if <(touching) < [1]> then\n        point in direction (temp)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nset [platform dx v] to []\nset [platform dy v] to []\n\ndefine Set Costume\nset rotation style [left-right v]\nif <(wall slide) > [0]> then\n    switch costume to (hangon01 v)\n    stop [this script v]\nend\nif <(falling) > [1]> then\n    if <(speed y) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n    end\n    stop [this script v]\nend\nif <(frame) > [0]> then\n    switch costume to ((1) + ([floor v] of ((frame) mod (16)) ))\nelse\n    switch costume to (hit angle 0 v)\n    repeat (5)\n        Check Touching Solid\n        if <(touching) < [1]> then\n            switch costume to ((costume [number v]) + (5))\n            stop [this script v]\n        end\n        next costume\n    end\n    switch costume to (stand v)\nend\n\ndefine Collide X - Slope or Wall?\nCheck Can Wall Slide\nchange y by (1)\nCheck Touching Solid\nif <(touching) > [0]> then\n    change y by (1)\n    Check Touching Solid\n    if <(touching) > [0]> then\n        change y by (-2)\n        set x to (last value)\n        set [speed x v] to [0]\n        stop [this script v]\n    end\n    set [speed x v] to ((speed x) * (0.8))\nend\nset [speed x v] to ((speed x) * (.95))\nSlip\n\ndefine Collide Y - Ceiling or Floor?\nset y to (last value)\nif <(speed y) > [0]> then\n    set [speed y v] to [0]\n    stop [this script v]\nend\nif <(falling) > [0]> then\n    set [falling v] to [0]\n    Slip\nend\nset [speed y v] to ((speed y) * (0.8))\n\ndefine Slip\nchange y by (-2)\nchange x by (1)\nCheck Touching Solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck Touching Solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\ndefine Check Can Wall Slide\nif <(falling) < [2]> then\n    set [wall slide v] to [0]\n    stop [this script v]\nend\nswitch costume to (hitbox wallslide v)\nset rotation style [left-right v]\nCheck Touching Solid\nset [wall slide v] to (touching)\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\n\nwhen I receive [lose life v]\nset [invulnerable v] to [1]\nstart sound [Meow v]\nstart sound [Oops v]\nstop [other scripts in sprite v]\nrepeat (5)\n    switch costume to (die-01 v)\n    wait (0.1) seconds\n    change [ghost v] effect by (20)\n    switch costume to (die-02 v)\n    wait (0.1) seconds\nend\nwait (0.5) seconds\nchange [lives v] by (-1)\nif <(Lives) > [0]> then\n    Reset and Begin Level\nelse\n    broadcast (Game Over v)\nend\n\ndefine Moved by Moving Platform\nchange x by (PLATFORM DX)\nchange y by (PLATFORM DY)\nCheck Touching Solid\nif <(touching) > [0]> then\n    Find Closest Space to (x position) (y position) max [12]\n    if <(touching) > [0]> then\n        broadcast (Lose Life v)\n    end\nend\n\ndefine Find Closest Space to (x) (y) max (max)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (0)\nrepeat (max)\n    repeat (16)\n        go to x: (x) y: (y)\n        move (distance) steps\n        Check Touching Solid\n        if <(touching) < [1]> then\n            point in direction (temp)\n            stop [this script v]\n        end\n        turn right (22.5) degrees\n    end\n    change [distance v] by (1)\nend\ngo to x: (x) y: (y)\npoint in direction (temp)\n\nwhen I receive [start game v]\nset [gravity v] to [-1]\nset [jump force v] to [12]\nset [jump duration v] to [5]\nset [acceleration v] to [1.5]\nset [resistance v] to [0.8]\nbroadcast (Reset Game v)\nbroadcast (Setup v) and wait\nset [lives v] to [3]\nset [spawn scene v] to [1]\nset [spawn x v] to [-120]\nset [spawn y v] to [0]\nReset and Begin Level\n\nwhen I receive [player - bounce v]\nset [speed y v] to [10]\n\nwhen I receive [bounce boss v]\nset [speed y v] to [15]\n\nwhen I receive [trampoline bounce v]\nset [speed y v] to [20]\n\npoint in direction ((KEY X) * (90))\n\nwhen I receive [start game v]\n\nif <not <(Lives) = [0]>> then\n    repeat (5)\n        set [ghost v] effect to (100)\n        wait (0.1) seconds\n        set [ghost v] effect to (0)\n        wait (0.1) seconds\n    end\nend\n\nif <(KEY X) = [0]> then\n    if <<(falling) > [2]> and <(wall slide) < [1]>> then\n        set [speed x v] to ((speed x) * (0.98))\n        stop [this script v]\n    end\n    if <([abs v] of (speed x) ) < [1]> then\n        set [frame v] to [0]\n        set [speed x v] to [0]\n    else\n        change [frame v] by (.5)\n    end\nelse\n    change [speed x v] by ((KEY X) * (ACCELERATION))\n    if <not <(direction) = ((KEY X) * (90))>> then\n        set [wall slide v] to [0]\n    end\n    point in direction ((KEY X) * (90))\n    change [frame v] by (1)\nend\n\nwhen flag clicked\ngo to [back v] layer\n\n@Level\n\nwhen flag clicked\nset [scene # v] to [1]\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\ngo to x: (0) y: (0)\nswitch costume to (join [Scene] (Scene #))\nerase all\nStamp Shadow\n\ndefine Stamp Shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (90)\nchange y by (-15)\nchange x by (-7)\nstamp\nchange y by (15)\nchange x by (7)\nclear graphic effects\n\nwhen I receive [begin v]\nshow\n\n@Enemy\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [change scene v]\nif <(Scene #) = [1]> then\n    if <([x position v] of [player v]) < [0]> then\n        Spawn [Red] at [23] [-86] dir [90]\n    else\n        Spawn [Red] at [23] [-86] dir [90]\n    end\nend\nif <(Scene #) = [2]> then\n    Spawn [Red] at [69] [-83] dir [90]\nend\nif <(Scene #) = [3]> then\n    Spawn [Red] at [-61] [8] dir [90]\n    Spawn [Red] at [62] [9] dir [-90]\nend\nif <(Scene #) = [102]> then\n    Spawn [Red] at [-134] [-11] dir [90]\nend\nif <(Scene #) = [104]> then\n    Spawn [Red] at [-142] [-13] dir [90]\nend\nif <(Scene #) = [5]> then\n    Spawn [Red] at [-104] [-71] dir [90]\nend\nif <(Scene #) = [203]> then\n    Spawn [Red] at [17] [2] dir [90]\nend\nif <(Scene #) = [-96]> then\n    Spawn [Red] at [24] [-95] dir [-90]\nend\n\nwhen I start as a clone\nshow\nset [speed y v] to [0]\nset [frame v] to [0]\nforever\n    switch costume to (red1 v)\n    set rotation style [don't rotate v]\n    Move - Left or Right\n    Move - Down\n    change [frame v] by (0.33)\n    switch costume to ((1) + (([floor v] of (Frame) ) mod (4)))\n    set rotation style [left-right v]\n    if <<(invulnerable) = [0]> and <touching (player v)?>> then\n        Touching Player\n    end\nend\n\nwhen I receive [about to change scene v]\ndelete this clone\n\ndefine Move - Down\nchange [speed y v] by (-1)\nchange y by (SPEED Y)\nrepeat until <not <touching (level v)?>>\n    change y by (1)\n    set [speed y v] to [0]\nend\n\ndefine Move - Left or Right\nmove (2) steps\nrepeat (4)\n    if <not <<touching (level v)?> or <touching (_edge_ v)?>>> then\n        if <not <<touching (safe zones v)?> or <touching (platform v)?>>> then\n            stop [this script v]\n        end\n    end\n    change y by (1)\nend\nchange y by (-4)\nmove (-2) steps\nturn right (180) degrees\n\ndefine Touching Player\nif <([speed y v] of [player v]) < [-3]> then\n    broadcast (Player - bounce v)\n    switch costume to (red squish v)\n    wait (0.3) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\nbroadcast (Lose Life v)\n\ndefine Spawn (type) at (x) (y) dir (dir)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\n\nwhen I receive [player - bounce v]\nif <(music) = [on]> then\n    start sound [Squish Pop v]\nend\n\n@Boss\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [change scene v]\nif <(Scene #) = [205]> then\n    broadcast (boss v)\n    Spawn [Purple] at [172] [-92] dir [-90]\nend\n\nwhen I start as a clone\nshow\nset [speed y v] to [0]\nset [frame v] to [0]\nforever\n    switch costume to (purple1 v)\n    set rotation style [don't rotate v]\n    Move - Left or Right\n    Move - Down\n    change [frame v] by (0.33)\n    switch costume to ((1) + (([floor v] of (Frame) ) mod (4)))\n    set rotation style [left-right v]\n    if <<(invulnerable) = [0]> and <touching (player v)?>> then\n        Touching Player\n    end\nend\n\nwhen I receive [about to change scene v]\ndelete this clone\n\ndefine Move - Down\nchange [speed y v] by (-1)\nchange y by (SPEED Y)\nrepeat until <not <touching (level v)?>>\n    change y by (1)\n    set [speed y v] to [0]\nend\n\ndefine Move - Left or Right\nmove (2) steps\nrepeat (4)\n    if <not <<touching (level v)?> or <touching (_edge_ v)?>>> then\n        if <not <<touching (safe zones v)?> or <touching (platform v)?>>> then\n            stop [this script v]\n        end\n    end\n    change y by (1)\nend\nchange y by (-4)\nmove (-2) steps\nturn right (180) degrees\n\ndefine Touching Player\nif <([y position v] of [player v]) > [-93]> then\n    broadcast (bounce boss v)\n    switch costume to (purple quish v)\n    wait (0.3) seconds\n    switch costume to (purple quish v)\n    change [boss squish v] by (1)\nend\nif <([y position v] of [player v]) < [-92]> then\n    broadcast (Lose Life v)\nend\nif <(Boss Squish) = [10]> then\n    broadcast (win v)\n    wait (1) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\ndefine Spawn (type) at (x) (y) dir (dir)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\n\nwhen I receive [change scene v]\nset [boss squish v] to [0]\n\n@Splash Screen\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (main menu v)\ngo to [front v] layer\nshow\nforever\n    if <(costume [number v]) = [1]> then\n        go to x: (0) y: (35)\n    end\nend\n\nwhen I receive [game over v]\ngo to x: (0) y: (35)\nswitch costume to (game over v)\ngo to [front v] layer\nshow\nbroadcast (Main Menu v) and wait\n\nbroadcast (Main Menu v)\n\nwhen I receive [main menu v]\nif <(costume [number v]) = [4]> then\n    point in direction (90)\nend\nwait (0.001) seconds\ngo to [front v] layer\nif <(costume [number v]) = [1]> then\n    repeat until <not <(costume [number v]) = [1]>>\n        change [speed v] by (5)\n        point in direction ((([sin v] of (SPEED) ) * (1)) + (90))\n    end\nend\nif <(costume [number v]) = [3]> then\n    wait (3.6) seconds\n    broadcast (start screen v)\n    point in direction (90)\nend\n\nwhen I receive [start game v]\nhide\n\ngo to [front v] layer\n\nwhen flag clicked\nhide\nforever\n    set size to (100) %\nend\n\nwhen I receive [win v]\ngo to x: (35) y: (43)\nswitch costume to (win v)\ngo to [back v] layer\nshow\nplay sound [Win v] until done\n\nwhen I receive [main menu v]\nforever\n    if <(costume [number v]) = [3]> then\n        go to x: ((mouse x) / (30)) y: ((mouse y) / (30))\n    end\nend\n\nwhen I receive [begin v]\nshow\n\n@Start Script\n\nwhen I receive [start screen v]\ngo to [front v] layer\ngo to x: (0) y: (80)\nshow\nset size to (0) %\nforever\n    set x to (0)\n    set y to ((50) + (([cos v] of ((sine) * (10)) ) * (5)))\n    point in direction ((90) + (([sin v] of ((sine) * (10)) ) * (2)))\n    change [sine v] by (1)\n    if  then\n    else\n        set [bounce v] to (((bounce) * (0.6)) + (((220) - (size)) / (5)))\n        change size by (bounce)\n    end\nend\n\nwhen I receive [start game v]\nhide\n\nwhen flag clicked\nhide\n\n@Main Menu\n\nwhen I receive [start screen v]\nwait (.0000001) seconds\ngo to [front v] layer\nshow\nset size to (10) %\nif <(Lives) = [0]> then\n    go to x: (1) y: (-70)\nelse\n    go to x: (-60) y: (-70)\nend\nforever\n    go [forward v] (546456745765678568967894678567867896789) layers\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((150) - (size)))\n        switch costume to (play button3 v)\n    else\n        change size by ((0.2) * ((130) - (size)))\n        switch costume to (play button v)\n    end\n    change [speed v] by (5)\n    point in direction ((([sin v] of (SPEED) ) * (3)) + (90))\nend\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nbroadcast (Start Game v)\nplay sound [Wood Tap v] until done\n\nwhen I receive [start game v]\nhide\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [back v]\nshow\n\nwhen I receive [begin v]\nshow\n\nwhen I receive [game over v]\nwait (.0000001) seconds\ngo to [front v] layer\nshow\nset size to (10) %\nif <(Lives) = [0]> then\n    go to x: (1) y: (-70)\nelse\n    go to x: (-60) y: (-70)\nend\nswitch costume to (play button3 v)\nforever\n    go [forward v] (546456745765678568967894678567867896789) layers\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((150) - (size)))\n        switch costume to (play button3 v)\n    else\n        change size by ((0.2) * ((130) - (size)))\n        switch costume to (play button v)\n    end\n    change [speed v] by (5)\n    point in direction ((([sin v] of (SPEED) ) * (3)) + (90))\nend\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\ngo to x: (0) y: (0)\nswitch costume to (blank v)\nswitch costume to (join [Scene] (Scene #))\nif <<<(Scene #) = [5]> or <<<(Scene #) = [101]> or <(Scene #) = [102]>> or <(Scene #) = [203]>>> or <(Scene #) = [204]>> then\n    forever\n        set y to ((5) * ([sin v] of ((timer) * (180)) ))\n    end\nend\n\ndefine Stamp Shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (90)\nchange y by (-15)\nchange x by (-7)\nstamp\nchange y by (15)\nchange x by (7)\nclear graphic effects\n\ndefine Stamp Outline\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\nrepeat (72)\n    move (2) steps\n    stamp\n    move (-2) steps\n    turn right (5) degrees\nend\nclear graphic effects\n\n@Shadow\n\nwhen I receive [change scene v]\nshow\nset [change scene message v] to [1]\ngo to [back v] layer\ngo to x: (([x position v] of [danger v]) - ()) y: (([y position v] of [danger v]) - ())\nswitch costume to (blank v)\nswitch costume to (join [Scene] (Scene #))\n\nwhen I receive [main menu v]\nhide\n\n@Platform\n\nwhen I receive [change scene v]\nhide\nif <(Scene #) = [101]> then\n    Spawn [Side] at [11] [-45] dir [90] turn []\nend\nif <(Scene #) = [104]> then\n    go to [back v] layer\n    show\n    Door at [-190] [32] key [Key]\nend\nif <(Scene #) = [5]> then\n    Spawn [Up] at [140] [-44] dir [90] turn []\nend\nif <(Scene #) = [103]> then\n    Animate Platform 3\nend\nif <(Scene #) = [204]> then\n    Spawn [rotate] at [-125] [-101] dir [90] turn [1]\n    Spawn [rotate] at [-45] [-101] dir [82] turn [1]\n    Spawn [rotate] at [35] [-101] dir [74] turn [1]\n    Spawn [rotate2] at [115] [-101] dir [66] turn [1]\nend\nif <(Scene #) = [205]> then\n    Spawn [Door] at [0] [54] dir [90] turn []\nend\n\ndefine Animate Platform\nshow\ngo to [back v] layer\nforever\n    glide (2) secs to x: (169) y: (-45)\n    wait (1) seconds\n    glide (2) secs to x: (11) y: (-45)\n    wait (1) seconds\nend\n\nwhen I receive [tick - platforms v]\nTick (x position) (y position)\nset [last x v] to (x position)\nset [last y v] to (y position)\n\ndefine Tick (new x) (new y)\nif <(turn) > []> then\n    change y by (4)\n    if <touching (player v)?> then\n        Rotation Maths CCW ((0) - (turn))\n    end\nelse\n    if <(new y) > (last y)> then\n        change y by (1)\n    else\n        set y to ((last y) + (1))\n    end\n    if <touching (player v)?> then\n        set [platform dx v] to ((new x) - (last x))\n        set [platform dy v] to ((new y) - (last y))\n    end\nend\ngo to x: (new x) y: (new y)\n\ndefine Door at (x) (y) key (key name)\nshow\nswitch costume to (key name)\ngo to x: (x) y: (y)\nforever\n    wait until <touching (player v)?>\n    if <[collected v] contains (key name)?> then\n        start sound [Machine v]\n        repeat (24)\n            change y by (4)\n        end\n        wait (1) seconds\n        start sound [Machine v]\n        repeat (24)\n            change y by (-4)\n        end\n        start sound [Crunch v]\n    else\n        start sound [Low Squeak v]\n    end\n    wait until <not <touching (player v)?>>\nend\n\nwhen flag clicked\nforever\n    if <not <(Scene #) = [103]>> then\n        broadcast (Stop Stompers v)\n    end\n    if <(Scene #) = [103]> then\n        broadcast (Stompers v)\n    end\nend\n\ndefine Animate Platform 2\nshow\ngo to [back v] layer\nforever\n    glide (2) secs to x: (26) y: (31)\n    wait (1) seconds\n    glide (2) secs to x: (140) y: (-44)\n    wait (1) seconds\nend\n\ndefine Animate Platform 3\nshow\ngo to [back v] layer\nswitch costume to (stomper v)\ngo to x: (0) y: (0)\nforever\n    glide (0.1) secs to x: (0) y: (-72)\n    play sound [Crunch v] until done\n    wait (1) seconds\n    glide (.3) secs to x: (0) y: (0)\n    wait (1) seconds\nend\n\ndefine Animate Platform 4\nshow\ngo to [back v] layer\ngo to x: (0) y: (54)\nwait (0.5) seconds\nglide (1) secs to x: (0) y: (-72)\nplay sound [Crunch v] until done\n\ndefine Tester Platform\nshow\ngo to [back v] layer\nswitch costume to (rotate v)\nforever\n    glide (2) secs to x: (x position) y: ((y position) - (90))\n    wait (1) seconds\n    glide (2) secs to x: (x position) y: ((y position) + (90))\n    wait (1) seconds\nend\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [about to change scene v]\ndelete this clone\n\ndefine Spawn (type) at (x) (y) dir (dir) turn (degrees)\nset [turn v] to (degrees)\nswitch costume to (type)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif < (costume [name v]) contains [Key]?> then\n    Door at (x position) (y position) key [Key]\nend\nif <(turn) > []> then\n    show\n    set rotation style [all around v]\n    forever\n        turn right (turn) degrees\n    end\nend\nif <(Scene #) = [101]> then\n    Animate Platform\nend\nif <(Scene #) = [5]> then\n    Animate Platform 2\nend\nif <(Scene #) = [103]> then\n    Animate Platform 3\nend\nif <(Scene #) = [205]> then\n    Animate Platform 4\nend\nif <(Scene #) = [204]> then\n\ngo to x: (140) y: (-44)\n\nswitch costume to (up v)\n\nSpawn [rotate] at [-69] [21] dir [90] turn []\nTester Platform\n\ndefine Rotation Maths CCW (ccw)\nset [dx v] to (([x position v] of [player v]) - (x position))\nset [dy v] to (([y position v] of [player v]) - (y position))\nset [sin v] to ([sin v] of (ccw) )\nset [cos v] to ([cos v] of (ccw) )\nset [platform dx v] to ((((dx) * (cos)) - ((dy) * (sin))) - (dx))\nset [platform dy v] to ((((dx) * (sin)) + ((dy) * (cos))) - (dy))\n\nTester Platform\n\n@Collectables\n\nwhen I receive [change scene v]\nif <(Scene #) = (my scene)> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nrepeat until <touching (player v)?>\n    change y by ((0.5) * ([sin v] of (frame) ))\n    change [frame v] by (5)\nend\nset [my scene v] to []\nif <<(costume [name v]) = [coin]> or <(costume [name v]) = [coin BIG]>> then\n    broadcast (coin v)\n    play sound [Coin v] until done\n    change [coins v] by (1)\nelse\n    if <(costume [name v]) = [Green 🚩]> then\n        start sound [Connect v]\n        set [spawn scene v] to (Scene #)\n        set [spawn x v] to ([x position v] of [player v])\n        set [spawn y v] to ([y position v] of [player v])\n    else\n        add (costume [name v]) to [collected v]\n        play sound [Magic Spell v] until done\n    end\nend\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [setup v]\ndelete all of [collected v]\nset [frame v] to [0]\nset [coins v] to [0]\nhide\nPlace [coin] scene [1] xy [199] [-17]\nPlace [coin] scene [1] xy [-187] [116]\nPlace [coin] scene [2] xy [32] [8]\nPlace [Green 🚩] scene [3] xy [180] [-23]\nPlace [coin] scene [3] xy [-3] [72]\nPlace [coin] scene [101] xy [221] [-6]\nPlace [coin] scene [102] xy [-57] [99]\nPlace [Green 🚩] scene [104] xy [115] [-8]\nPlace [Green 🚩] scene [203] xy [192] [-99]\nPlace [coin] scene [104] xy [-15] [45]\nPlace [Key] scene [105] xy [-17] [40]\nPlace [coin] scene [106] xy [-95] [70]\nPlace [coin] scene [106] xy [-95] [35]\nPlace [coin] scene [106] xy [-95] [0]\nPlace [coin] scene [106] xy [-45] [70]\nPlace [coin] scene [106] xy [-45] [35]\nPlace [coin] scene [106] xy [-45] [0]\nPlace [coin] scene [106] xy [5] [70]\nPlace [coin] scene [106] xy [5] [35]\nPlace [coin] scene [106] xy [5] [0]\nPlace [coin] scene [106] xy [55] [70]\nPlace [coin] scene [106] xy [55] [35]\nPlace [coin] scene [106] xy [55] [0]\nPlace [coin] scene [106] xy [105] [70]\nPlace [coin] scene [106] xy [105] [35]\nPlace [coin] scene [106] xy [105] [0]\nPlace [coin] scene [106] xy [155] [70]\nPlace [coin] scene [106] xy [155] [35]\nPlace [coin] scene [106] xy [155] [0]\nPlace [coin] scene [-96] xy [1] [89]\nPlace [coin] scene [204] xy [208] [-71]\n\ndefine Place (costume name) scene (scene) xy (x) (y)\nset [my scene v] to (scene)\nset size to (40) %\nswitch costume to (costume name)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\nwhen I receive [reset game v]\ndelete this clone\n\n@False Wall\n\nwhen flag clicked\ngo to [back v] layer\nhide\nforever\n    if <(Scene #) = [105]> then\n        show\n    else\n        hide\n    end\nend\n\n@Safe Zones\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nset [ghost v] effect to (100)\n\nwhen I receive [change scene v]\ngo to x: (0) y: (0)\nswitch costume to (blank v)\nswitch costume to (join [Scene] (Scene #))\nif <<(Scene #) = [5]> or <<<(Scene #) = [101]> or <(Scene #) = [102]>> or <(Scene #) = [203]>>> then\n    forever\n        set y to ((5) * ([sin v] of ((timer) * (180)) ))\n    end\nend\n\ndefine Stamp Shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (90)\nchange y by (-15)\nchange x by (-7)\nstamp\nchange y by (15)\nchange x by (7)\nclear graphic effects\n\ndefine Stamp Outline\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\nrepeat (72)\n    move (2) steps\n    stamp\n    move (-2) steps\n    turn right (5) degrees\nend\nclear graphic effects\n\n@Coins\n\nwhen I receive [main menu v]\nhide\n\nwhen I receive [start game v]\nswitch costume to (coins0 v)\ngo to [front v] layer\ngo to x: (-204) y: (-163)\nshow\n\nwhen I receive [coin v]\nswitch costume to ((Coins) + (1))\n\nwhen I receive [change scene v]\nforever\n    if <touching (player v)?> then\n        set [ghost v] effect to (40)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nswitch costume to (coins3 v)\n\n@Lives\n\nwhen I receive [main menu v]\nhide\nwait (1) seconds\nif <(Lives) = [0]> then\n    repeat (1)\n        play sound [Lose v] until done\n    end\nend\n\nwhen I receive [start game v]\nswitch costume to (hearts3 v)\nshow\ngo to x: (-203) y: (-138)\nforever\n    if <(Lives) = [1]> then\n        switch costume to (hearts1 v)\n    end\n    if <(Lives) = [2]> then\n        switch costume to (hearts2 v)\n    end\n    if <(Lives) = [3]> then\n        switch costume to (hearts3 v)\n    end\nend\n\nwhen I receive [change scene v]\nforever\n    if <touching (player v)?> then\n        set [ghost v] effect to (40)\n    end\nend\n\nwhen I receive [change scene v]\nforever\n    if <not <touching (player v)?>> then\n        set [ghost v] effect to (0)\n    end\nend\n\n@Popout\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (pop v)\ngo to x: (174) y: (200)\nhide\nforever\n    wait (pick random (10) to (15)) seconds\n    show\n    repeat (10)\n        change y by (-4)\n    end\n    repeat (3)\n        change y by (3)\n    end\n    repeat (2)\n        change y by (-4.5)\n    end\n    wait (1) seconds\n    repeat until <(y position) > [190]>\n        change y by (4)\n    end\n    hide\nend\n\n@confetti\n\nwhen flag clicked\nset [clone? v] to [0]\nhide\n\nwhen I start as a clone\nset [clone? v] to [1]\ngo to [front v] layer\nshow\nswitch costume to (pick random (1) to (8))\ngo to x: (pick random (-230) to (230)) y: (-170)\nset [x vel v] to (pick random (-5) to (5))\nset [y vel v] to (pick random (6) to (10))\nrepeat until <touching (_edge_ v)?>\n    change x by (X vel)\n    change y by (Y vel)\n    change [y vel v] by (-.25)\n    set [x vel v] to ((X vel) * (.95))\nend\ndelete this clone\n\ndefine Clone\nrepeat (4)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [confetti v]\nif <(clone?) = [0]> then\n    repeat (15)\n        Clone\n    end\nend\n\nwhen I receive [win v]\nforever\n    broadcast (Confetti v)\n    wait (3) seconds\nend\n\n@Labels\n\nwhen flag clicked\nhide\nwait until <(Scene #) = [106]>\nshow\ngo to [front v] layer\nswitch costume to (secret room v)\nslide\n\ndefine go to (x) (y)\nset size to (1000) %\ngo to x: (x) y: (y)\nset size to (100) %\n\ndefine slide\nshow\ngo to [500] [0]\ndelete all of [move v]\nrepeat (25)\n    add (((0) - (x position)) / (5)) to [move v]\n    change x by (((0) - (x position)) / (5))\nend\nwait (0.05) seconds\nrepeat (25)\n    change x by (item (join [la] [st]) of [move v])\n    delete (join [la] [st]) of [move v]\nend\nhide\n\nwhen flag clicked\nshow\nhide\nwait (5) seconds\nwait until <(Scene #) = [205]>\ngo to [front v] layer\nswitch costume to (boss v)\nslide\n\nwhen flag clicked\nset [scene # v] to [1]\n\n@Instructions2\n\nwhen flag clicked\nhide\n\nwhen I receive [instructions v]\ngo to x: (0) y: (0)\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\n\nwhen I receive [back v]\nhide\n\n@Back\n\nwhen I receive [main menu v]\nwait (0.001) seconds\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nbroadcast (back v)\nplay sound [Wood Tap v] until done\nhide\nbroadcast (show v) and wait\n\nwhen I receive [instructions v]\nshow\ngo to [front v] layer\nset size to (10) %\ngo to x: (-215) y: (-155)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((70) - (size)))\n        switch costume to (play button3 v)\n    else\n        change size by ((0.2) * ((60) - (size)))\n        switch costume to (play button v)\n    end\n    change [speed v] by (5)\n    point in direction ((([sin v] of (SPEED) ) * (3)) + (90))\nend\n\nwhen I receive [start game v]\nhide\n\n@music\n\nshow\n\nwhen flag clicked\nswitch costume to ( on v)\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        wait until <not <mouse down?>>\n        if <(music) = [on]> then\n            set [music v] to [off]\n            switch costume to ( off v)\n        else\n            set [music v] to [on]\n            switch costume to ( on v)\n        end\n        play sound [Wood Tap2 v] until done\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    if <([costume # v] of [music v]) = [1]> then\n        set volume to (0) %\n    else\n        set volume to (100) %\n    end\nend\n\nwhen I receive [change scene v]\nforever\n    if <touching (player v)?> then\n        set [ghost v] effect to (40)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen I receive [begin v]\nshow\ngo to [front v] layer\ngo [backward v] (3) layers\nrepeat until <[0] = [1]>\n    play sound [Odesong v] until done\nend\n\nwhen flag clicked\nset size to (10) %\ngo to [front v] layer\ngo [backward v] (3) layers\ngo to x: (213) y: (-150)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((120) - (size)))\n        switch costume to (play button3 v)\n    else\n        change size by ((0.2) * ((100) - (size)))\n        switch costume to (play button v)\n    end\nend\n\n@Instructions\n\nwhen I receive [start screen v]\nwait (0.001) seconds\ngo to [front v] layer\nshow\nset size to (10) %\ngo to x: (60) y: (-70)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((150) - (size)))\n        switch costume to (play button3 v)\n    else\n        change size by ((0.2) * ((130) - (size)))\n        switch costume to (play button v)\n    end\n    change [speed v] by (5)\n    point in direction ((([sin v] of (SPEED) ) * (3)) + (90))\nend\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nplay sound [Wood Tap v] until done\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [start game v]\nhide\n\nwhen I receive [back v]\nshow\n\nwhen this sprite clicked\nbroadcast (Instructions v) and wait\n\n@Thumb\n\nwhen flag clicked\nhide\n\ngo to [front v] layer\ngo to x: (0) y: (0)\nshow\n\n@Trampoline\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if <not <(Scene #) = [-96]>> then\n        hide\n    end\n    if <(Scene #) = [-96]> then\n        go to x: (36) y: (28)\n        go to [back v] layer\n        show\n    end\n    if <touching (player v)?> then\n        broadcast (trampoline bounce v)\n        switch costume to (costume2 v)\n        wait (0.1) seconds\n        switch costume to (costume1 v)\n    end\nend\n\ngo to [front v] layer\n\nwhen I receive [main menu v]\nhide\n\nwhen flag clicked\nforever\n    if <touching (player v)?> then\n        play sound [boing v] until done\n    end\nend\n\n@Intro\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nset size to (1450) %\nswitch costume to (pfp v)\nforever\n    change size by ((0.1) * ((300) - (size)))\nend\n\nwhen flag clicked\nwait (2) seconds\ncreate clone of (_myself_ v)\nrepeat (14)\n    change y by (2)\nend\nwait (.8) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nbroadcast (Begin v)\n\nwhen I start as a clone\nhide\nset size to (120) %\nswitch costume to (text v)\ngo to x: (0) y: (-206)\nshow\nrepeat (14)\n    change y by (10)\nend\nwait (.8) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen flag clicked\nplay sound [Low Whoosh v] until done\nwait (1.3) seconds\nplay sound [High Whoosh v] until done\nwait (1) seconds\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nwait (3.7) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n