Scrolling Cat / v5.7 / A Platformer 

Instructions: Hello scratchers.....I've done a tutorial by Griffpatch. This project is in Griffpatch's "make a classic platformer ep 13"studio. whoah! 1000 views!,50 loves! Thank you, guys! Part 2 comes soon!\n        (double click the green flag)\n==========CONTROLS=========\n[Arrow keys - movement or mobile friendly!]\n [Avoid spikes & lava]\n [Collect apples on your way]\n [Jump on enemies to defeat them]\n [Collect Keys to open Doors]\n [Collect BIG fruits on your way]               \n [Press inventory button to open & close inventory ]\n [Don't lose lives on your way (5 lives)]    

@Stage\n\n@nothing\n\n@player\n\nwhen flag clicked\nbroadcast (main menu v)\nhide variable [apples v]\nhide variable [scene # v]\nhide\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 Solids\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 Solids\n    if <(touching) > [0]> then\n        Collide Y- ceiling or floor\n    end\nend\n\ndefine Check Touching Solids\nif <<touching (level v)?> or <touching (platform v)?>> then\n    set [touching v] to [1]\n    stop [this script v]\nend\nset [touching v] to [0]\nset [hit costume v] to (costume [name v])\nif <(hit costume) = [hitbox v2]> then\n    switch costume to (hitbox feet v)\nend\nif <touching (jump through platform v)?> then\n    if <(jump through p) < [1]> then\n        change y by (-6)\n        if <(hit costume) = [hitbox v2]> then\n            switch costume to (hitbox feet2 v)\n        end\n        if <touching (jump through platform v)?> then\n            set [touching v] to [1]\n        else\n            set [jump through p v] to [1]\n        end\n        change y by (6)\n    end\nelse\n    set [jump through p v] to [0]\nend\nswitch costume to (hit costume)\n\nwhen I receive [tick-player v]\nmoved by moving platform\nswitch backdrop to <touching (level v)?>\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 <<mouse down?> and <(mouse y) > (y position)>>> 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 <<mouse down?> and <(x position) < (mouse x)>>> - <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>)\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 [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 [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) < [-180]> 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 (CHANGE SCENE v)\nbroadcast (about to 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 (192)\n    Check Touching Solids\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 Solids\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 Solids\nif <(touching) > [0]> then\n    change y by (1)\n    Check Touching Solids\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 Solids\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 Solids\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 Solids\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 [Pew v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (0.1) seconds\nchange [lives v] by (-1)\nReset and Begin level\nif <(lives) > [0]> then\n    Reset and Begin level\nelse\n    broadcast (game over v)\nend\n\nfix collision in direction [90]\n\nwhen I receive [start game v]\nshow\nset [gravity v] to [-1.5]\nset [jump force v] to [14]\nset [jump duration v] to [6]\nset [acceleration v] to [1.5]\nset [resistance v] to [0.8]\nbroadcast (reset game v) and wait\nbroadcast (setup v) and wait\nset [spawn scene v] to [1]\nset [spawn x v] to [-170]\nset [spawn y v] to [73]\nReset and Begin level\n\nwhen flag clicked\ngo to [back v] layer\n\nwhen I receive [start game v]\nshow variable [apples v]\nshow variable [scene # v]\n\nwhen I receive [player-bounce v]\nset [speed y v] to [14]\n\ndefine moved by moving platform\nchange x by (PLATFORM DX)\nchange y by (PLATFORM DY)\nCheck Touching Solids\nif <(touching) > [0]> then\n    Find closest space to (x position) (y position) [16]\n    if <(touching) > [0]> then\n        broadcast (lose life v)\n    end\nend\n\ndefine Find closest space to (x) (y) (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 Solids\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\n@level\n\ndefine stamp out line\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\nrepeat (8)\n    move (3) steps\n    stamp\n    move (-3) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\ndefine stamp shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (90)\nchange y by (-20)\nstamp\nchange y by (20)\nclear graphic effects\n\nwhen flag clicked\nshow\nforever\n    set size to (100) %\n    go to x: (0) y: (0)\n    stop [this script v]\nend\n\nwhen I receive [change scene v]\nerase all\nswitch costume to (join [scene] (scene #))\nset size to (100) %\nstamp out line\nstamp shadow\n\nwhen I receive [start game v]\nerase all\nstamp out line\nstamp shadow\n\nwhen I receive [about to change scene v]\n\n@jump through platform\n\ndefine stamp out line\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\nrepeat (8)\n    move (3) steps\n    stamp\n    move (-3) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\ndefine stamp shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (90)\nchange y by (-10)\nstamp\nchange y by (10)\nclear graphic effects\n\nwhen flag clicked\nshow\nforever\n    set size to (100) %\n    go to x: (0) y: (0)\n    stop [this script v]\nend\n\nset [scene # v] to [23]\n\nwhen I receive [start game v]\nerase all\nstamp out line\nstamp shadow\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [scene] (scene #))\nstamp out line\nstamp shadow\ngo to [back v] layer\n\n@danger\n\nwhen flag clicked\nset size to (110) %\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [scene] (scene #))\nif <(scene #) = [7]> then\n    repeat until <(scene #) = [8]>\n        set y to ((3) * ([sin v] of ((timer) * (250)) ))\n    end\nend\n\n@lives\n\nwhen flag clicked\nhide\nforever\n\nwhen I receive [lose life v]\nswitch costume to (lives)\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    if <touching (player v)?> then\n        set [ghost v] effect to (90)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen I receive [start game v]\nshow\nset size to (80) %\ngo to x: (-99) y: (84)\nswitch costume to (5lives v)\nset [lives v] to [5]\n\nwhen I receive [1 life v]\nswitch costume to (lives)\n\n@screens\n\nwhen flag clicked\ngo [forward v] (10000000000000000000000000000000000000000000) layers\nset [ghost v] effect to (0)\nswitch costume to (main menu v)\nshow\ngo to x: (0) y: (0)\n\nwhen I receive [game over v]\ngo to [front v] layer\ngo [forward v] (10000000000000000000000000000000000000000000) layers\nset [ghost v] effect to (100)\nswitch costume to (costume1 v)\nshow\ngo to x: (0) y: (371)\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\nglide (1) secs to x: (0) y: (0)\nbroadcast (main menu v)\n\nwhen I receive [start game v]\ngo to [front v] layer\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nhide\n\nforever\n\ngo to [front v] layer\n\ndefine Find closest space to (x) (y) (max)\n\n@platform\n\nwhen I receive [change scene v]\nhide\nif <(scene #) = [6]> then\n    spawn [key 1] at [98] [-7] dir [90] turn []\n    go to [back v] layer\nend\nif <(scene #) = [18]> then\n    spawn [key 2] at [34] [-12] dir [90] turn []\n    go to [back v] layer\nend\nif <(scene #) = [120]> then\n    spawn [key 3] at [61] [-51] dir [90] turn []\n    go to [front v] layer\nend\nif <(scene #) = [0]> then\n    spawn [square] at [66] [-20] dir [90] turn [1]\n    spawn [costume1] at [-64] [-22] dir [90] turn [1]\nend\nif <(scene #) = [3]> then\n    spawn [square] at [23] [14] dir [90] turn [-1]\nend\nif <(scene #) = [5]> then\n    spawn [costume1] at [-64] [105] dir [90] turn [1]\nend\nif <(scene #) = [13]> then\n    spawn [square2] at [0] [31] dir [90] turn [1]\nend\nif <(scene #) = [15]> then\n    spawn [costume3] at [-107] [28] dir [90] turn [1]\n    spawn [costume3] at [94] [28] dir [90] turn [1]\nend\nif <(scene #) = [18]> then\n    spawn [square] at [69] [49] dir [90] turn [1]\nend\n\ndefine animate platform\nswitch costume to (costume1 v)\npoint in direction (90)\ngo to x: (62) y: (-19)\nforever\n    glide (0.5) secs to x: (62) y: (61)\n    wait (1) seconds\n    glide (1) secs to x: (62) y: (-19)\n    start sound [Crunch v]\n    wait (1) seconds\nend\n\ngo to x: (102) y: (-70)\nforever\n    glide (2) secs to x: (102) y: (16)\n    wait (1) seconds\n    glide (2) secs to x: (102) y: (-70)\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 animete platform 2\nshow\npoint in direction (90)\nforever\n    glide (1.5) secs to x: (x position) y: ((y position) - (90))\n    wait (0) seconds\n    glide (1) secs to x: (x position) y: ((y position) + (90))\n    wait (0) seconds\nend\n\ndefine door at (x) (y) key (key name)\nshow\nswitch costume to (key name)\npoint in direction (90)\ngo to x: (x) y: (y)\nforever\n    wait until <touching (player v)?>\n    if <[collected v] contains (key name)?> then\n        start sound [Buzz Whir v]\n        repeat (24)\n            change y by (4)\n        end\n        wait (1) seconds\n        start sound [Buzz Whir 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\nset [speed v] to [2]\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)\ngo to x: (x) y: (y)\npoint in direction (dir)\nswitch costume to (type)\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 (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\nanimete platform 2\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\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 (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]) = [apple]> then\n    start sound [Chomp v]\n    change [apples v] by (1)\nelse\n    if <(costume [name v]) = [flag]> then\n        start sound [checkpoint 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        if <(costume [name v]) = [life]> then\n            start sound [checkpoint v]\n            change [lives v] by (1)\n            broadcast (1 life v)\n        else\n            start sound [Collect v]\n            add (costume [name v]) to [collected v]\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]\nshow list [collected v]\ndelete all of [collected v]\nset [frame v] to [0]\nset [apples v] to [0]\nhide\nplace [life] scene [0] xy [-141] [-49]\nplace [apple] scene [1] xy [130] [7]\nplace [apple] scene [1] xy [-52] [69]\nplace [apple] scene [2] xy [6] [-99]\nplace [apple] scene [101] xy [-182] [-130]\nplace [apple] scene [101] xy [-182] [-82]\nplace [apple] scene [101] xy [-182] [-35]\nplace [apple] scene [101] xy [-182] [3]\nplace [apple] scene [101] xy [-182] [56]\nplace [apple] scene [101] xy [-137] [56]\nplace [apple] scene [101] xy [-84] [56]\nplace [apple] scene [101] xy [-31] [56]\nplace [apple] scene [101] xy [18] [56]\nplace [apple] scene [101] xy [85] [56]\nplace [apple] scene [101] xy [126] [56]\nplace [apple] scene [101] xy [172] [56]\nplace [apple] scene [103] xy [87] [-36]\nplace [key 1] scene [104] xy [113] [30]\nplace [apple BIG] scene [111] xy [-154] [-67]\nplace [apple] scene [203] xy [87] [-20]\nplace [apple] scene [402] xy [7] [-31]\nplace [apple] scene [402] xy [-138] [-33]\nplace [apple] scene [402] xy [-179] [101]\nplace [apple] scene [402] xy [-55] [34]\nplace [apple] scene [402] xy [168] [-33]\nplace [apple] scene [402] xy [-168] [-125]\nplace [apple] scene [402] xy [-72] [-162]\nplace [apple] scene [302] xy [-180] [-37]\nplace [apple] scene [302] xy [-140] [27]\nplace [apple] scene [302] xy [-38] [121]\nplace [apple] scene [302] xy [102] [56]\nplace [apple] scene [302] xy [102] [17]\nplace [apple] scene [302] xy [102] [-25]\nplace [apple] scene [302] xy [102] [-77]\nplace [apple] scene [302] xy [102] [-116]\nplace [apple] scene [403] xy [-198] [-147]\nplace [apple] scene [403] xy [-143] [-147]\nplace [apple] scene [403] xy [-84] [-147]\nplace [apple] scene [403] xy [-30] [-147]\nplace [apple] scene [403] xy [15] [-147]\nplace [apple] scene [403] xy [67] [-147]\nplace [apple] scene [403] xy [134] [-147]\nplace [apple] scene [403] xy [196] [-147]\nplace [apple] scene [13] xy [160] [-34]\nplace [LEMON] scene [14] xy [5] [38]\nplace [key 2] scene [118] xy [61] [-22]\nplace [flag] scene [3] xy [65] [-106]\nplace [flag] scene [404] xy [194] [-1]\nplace [flag] scene [111] xy [-32] [-71]\nplace [BANANA] scene [120] xy [93] [-22]\nplace [key 3] scene [120] xy [93] [-85]\nplace [STRAWBERRY] scene [23] xy [-20] [55]\nplace [WATERMELON] scene [23] xy [87] [41]\nplace [ORANGE] scene [23] xy [29] [-40]\n\ndefine place (costume name) scene (scene) xy (x) (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 [setup 2 v]\nforever\n    if <([costume name v] of [inventory button v]) = [open]> then\n        hide list [collected v]\n    end\n    if <([costume name v] of [inventory button v]) = [close]> then\n        show list [collected v]\n    end\nend\n\nwhen flag clicked\nforever\n    broadcast (SETUP 2 v)\nend\n\nwhen I receive [reset game v]\ndelete this clone\n\n@Sprite1\n\nwhen I receive [start game v]\nshow variable [lives v]\nshow variable [scene # v]\nshow variable [apples v]\nshow\n\nwhen I receive [main menu v]\nhide variable [lives v]\nhide variable [scene # v]\nhide variable [apples v]\nhide\n\nwhen flag clicked\nhide variable [lives v]\nforever\n    go to [front v] layer\n    go to x: (-189) y: (37)\n    set [ghost v] effect to (0)\nend\n\n@inventory button\n\nwhen flag clicked\ndelete all of [collected v]\nset size to (70) %\nset [ghost v] effect to (0)\nswitch costume to (close v)\ngo to x: (129) y: (160)\nforever\nend\n\nwhen I receive [main menu v]\nhide\nrepeat until <(lives) = [0]>\n    go to [front v] layer\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((80) - (size)))\n        if <mouse down?> then\n            wait (0.3) seconds\n            next costume\n        end\n    else\n        change size by ((0.2) * ((70) - (size)))\n    end\nend\n\nwhen I receive [start game v]\nshow\n\n@play\n\nwhen flag clicked\nset [ghost v] effect to (100)\nhide\nwait (0.2) seconds\nswitch costume to (costume2 v)\n\nwhen I receive [main menu v]\nwait (0.1) seconds\nswitch costume to (costume3 v)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nset size to (10) %\ngo to [front v] layer\nshow\ngo to x: (-133) y: (-118)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((70) - (size)))\n    else\n        change size by ((0.2) * ((60) - (size)))\n    end\nend\n\nwhen this sprite clicked\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nbroadcast (start game v)\n\n@play2\n\nwhen flag clicked\nset [ghost v] effect to (100)\nhide\n\nwhen this sprite clicked\nbroadcast (instructions v)\n\nwhen flag clicked\nwait (0.1) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nset size to (10) %\ngo to [front v] layer\nshow\ngo to x: (80) y: (-117)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by ((0.2) * ((60) - (size)))\n    else\n        change size by ((0.2) * ((50) - (size)))\n    end\nend\n\nwhen I receive [start game v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@ins\n\nwhen flag clicked\nset size to (100) %\nset [ghost v] effect to (0)\nhide\ngo to x: (48) y: (16)\n\nwhen I receive [instructions v]\ngo to [front v] layer\nshow\n\nwhen I receive [instructions v]\nrepeat until <key (space v) pressed?>\n    show\nend\nhide\n\n@enemy\n\nwhen flag clicked\nset [speed v] to [2]\nset rotation style [left-right v]\nhide\n\nwhen I receive [change scene v]\nif <(scene #) = [1]> then\n    spawn [red] at [-11] [58] dir [90]\n    if <([x position v] of [player v]) < [0]> then\n        spawn [red] at [194] [-68] dir [-90]\n    else\n        spawn [red] at [68] [-68] dir [90]\n    end\nend\nif <(scene #) = [3]> then\n    spawn [red] at [111] [-118] dir [90]\nend\nif <(scene #) = [104]> then\n    spawn [red] at [-199] [-19] 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.31)\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)?> or <touching (jump through platform v)?>>>\n    change y by (1)\n    set [speed y v] to [0]\nend\n\ndefine move left or right\nmove (speed) 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            if <not <touching (jump through platform v)?>> then\n                stop [this script v]\n            end\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    start sound [Squish Pop 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 flag clicked\n\n@safe zones\n\nwhen flag clicked\nset size to (110) %\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\nclear graphic effects\n\n@safe zones2\n\nwhen flag clicked\nset size to (110) %\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [scene] (scene #))\n\n@nail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n