Scratch Cat Platformer Version 1
@Stage\n\nwhen flag clicked\nhide variable [easter eggs v]\nforever\n    play sound [griffpatch outro music v] until done\nend\n\nwhen flag clicked\nif <<(username) = [griffpatch]> or <(username) = [griffpatch_tutor]>> then\n    change [☁ griffpatch v] by (1)\nelse\n    if <not <(username) = [Scratch-remind]>> then\n        set [☁ scratcher v] to [1]\n    end\nend\n\n@Cat\n\nwhen flag clicked\nclear graphic effects\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 & door 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 y) ) + ([abs v] of (speed x) ))\nSet Costume\nEffects\n\ndefine Controls - Up and Down\nif <<key (up arrow v) pressed?> or <(Stick Y) > [0.5]>> then\n    if <<(Wall slide) > [0]> and <(jumping) = [0]>> then\n        start sound [Jump v]\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 [12]\n    end\n    if <<(falling) < [3]> and <(jumping) = [0]>> then\n        start sound [Jump v]\n        set [jumping v] to [1]\n        set [falling v] to [3]\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) * (0.6))\n    end\nend\n\ndefine Controls - Left and Right\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 <(Stick X) > [0.5]>> - <<key (left arrow v) pressed?> or <(Stick X) < [-0.5]>>)\nif <(Key x) = [0]> then\n    if <<(falling) > [2]> and <(Wall slide) < [1]>> then\n        set [speed x v] to ((speed x) * (0.96))\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 [wall slide 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\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 [jumping v] to [0]\nset [wall slide v] to [0]\nset [long jump v] to [0]\npoint in direction (90)\nBegin Scene # (Spawn Scene) go to x & y (Spawn y) (Spawn x)\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) < [-180]> then\n    Begin Scene # ((Scene #) + (-100)) go to x & y [] [160]\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)\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 (140)\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 (scratch-remind 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) * (0.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]\nstop [other scripts in sprite v]\nstart sound [Meow v]\nrepeat (10)\n    change [ghost v] effect by (10)\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 [16]\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 size to (60) %\nset [lives v] to [9]\nset [jump duration v] to [6]\nset [resistance v] to [0.8]\nset [acceleration v] to [2]\nset [jump force v] to [13]\nset [gravity v] to [-1.5]\nbroadcast (Reset Game v) and wait\nbroadcast (Setup v) and wait\nset [spawn x v] to [50]\nset [spawn y v] to [-150]\nset [spawn scene v] to [1]\nReset and begin level\n\nwhen I receive [player - bounce v]\nset [speed y v] to [10]\n\ndefine Effects\nif <(Easter eggs) = [3/3]> then\n    change [color v] effect by (2)\nend\n\n@Level\n\nwhen I receive [change scene v]\nerase all\nswitch costume to (join [Scene] (Scene #))\nStamp Outline\nStamp Shadow\n\nwhen flag clicked\ngo to [back v] layer\ngo to x: (0) y: (0)\nerase all\nStamp Outline\nStamp Shadow\n\ndefine Stamp Shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (70)\nchange y by (-10)\nstamp\nclear graphic effects\nchange y by (10)\n\ndefine Stamp Outline\nrepeat (8)\n    set rotation style [don't rotate v]\n    set [brightness v] effect to (-100)\n    move (-3) steps\n    create clone of (_myself_ v)\n    stamp\n    move (3) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\nwhen I receive [about to change scene v]\ndelete this clone\n\n@Danger\n\nwhen flag clicked\nrepeat (10)\n    go to [back v] layer\n    go to x: (0) y: (0)\nend\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (Scene #))\nif <<(Scene #) = [4]> or <<(Scene #) = [5]> or <(Scene #) = [7]>>> then\n    forever\n        set y to ((3) * ([sin v] of ((timer) * (180)) ))\n    end\nelse\n    go to x: (0) y: (0)\nend\n\n@Collectable\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 (cat 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]) = [apple]> then\n    start sound [Chomp v]\n    change [apples v] by (1)\nelse\n    if <(costume [name v]) = [live]> then\n        start sound [Collect v]\n        change [lives v] by (1)\n    else\n        if <(costume [name v]) = [big apple]> then\n            start sound [Tada v]\n        else\n            if <(costume [name v]) = [checkpoint]> then\n                start sound [Checkpoint v]\n                set [spawn scene v] to (Scene #)\n                set [spawn x v] to ([x position v] of [cat v])\n                set [spawn y v] to ([y position v] of [cat v])\n            else\n                if <(costume [name v]) = [easter egg]> then\n                    change [ee-count v] by (1)\n                    set [easter eggs v] to (join (ee-count) (join [/] [3]))\n                    if <(ee-count) = [1]> then\n                        broadcast (Easter Egg v)\n                    end\n                    start sound [Collect v]\n                else\n                    start sound [Wand v]\n                    add (costume [name v]) to [collected v]\n                end\n            end\n        end\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 [apples v] to [0]\nset [frame v] to [0]\nset [easter eggs v] to [0/3]\nhide\nset [ee-count v] to [0]\nPlace Collectable [apple] At Scene [1] X [200] Y [80]\nPlace Collectable [apple] At Scene [1] X [130] Y [80]\nPlace Collectable [apple] At Scene [2] X [-176] Y [-70]\nPlace Collectable [apple] At Scene [2] X [154] Y [-34]\nPlace Collectable [apple] At Scene [103] X [214] Y [46]\nPlace Collectable [apple] At Scene [104] X [-10] Y [-40]\nPlace Collectable [apple] At Scene [104] X [50] Y [-40]\nPlace Collectable [apple] At Scene [101] X [165] Y [12]\nPlace Collectable [apple] At Scene [101] X [220] Y [12]\nPlace Collectable [apple] At Scene [102] X [128] Y [-37]\nPlace Collectable [apple] At Scene [5] X [-20] Y [-20]\nPlace Collectable [apple] At Scene [5] X [40] Y [-20]\nPlace Collectable [apple] At Scene [5] X [100] Y [-20]\nPlace Collectable [key 1] At Scene [103] X [200] Y [-100]\nPlace Collectable [key 2] At Scene [107] X [-110] Y [34]\nPlace Collectable [apple] At Scene [7] X [0] Y [36]\nPlace Collectable [apple] At Scene [6] X [-7] Y [124]\nPlace Collectable [apple] At Scene [6] X [-76] Y [124]\nPlace Collectable [checkpoint] At Scene [8] X [-34] Y [-50]\nPlace Collectable [checkpoint] At Scene [4] X [114] Y [100]\nPlace Collectable [apple] At Scene [9] X [-18] Y [-68]\nPlace Collectable [apple] At Scene [9] X [80] Y [-68]\nPlace Collectable [apple] At Scene [10] X [188] Y [50]\nPlace Collectable [apple] At Scene [11] X [38] Y [-70]\nPlace Collectable [apple] At Scene [11] X [100] Y [-70]\nPlace Collectable [apple] At Scene [11] X [-200] Y [-70]\nPlace Collectable [apple] At Scene [12] X [70] Y [16]\nPlace Collectable [apple] At Scene [12] X [130] Y [16]\nPlace Collectable [live] At Scene [103] X [-196] Y [-130]\nPlace Collectable [live] At Scene [10] X [176] Y [-80]\nPlace Collectable [live] At Scene [201] X [-70] Y [104]\nPlace Collectable [checkpoint] At Scene [14] X [-120] Y [-50]\nPlace Collectable [live] At Scene [114] X [-160] Y [-55]\nPlace Collectable [apple] At Scene [114] X [122] Y [0]\nPlace Collectable [apple] At Scene [114] X [182] Y [0]\nPlace Collectable [checkpoint] At Scene [201] X [86] Y [63]\nPlace Collectable [apple] At Scene [115] X [-140] Y [0]\nPlace Collectable [apple] At Scene [115] X [-80] Y [0]\nPlace Collectable [apple] At Scene [115] X [-20] Y [0]\nPlace Collectable [apple] At Scene [115] X [40] Y [0]\nPlace Collectable [big apple] At Scene [15] X [-92] Y [40]\nPlace Collectable [live] At Scene [-1] X [-140] Y [50]\nPlace Collectable [easter egg] At Scene [107] X [146] Y [-60]\nPlace Collectable [easter egg] At Scene [8] X [200] Y [0]\nPlace Collectable [easter egg] At Scene [13] X [100] Y [-60]\n\ndefine Place Collectable (costume name) At Scene (scene) X (x) Y (y)\nset [my scene v] to (scene)\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@Splash Screen\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (main menu v)\ngo to [front v] layer\nshow\n\nwhen I receive [game over v]\ngo to x: (0) y: (0)\nswitch costume to (game over v)\ngo to [front v] layer\nshow\nbroadcast (Main Menu v)\n\nwhen I receive [start game v]\nhide\n\n@Main Menu\n\nwhen I receive [main menu v]\nwait (0.1) seconds\ngo to [front v] layer\nshow\nset size to (10) %\ngo to x: (0) y: (-10)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((100) - (size)))\n    else\n        change size by ((0.2) * ((90) - (size)))\n    end\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        hide\n        broadcast (Start Game v)\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nhide\n\n@Enemies\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [change scene v]\nif <(Scene #) = [4]> then\n    if <([x position v] of [cat v]) < [0]> then\n        Spawn [red] At [160] [-54] Direction [-90]\n    else\n        Spawn [red] At [16] [-54] Direction [90]\n    end\nend\nif <(Scene #) = [201]> then\n    Spawn [red] At [-70] [-20] Direction [90]\nend\nif <(Scene #) = [12]> then\n    Spawn [red] At [180] [14] Direction [-90]\nend\nif <(Scene #) = [15]> then\n    Spawn [red] At [20] [-40] Direction [-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 (1 v)\n    set rotation style [don't rotate v]\n    Move - Left and 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 (cat 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 and Right\nmove (2) steps\nrepeat (4)\n    if <not <<touching (level v)?> or <<touching (_edge_ v)?> or <<touching (safe zones v)?> or <touching (platform & door v)?>>>>> then\n        stop [this script v]\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 [cat v]) < [-3]> then\n    switch costume to (5 v)\n    broadcast (Player - Bounce v)\n    start sound [Squash v]\n    wait (0.1) 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) Direction (dir)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\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]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (Scene #))\n\n@Joystick\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo to x: (139) y: (-82)\nset size to (150) %\nset [base v] to [Joystick]\nset [max stick v] to ((size) / (4))\nswitch costume to (base v)\nset [ghost v] effect to (60)\n\nwhen I start as a clone\nswitch costume to (stick v)\nset [ghost v] effect to (25)\ngo [forward v] (1) layers\nforever\n    set [stick x v] to [0]\n    set [stick y v] to [0]\n    set [stick power v] to []\n    repeat until <mouse down?>\n        go to (Base)\n    end\n    if <(distance to [mouse-pointer v]) < ((size) * (0.6))> then\n        Drag Stick\n    else\n        wait until <not <mouse down?>>\n    end\nend\n\ndefine Drag Stick\nrepeat until <not <mouse down?>>\n    go to (mouse-pointer v)\n    point towards (Base)\n    turn right (180) degrees\n    set [stick direction v] to (direction)\n    set [stick power v] to (distance to [(Base) v])\n    if <(Stick Power) > (max stick)> then\n        move ((max stick) - (Stick Power)) steps\n        set [stick power v] to (max stick)\n    end\n    set [stick power v] to ((Stick Power) / (max stick))\n    set [stick x v] to ((Stick Power) * ([sin v] of (Stick Direction) ))\n    set [stick y v] to ((Stick Power) * ([cos v] of (Stick Direction) ))\nend\n\nwhen I receive [start game v]\nshow\ncreate clone of (_myself_ v)\n\n@Easter eggs\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\nwhen I start as a clone\nshow\ngo [forward v] (1000) layers\nforever\n    Switch Costume To (letter (Index) of (Easter eggs))\n    change size by ((0.2) * ((40) - (size)))\nend\n\ndefine Setup\ngo to x: (-132) y: (48)\nset [index v] to [1]\nrepeat (10)\n    create clone of (_myself_ v)\n    change x by (17)\n    change [index v] by (1)\nend\n\ndefine Switch Costume To (costume)\nif <not <(costume) = (costume [name v])>> then\n    switch costume to (costume)\n    set size to (50) %\nend\n\nwhen I receive [easter egg v]\ngo to [front v] layer\nSetup\n\n@Apples\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\nwhen I start as a clone\nshow\ngo [forward v] (1000) layers\nforever\n    Switch Costume To (letter (Index) of (Apples))\n    change size by ((0.2) * ((60) - (size)))\nend\n\ndefine Setup\ngo to x: (0) y: (115)\nset [index v] to [1]\nrepeat (10)\n    create clone of (_myself_ v)\n    change x by (30)\n    change [index v] by (1)\nend\n\ndefine Switch Costume To (costume)\nif <not <(costume) = (costume [name v])>> then\n    switch costume to (costume)\n    set size to (70) %\nend\n\nwhen I receive [start game v]\ngo to [front v] layer\nSetup\n\n@LIves\n\nwhen flag clicked\nset size to (80) %\ngo to x: (-150) y: (136)\nswitch costume to (5 v)\nhide\n\nwhen I receive [start game v]\ngo [forward v] (4) layers\nshow\nforever\n    switch costume to (0 v)\n    switch costume to (Lives)\nend\n\n@Easter Eggs\n\nwhen flag clicked\nset size to (70) %\ngo to x: (-210) y: (48)\nhide\n\nwhen I receive [easter egg v]\ngo [forward v] (4) layers\nshow\nforever\n    switch costume to (0 v)\n    switch costume to (Easter eggs)\n    if <(Easter eggs) = [3]> then\n        change [color v] effect by (2)\n    end\nend\n\n@Platform & Door\n\ndefine Tick (new x) (new y)\nif <(turn) > []> then\n    change y by (4)\n    if <touching (cat v)?> then\n        Rotation Math 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 (cat 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 Animate platform 2\nswitch costume to (platform 1 v)\ngo to x: (-25) y: (-82)\nforever\n    glide (2) secs to x: (125) y: (-82)\n    wait (1) seconds\n    glide (2) secs to x: (-25) y: (-82)\n    wait (1) seconds\nend\n\ndefine Rotation Math CCW (ccw)\nset [dx v] to (([x position v] of [cat v]) - (x position))\nset [dy v] to (([y position v] of [cat 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\ndefine Animate platform 3\nswitch costume to (platform 1 v)\ngo to x: (105) y: (-80)\nforever\n    glide (2) secs to x: (105) y: (17)\n    wait (1) seconds\n    glide (2) secs to x: (105) y: (-80)\n    wait (1) seconds\nend\n\ndefine Animate platform 1\nswitch costume to (platform 1 v)\ngo to x: (0) y: (-88)\nforever\n    glide (2) secs to x: (0) y: (0)\n    wait (1) seconds\n    glide (2) secs to x: (0) y: (-88)\n    wait (1) seconds\nend\n\ndefine Spawn (type) At (x) (y) Direction (dir) Turn (degrees)\nset [turn v] to (degrees)\ngo to x: (x) y: (y)\npoint in direction (dir)\nswitch costume to (type)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\ngo to [back v] layer\nset rotation style [left-right v]\nhide\n\nwhen I receive [about to change scene v]\ndelete this clone\n\nwhen I start as a clone\nif < (costume [name v]) contains [key]?> then\n    Door at (x position) (y position) Key (costume [name v])\nend\nif <(turn) > []> then\n    show\n    set rotation style [all around v]\n    forever\n        turn right (turn) degrees\n    end\nend\nAnimate platform 4\n\ndefine Animate platform 4\nshow\npoint in direction (90)\nforever\n    glide (1.5) secs to x: (x position) y: ((y position) - (90))\n    glide (1.5) secs to x: (x position) y: ((y position) + (90))\nend\n\nwhen I receive [change scene v]\nhide\nif <(Scene #) = [1]> then\n    show\n    Animate platform 1\nend\nif <(Scene #) = [5]> then\n    show\n    Animate platform 2\nend\nif <(Scene #) = [5]> then\n    show\n    Animate platform 2\nend\nif <(Scene #) = [3]> then\n    show\n    Animate platform 3\nend\nif <(Scene #) = [8]> then\n    Spawn [key 1] At [70] [-72] Direction [90] Turn []\nend\nif <(Scene #) = [12]> then\n    Spawn [key 2] At [-134] [-64] Direction [90] Turn []\nend\nif <(Scene #) = [204]> then\n    Spawn [platform 2] At [-120] [-40] Direction [100] Turn [1]\n    Spawn [platform 2] At [0] [-40] Direction [100] Turn [1]\nend\nif <(Scene #) = [0]> then\n    Spawn [platform 3] At [0] [-20] Direction [0] Turn [2]\nend\nif <(Scene #) = [-1]> then\n    Spawn [platform 4] At [80] [-30] Direction [0] Turn [1]\nend\nif <(Scene #) = [203]> then\n    Spawn [platform 5] At [18] [20] Direction [0] Turn [1]\nend\ngo to [back v] layer\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 Door at (x) (y) Key (key name)\ngo to [back v] layer\nshow\nswitch costume to (key name)\ngo to x: (x) y: (y)\nforever\n    wait until <touching (cat v)?>\n    if <[collected v] contains (key name)?> then\n        start sound [Opening / Closing v]\n        repeat (24)\n            change y by (4)\n        end\n        wait (1) seconds\n        start sound [Opening / Closing v]\n        repeat (24)\n            change y by (-4)\n        end\n        start sound [Hit Ground v]\n    else\n        start sound [Locked v]\n    end\n    wait until <not <touching (cat v)?>>\nend\n\n
Check out my friend's awesome project! https://scratch.mit.edu/projects/760801889\n---------------------------------------------------------------\nHello, welcome to my platformer!\nMobile friendly :)\nCan you find the Easter eggs? :D\nVersion 2: https://scratch.mit.edu/projects/666607298\n\nInstructions:\nUse arrow keys or the joystick to move\nDon't touch spikes, lava or enemies\nHold up arrow to jump higher\nDon't stand under a platform or a door\nCollect keys to open doors