Cat Platformer

Instructions: ARROWS TO MOVE OR\nMOVE THE JOYSTICK\nCOLLECT STARS\nKILL ENIMIES BY JUMPING ON THEM\nAVOID EMPTY SPACES!\nBEST OF LUCK!

@Stage\n\nwhen flag clicked\nhide variable [easter eggs v]\nforever\n    play sound [Drum Funky 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 (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) * (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)\n\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 [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 [14]\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\nwhen flag clicked\nset [lives v] to [10]\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nerase all\nswitch costume to (join [Scene] (Scene #))\nStamp Outline\nStamp Shadow\n\nwhen flag clicked\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    stamp\n    move (3) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\n@Danger\n\nwhen flag clicked\ngo to [back v] layer\ngo to x: (0) y: (0)\n\nwhen I receive [change scene v]\nswitch costume to (empty 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]) = [star]> then\n    start sound [Collect v]\n    change [stars v] by (1)\nelse\n    if <(costume [name v]) = [live]> then\n        start sound [Collect v]\n        change [lives v] by (1)\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 [stars v] to [0]\nset [frame v] to [0]\nset [easter eggs v] to [0 / 3]\nhide\nset [ee-count v] to [0]\nPlace Collectable [star] At Scene [6] X [-7] Y [124]\nPlace Collectable [star] At Scene [6] X [-76] Y [124]\nPlace Collectable [star] At Scene [115] X [-20] Y [0]\nPlace Collectable [star] At Scene [115] X [40] Y [0]\nPlace Collectable [star] At Scene [15] X [-92] Y [40]\nPlace Collectable [live] At Scene [-1] X [-140] Y [50]\nPlace Collectable [star] At Scene [107] X [146] Y [-60]\nPlace Collectable [star] At Scene [8] X [200] Y [0]\nPlace Collectable [star] At Scene [13] X [100] Y [-60]\nPlace Collectable [apple] At Scene [1] X [200] Y [80]\nPlace Collectable [star] At Scene [1] X [130] Y [80]\nPlace Collectable [star] At Scene [2] X [-176] Y [-70]\nPlace Collectable [checkpoint] At Scene [8] X [-34] Y [-50]\nPlace Collectable [star] At Scene [104] X [-10] Y [-40]\nPlace Collectable [checkpoint] At Scene [4] X [114] Y [100]\nPlace Collectable [star] At Scene [9] X [-18] Y [-68]\nPlace Collectable [checkpoint] At Scene [201] X [86] Y [63]\nPlace Collectable [star] At Scene [115] X [-140] Y [0]\nPlace Collectable [star] At Scene [115] X [-80] Y [0]\nPlace Collectable [star] At Scene [2] X [154] Y [-34]\nPlace Collectable [v] At Scene [103] X [214] Y [46]\nPlace Collectable [star] At Scene [104] X [50] Y [-40]\nPlace Collectable [star] At Scene [101] X [165] Y [12]\nPlace Collectable [star] At Scene [101] X [220] Y [12]\nPlace Collectable [star] At Scene [102] X [128] Y [-37]\nPlace Collectable [star] At Scene [5] X [-20] Y [-20]\nPlace Collectable [star] At Scene [5] X [40] Y [-20]\nPlace Collectable [star] 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 [star] At Scene [7] X [0] Y [36]\nPlace Collectable [star] At Scene [9] X [80] Y [-68]\nPlace Collectable [star] At Scene [10] X [188] Y [50]\nPlace Collectable [star] At Scene [11] X [100] Y [-70]\nPlace Collectable [star] At Scene [11] X [-200] Y [-70]\nPlace Collectable [star] At Scene [10] X [70] Y [16]\nPlace Collectable [star] 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 [star] At Scene [114] X [122] Y [0]\nPlace Collectable [star] At Scene [114] X [182] Y [0]\nPlace Collectable [apple] At Scene [11] X [38] Y [-70]\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\nwhen flag clicked\nforever\n    switch costume to (star v)\nend\n\n@SAFE\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@PLAY BUTTON\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: (-80)\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@ENTITLES\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 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@EMOTICONS\n\nwhen flag clicked\ngo to [front v] layer\n\n@Joystick\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo to x: (157) y: (-97)\nset size to (100) %\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@START 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