Classic Platformer | Part11.1 | More Enemies!

Instructions: **part12** soon\nBy -skyhigh173-\n100 loves!!!!\nGriffpatch comment 3 times!! \n\n1000 views!!!!\n——————————\nHelp this get featured\nhttps://scratch.mit.edu/studios/28715018\n——————————\n\nGriffpatch make this on YOUTUBE!!!!!\nTheme 1:L1 to 11\nTheme 2:L12 to 21\nTheme 3 L22\nSky theme added\n\n#game #all #griffpatch #platformer #tutorial\n(Press l to cheat)\n\n@griffpatch

@Stage\n\nwhen flag clicked\nclear sound effects\nswitch backdrop to (1 v)\nset volume to ((Music?) * (100)) %\nforever\n    if <(pick random (1) to (3)) = [1]> then\n        play sound [Vexento & Dexento - Anesthesia 2 v] until done\n    else\n        play sound (pick random (2) to (5)) until done\n    end\nend\n\nwhen I receive [change level v]\nif <(Level #) > [100]> then\n    switch backdrop to (>100 v)\n    stop [this script v]\nend\nif <(Level #) > [21]> then\n    switch backdrop to (3 v)\n    stop [this script v]\nend\nif <(Level #) > [11]> then\n    switch backdrop to (2 v)\n    stop [this script v]\nend\nif <(Level #) < [0]> then\n    switch backdrop to (<-98 v)\n    stop [this script v]\nend\nswitch backdrop to (1 v)\n\nwhen I receive [lose life v]\nset volume to ((Music?) * (100)) %\nrepeat (90)\n    change [pitch v] effect by (-1)\nend\nwait (0.5) seconds\nclear sound effects\n\nwhen I receive [menu - open v]\nbroadcast (Change music v)\n\nwhen I receive [menu - close v]\nbroadcast (Change music v)\n\nwhen I receive [change music v]\nif <(MENU) = [1]> then\n    set volume to (((Music?) * (100)) - (70)) %\nelse\n    set volume to ((Music?) * (100)) %\nend\n\nwhen flag clicked\nset [information v] to [0]\nhide variable [level # v]\nshow list [collected v]\n\nwhen [i v] key pressed\nif <(information) = [0]> then\n    set [information v] to [1]\n    show variable [level # v]\n    hide list [collected v]\nelse\n    set [information v] to [0]\n    hide variable [level # v]\n    show list [collected v]\nend\n\n@Player\n\ndefine Move in steps (step)\nchange [falling v] by (1)\nrepeat (step)\n    set [last value v] to (x position)\n    change x by ((Speed X) / (step))\n    Check touching soild\n    if <(touching) > [0]> then\n        Collide X - Slope/Wall\n    end\n    set [last value v] to (y position)\n    change y by ((Speed Y) / (step))\n    Check touching soild\n    if <(touching) > [0]> then\n        Collie Y - Celling/Floor\n    end\nend\n\ndefine Check touching soild\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]\nset [\(left v] to <<<mouse down?> and <(mouse x) < [0]>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>>\nset [\(right v] to <<<mouse down?> and <(mouse x) > [0]>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>>\nset [\(up v] to <<<mouse down?> and <(mouse y) > [0]>> or <<key (up arrow v) pressed?> or <key (space v) pressed?>>>\nFix collision with moving platform\nControls - Up and Down\nControls - LR\nMove in steps (([abs v] of (Speed X) ) + ([abs v] of (Speed Y) ))\nSet costume\n\ndefine Controls - Up and Down\nif <(\(Up) = [True]> 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 [12]\n    end\n    if <<(falling) < [3]> and <(jumping) = [0]>> then\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 Wall Slide\n    if <(Speed Y) < [0]> then\n        set [speed y v] to ((Speed Y) * (0.6))\n    end\nend\n\ndefine Controls - LR\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to ((\(Right) - (\(Left))\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    else\n        change [frame v] by (0.5)\n    end\nelse\n    change [speed x v] by ((ACCELERATION) * (KEY X))\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 & Begin\nstop [other scripts in sprite v]\nbroadcast (Setup other thing v)\npoint in direction (90)\nset [long jump v] to [0]\nset [jumping v] to [0]\nset [wall slide v] to [0]\nset [frame v] to [0]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\nset [twice check v] to [0]\ngo to x: (-150) y: (0)\nBegin Level # (SPAWN SCENE) go to XY (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 - Moving Platform v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nCheck touching soild\nif <(touching) > [0]> then\n    change y by (1)\nend\nif <(x position) > [235]> then\n    Begin Level # ((Level #) + (1)) go to XY [-235] []\nend\nif <(x position) < [-235]> then\n    Begin Level # ((Level #) - (1)) go to XY [235] []\nend\nif <<(y position) > [180]> and <<<(Level #) > [100]> or <(Level #) = [1]>> or <(Level #) < [0]>>> then\n    Begin Level # ((Level #) + (100)) go to XY [] [-170]\nend\nif <<(y position) < [-180]> and <<(Level #) > [100]> or <(Level #) < [2]>>> then\n    Begin Level # ((Level #) - (100)) go to XY [] [180]\nend\nif <<(y position) < [-177]> and <<(Level #) < [100]> and <not <(Level #) = [1]>>>> then\n    broadcast (Lose Life v)\nend\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Level # (l#) go to XY (x) (y)\nset [level # v] to (l#)\nif <(x) > []> then\n    set x to (x)\nend\nif <(y) > []> then\n    set y to (y)\nend\nbroadcast (Del enemy clones v)\nbroadcast (Change Level 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 (128)\n    Check touching soild\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 []\nif <(Level #) > [100]> then\n    set [colourful v] to [1]\nelse\n    set [colourful v] to [0]\nend\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 soild\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/Wall\nCheck Wall Slide\nchange y by (1)\nCheck touching soild\nif <(touching) > [0]> then\n    change y by (1)\n    Check touching soild\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 Collie Y - Celling/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 soild\nif <(touching) < [1]> then\n    set [falling v] to [0]\n    change [speed x v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck touching soild\nif <(touching) < [1]> then\n    set [falling v] to [0]\n    change [speed x v] by (-1)\n    stop [this script v]\nend\nchange y by (2)\nchange x by (1)\n\nwhen [l v] key pressed\nif <not <(username) = [skyhigh173]>> then\n    ask [Are you sure you want to cheat?\(Y/N\)] and wait\n    if <not < (answer) contains [Y]?>> then\n        stop [this script v]\n    end\nend\nask [Set level# to?] and wait\nset [level # v] to (answer)\nbroadcast (Change Level v)\nwait (0) seconds\nFix Collision in Direction [0]\n\nwhen [d v] key pressed\nif <(username) = [skyhigh173]> then\n    set drag mode [draggable v]\n    wait (4) seconds\n    set drag mode [not draggable v]\nend\n\ndefine Check 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 soild\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 [twice check v] to [1]\nset [shake dx v] to [0]\nset [shake dy v] to [0]\nstart sound [Oops v]\nstop [other scripts in sprite v]\nrepeat (15)\n    wait (0.01) seconds\n    set [ghost v] effect to (100)\n    wait (0.01) seconds\n    set [ghost v] effect to (0)\nend\nswitch costume to (jump01 v)\nset [speed x v] to [0]\nset [speed y v] to [20]\nset [temp v] to (costume [number v])\nrepeat until <(y position) < [-220]>\n    switch costume to (big v)\n    change [speed y v] by (-1)\n    change y by (Speed Y)\n    switch costume to (Temp)\nend\nwait (0.5) seconds\nchange [/lives v] by (-1)\nif <(/LIVES) > [0]> then\n    Reset & Begin\nelse\n    broadcast (Game Over v)\nend\n\nwhen I receive [reset v]\nbroadcast (Start Game v)\n\nwhen I receive [wait - ok v]\nshow\nReset & Begin\n\ndefine Fix collision with moving platform\nchange x by (PLATFORM DX)\nchange y by (PLATFORM DY)\nCheck touching soild\nif <(touching) > [0]> then\n    Fix collision in all direction:DX (x position) DY (y position) Max [16] Solution [16]\n    if <(touching) > [0]> then\n        broadcast (Lose Life v)\n    end\nend\nchange x by (SHAKE DX)\nchange y by (SHAKE DY)\n\ndefine Fix collision in all direction:DX (x) DY (y) Max (m) Solution (s)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (0)\nrepeat (m)\n    repeat (s)\n        go to x: (x) y: (y)\n        move (distance) steps\n        Check touching soild\n        if <(touching) < [1]> then\n            point in direction (Temp)\n            stop [this script v]\n        end\n        turn right ((360) / (s)) 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 [3]\nset [spawn scene v] to [1]\nset [spawn x v] to [-100]\nset [spawn y v] to [0]\nset drag mode [not draggable v]\nswitch costume to (stand v)\nset size to (50) %\nset rotation style [left-right v]\nset [resistance v] to [0.8]\nset [acceleration v] to [1.5]\nset [jump force v] to [12]\nset [jump duration v] to [7]\nset [gravity v] to [-1.25]\npoint in direction (90)\nhide\n\nwhen I receive [player bounce v]\nset [speed y v] to [10]\n\n@Cloud\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nset [ghost v] effect to (pick random (40) to (60))\nset [speed x v] to (pick random (1.) to (3.))\nrepeat until <(x position) > [300]>\n    change x by (Speed X)\n    go to [back v] layer\n    go [forward v] (1) layers\n    if <(Level #) < [0]> then\n        delete this clone\n    end\nend\ndelete this clone\n\nwhen I receive [wait - ok v]\nhide\nswitch costume to (small v)\nset size to (200) %\nset [speed x v] to []\nforever\n    go to x: (-280) y: (pick random (0) to (175))\n    switch costume to (pick random (1) to (2))\n    create clone of (_myself_ v)\n    wait (pick random (1.5) to (3)) seconds\nend\n\n@background\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [change level v]\ngo to [back v] layer\nswitch costume to (join [/] (Level #))\nhide\nif <(costume [name v]) = (join [/] (Level #))> then\n    show\nend\n\n@Thumb\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (pt11 v)\nshow\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change level v]\ngo to x: (0) y: (0)\nset [temp v] to (join [L] (Level #))\nswitch costume to (Temp)\nshow\nif <not <(Temp) = (costume [name v])>> then\n    hide\n    stop [this script v]\nend\nif <<(Level #) = [3]> or <(Level #) = [-98]>> then\n    forever\n        set y to ((5) * ([sin v] of ((timer) * (200)) ))\n    end\nend\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\n@menu\n\nwhen flag clicked\nset [music? v] to [1]\nset [menu v] to [0]\nswitch costume to (off v)\nset [cloneid v] to [n]\ngo to x: (210) y: (150)\nhide\n\nwhen this sprite clicked\nif <(CloneID) = [1]> then\n    stop [this script v]\nend\nset size to (70) %\nstart sound [click v]\nif <(CloneID) = [n]> then\n    if <(MENU) = [0]> then\n        broadcast (Menu - open v)\n        Menu\n        set [menu v] to [1]\n    else\n        broadcast (Menu - close v)\n    end\nend\nif <(CloneID) = [2]> then\n    ask [Are you sure?\[Y/N\]] and wait\n    if < (answer) contains [Y]?> then\n        broadcast (RESET v)\n        broadcast (Wait - ok v)\n    end\nend\nif <(CloneID) = [3]> then\n    set [music? v] to ((1) - (Music?))\n    broadcast (Change music v)\nend\n\ndefine Menu\nset [cloneid v] to [1]\nrepeat (3)\n    create clone of (_myself_ v)\n    change [cloneid v] by (1)\nend\ngo to [front v] layer\nset [cloneid v] to [n]\nbroadcast (Tick - Menu v)\n\nwhen I start as a clone\ngo to [front v] layer\nset size to (100) %\nif <(CloneID) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (black v)\n    set [ghost v] effect to (50)\n    go [backward v] (1) layers\nend\nif <(CloneID) = [2]> then\n    go to x: (0) y: (40)\n    switch costume to (restart v)\nend\nif <(CloneID) = [3]> then\n    go to x: (0) y: (-20)\n    switch costume to (music v)\nend\n\nwhen I receive [menu - close v]\nset [menu v] to [0]\ndelete this clone\n\nwhen I receive [tick - menu v]\nforever\n    change size by (((100) - (size)) / (4))\nend\n\nwhen I receive [wait - ok v]\nshow\nbroadcast (Tick - Menu v)\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    go [backward v] (1) layers\nend\n\n@Splash\n\nwhen flag clicked\nset [start? v] to [0]\nset [clone? v] to [0]\nbroadcast (RESET v)\nswitch costume to (main v)\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\nset [id v] to [1]\ncreate clone of (_myself_ v)\nset [id v] to [2]\ncreate clone of (_myself_ v)\nset [id v] to [0]\nwait until <(Start?) = [1]>\nbroadcast (Start button click v)\nrepeat (30)\n    change y by (((350) - (y position)) / (6))\nend\nhide\n\nwhen I start as a clone\nif <(ID) = [1]> then\n    switch costume to (cloud v)\n    go to x: (0) y: (-350)\n    go to [front v] layer\n    set [clone? v] to [1]\nelse\n    switch costume to (play button v)\n    go to x: (0) y: (-20)\n    go to [front v] layer\n    set [clone? v] to [1]\nend\n\nwhen I receive [wait - ok v]\nwait (1) seconds\ndelete this clone\n\nwhen I receive [start button click v]\nif <(Clone?) = [1]> then\n    repeat (30)\n        change y by (((0) - (y position)) / (6))\n    end\n    clear graphic effects\n    broadcast (Wait - ok v)\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [game over v]\nrepeat (1)\n    delete this clone\nend\ngo to x: (0) y: (0)\nswitch costume to (game over v)\ngo to [front v] layer\nshow\nbroadcast (Main Menu v)\n\nwhen this sprite clicked\nif <(ID) = [2]> then\n    set [start? v] to [1]\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\nwhen I receive [wait - ok v]\nhide\n\n@Platform\n\nwhen I receive [reset v]\ngo to [back v] layer\nhide\n\nwhen I receive [wait - ok v]\ngo to [back v] layer\nshow\n\nwhen I receive [change level v]\nshow\nswitch costume to (join (join [L] (Level #)) [L])\nif <not <(costume [name v]) = (join (join [L] (Level #)) [L])>> then\n    try door costume\n    if <(door?) = [0]> then\n        hide\n    else\n        Animate door\n    end\nend\nAnimate Platforms\n\ndefine Animate Platforms\nif <(Level #) = [1]> then\n    go to x: (-180) y: (-100)\n    forever\n        glide (2) secs to x: (-180) y: (-100)\n        wait (0.5) seconds\n        glide (2) secs to x: (-85) y: (110)\n        wait (0.5) seconds\n    end\nend\nif <(Level #) = [22]> then\n    go to x: (0) y: (41)\n    set [speedy v] to [0]\n    forever\n        change [speedy v] by (-1)\n        change y by (SpeedY)\n        if <(SpeedY) < [-13]> then\n            start sound [Down v]\n            repeat (15)\n                Shake [5]\n                set y to (-64)\n                change y by (SHAKE DY)\n            end\n            set [shake dx v] to [0]\n            set [shake dy v] to [0]\n            set [speedy v] to [0]\n            glide (2) secs to x: (0) y: (41)\n            wait (0.5) seconds\n        end\n    end\nend\nif <(Level #) = [-98]> then\n    go to x: (-150) y: (-100)\n    forever\n        glide (2) secs to x: (150) y: (-100)\n        wait (1) seconds\n        glide (2) secs to x: (-150) y: (-100)\n        wait (1) seconds\n    end\nend\nif <(Level #) = [4]> then\n\nwhen I receive [tick - moving platform v]\nTick (x position) (y position)\nset [last x v] to (x position)\nset [last y v] to (y position)\n\ndefine Tick (newx) (newy)\nif <(newy) > (last Y)> then\n    change y by (1)\nelse\n    set y to ((last Y) + (2))\nend\nif <touching (player v)?> then\n    set [platform dx v] to ((newx) - (last X))\n    set [platform dy v] to ((newy) - (last Y))\nend\ngo to x: (newx) y: (newy)\n\nwhen I receive [lose life v]\nstop [other scripts in sprite v]\n\ndefine Shake (dir)\nset [shake dx v] to (pick random ((0) - (dir)) to (dir))\nset [shake dy v] to (pick random ((0) - (dir)) to (dir))\n\ndefine Door at (x) (y) key (key name)\nshow\ngo to [back v] layer\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 [Buzz Whir v]\n        repeat (16)\n            change y by (4)\n        end\n        wait (1) seconds\n        start sound [Buzz Whir v]\n        repeat (16)\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\ndefine try door costume\nset [door? v] to [0]\nswitch costume to (l1l v)\nforever\n    if < (costume [name v]) contains (join (join [L] (Level #)) [L])?> then\n        if < (costume [name v]) contains [Key]?> then\n            set [door? v] to [1]\n            stop [this script v]\n        end\n    else\n        next costume\n        if <(costume [name v]) = [L1L]> then\n            stop [this script v]\n        end\n    end\nend\n\ndefine Animate door\nif <(Level #) = [4]> then\n    Door at [-70] [145] key [Key 1 at L4L]\nend\n\n@level\n\nwhen flag clicked\nset [colourful v] to [0]\nset [brightness v] effect to (10)\ngo to x: (0) y: (0)\ngo to [back v] layer\nhide\n\nwhen I receive [change level v]\nset [shake dx v] to [0]\nset [shake dy v] to [0]\nswitch costume to (join [L] (Level #))\n\nwhen I receive [wait - ok v]\nshow\n\nwhen flag clicked\nbroadcast (Level - Shake Loop v)\n\nwhen flag clicked\npoint in direction (90)\ngo to x: (0) y: (0)\nforever\n    if <(COLOURFUL) = [1]> then\n        stop [other scripts in sprite v]\n        go to [back v] layer\n        erase all\n        Stamp Outline\n        Stamp Shadow\n    else\n        erase all\n        wait until <(COLOURFUL) = [1]>\n    end\nend\n\ndefine Stamp Outline\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\nrepeat (8)\n    go to [front v] layer\n    move (3) steps\n    stamp\n    move (-3) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\ndefine Loop\nforever\n    go to x: (0) y: (0)\n    change x by (SHAKE DX)\n    change y by (SHAKE DY)\n    go to [back v] layer\n    go [forward v] (1) layers\nend\n\nwhen I receive [level - shake loop v]\nLoop\n\ndefine Stamp Shadow\nset [brightness v] effect to (-90)\nset [ghost v] effect to (70)\nchange y by (-20)\nstamp\nchange y by (20)\nclear graphic effects\n\n@collect\n\nwhen I receive [change level v]\nif <(Level #) = (my level)> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nrepeat until <<touching (player v)?> and <(distance to [player v]) < [40]>>\n    change y by ((0.5) * ([sin v] of (frame) ))\n    change [frame v] by (5)\nend\nset [my level v] to []\nif <(costume [name v]) = [coin]> then\n    start sound [Collect v]\n    change [coins v] by (1)\nelse\n    if <(costume [name v]) = [Green Flag]> then\n        set [spawn scene v] to (Level #)\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        start sound [Wand v]\n        add (costume [name v]) to [collected v]\n    end\nend\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\n    change size by (2)\nend\nhide\n\nwhen I receive [setup other thing v]\nrepeat (1)\n    delete this clone\nend\ndelete all of [collected v]\nset [frame v] to [0]\nhide\nPlace [coin] level [1] XY [0] [-80]\nPlace [Key 1 at L4L] level [301] XY [200] [100]\nPlace [Green Flag] level [5] XY [-100] [-50]\nPlace [Green Flag] level [11] XY [20] [-85]\nPlace [Green Flag] level [21] XY [20] [-85]\n\ndefine Place (cn) level (l) XY (x) (y)\nswitch costume to (cn)\nset [my level v] to (l)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my level v] to []\n\nwhen I start as a clone\nif <(my level) = (Level #)> then\n    show\nend\n\nwhen flag clicked\nset [coins v] to [0]\nset [level # v] to [1]\ndelete all of [collected v]\n\nwhen I receive [lose life v]\nset [coins v] to [0]\ndelete all of [collected v]\n\n@Start Button\n\nwhen I receive [main menu v]\nwait (0.1) seconds\ngo to [front v] layer\nshow\ngo to x: (0) y: (-90)\nset size to (1) %\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((110) - (size)) / (5))\n    else\n        change size by (((100) - (size)) / (5))\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nhide\nbroadcast (Start Game v)\nbroadcast (Wait - ok v)\n\n@Enemy\n\nwhen flag clicked\nset [twice check v] to [0]\nset rotation style [left-right v]\nhide\n\nwhen I receive [change level v]\nif <(Level #) = [1]> then\n    Spawn [Cube] At [160] [-20] [-90]\nend\nif <(Level #) = [2]> then\n    Spawn [Cube] At [170] [-50] [-90]\nend\nif <(Level #) = [3]> then\n    Spawn [Cube] At [110] [-50] [-90]\n    Spawn [Cube] At [-40] [50] [-90]\nend\n\nwhen I start as a clone\nswitch costume to (cube v)\nset [speed y v] to [0]\nshow\nforever\n    Move Down\n    Move left/right\n    if <<(Twice Check) = [0]> and <touching (player v)?>> then\n        if <not <touching (safe v)?>> then\n            Touch!\n        end\n    end\nend\n\nwhen I receive [del enemy clones v]\ndelete this clone\n\ndefine Move Down\nchange [speed y v] by (-1)\nchange y by (speed Y)\nrepeat until <<not <touching (platform v)?>> and <not <touching (level v)?>>>\n    change y by (1)\n    set [speed y v] to [0]\nend\n\ndefine Move left/right\nmove (2) steps\nchange y by (-4)\nif <not <<touching (_edge_ v)?> or <<touching (platform v)?> or <touching (level v)?>>>> then\n    turn right (180) degrees\n    move (3) steps\n    change y by (4)\n    stop [this script v]\nend\nchange y by (4)\nrepeat (4)\n    if <not <<touching (_edge_ v)?> or <<touching (platform v)?> or <touching (level 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 Touch!\nif <([speed y v] of [player v]) < [-3]> then\n    broadcast (Player Bounce v)\n    start sound [Squish Pop v]\n    switch costume to (dead v)\n    wait (0.3) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (1)\n    end\n    wait (1) seconds\n    delete this clone\nend\nbroadcast (Lose Life v)\n\ndefine Spawn (t) At (x) (y) (d)\nswitch costume to (t)\ngo to x: (x) y: (y)\npoint in direction (d)\ncreate clone of (_myself_ v)\n\n@Safe\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nset [ghost v] effect to (50)\n\n