Classic Platformer v0.1

Instructions: ᴡᴇʟᴄᴏᴍᴇ ᴛᴏ ᴍʏ ᴍᴏꜱᴛ ᴀᴅᴠᴀɴᴄᴇᴅ ɢᴀᴍᴇ ʙʏ ꜰᴀʀ!\n1000+ ʙʟᴏᴄᴋꜱ :O 3+ ᴍᴏɴᴛʜꜱ ᴏꜰ ᴡᴏʀᴋ :O\n\nꜱʜᴏᴜᴛᴏᴜᴛꜱ: @AstroCoder05 @ASH__WING\nɪɴꜱᴛʀᴜᴄᴛɪᴏɴꜱ:\n⋄ ᴡᴀꜱᴅ, ᴀʀʀᴏᴡ ᴋᴇʏꜱ ᴏʀ ᴍᴏʙɪʟᴇ ᴄᴏɴᴛʀᴏʟꜱ\n⋄ ᴊᴜᴍᴘ ᴏɴ ᴇɴᴇᴍɪᴇꜱ ᴛᴏ ᴅᴇꜰᴇᴀᴛ ᴛʜᴇᴍ\n⋄ ᴄᴏʟʟᴇᴄᴛ ᴛʜᴇ ᴀᴘᴘʟᴇꜱ\n⋄ ᴀᴠᴏɪᴅ ᴛʜᴇ ꜱᴘɪᴋᴇꜱ ᴀɴᴅ ʟᴀᴠᴀ\n⋄ ᴄᴏʟʟᴇᴄᴛ ᴛʜᴇ ɢʀᴇᴇɴ ꜰʟᴀɢꜱ ꜰᴏʀ ᴄʜᴇᴄᴋᴘᴏɪɴᴛꜱ\n⋄ ᴊᴜᴍᴘ ᴏɴ ᴘᴀᴅꜱ ᴛᴏ ʙᴏᴜɴᴄᴇ\n\nʜᴏᴡ ʏᴏᴜ ᴄᴀɴ ʜᴇʟᴘ ᴍᴇ:\nꜱᴛᴇᴘ 1: ɢᴏ ᴛᴏ ᴛʜɪꜱ ꜱᴛᴜᴅɪᴏ:\nhttps://scratch.mit.edu/studios/28715018\nꜱᴛᴇᴘ 2: ɢᴏ ᴛᴏ ᴛʜᴇ ᴄᴏᴍᴍᴇɴᴛ ꜱᴇᴄᴛɪᴏɴ ᴀɴᴅ ᴘᴀꜱᴛᴇ ᴛʜᴇ ʟɪɴᴋ ᴛᴏ ᴛʜɪꜱ ᴘʀᴏᴊᴇᴄᴛ ᴛʜᴇʀᴇ\n\nᴛʜᴀɴᴋꜱ :)

@Stage\n\nwhen flag clicked\nbroadcast (Main Menu v)\n\n@blank\n\nwhen flag clicked\nset volume to (0) %\n\nwhen I receive [level complete v]\nset volume to (0) %\n\nwhen I receive [start game v]\nset volume to (100) %\nforever\n    play sound [Music v] until done\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\ngo to x: (0) y: (0)\n\n@Player\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 (moving platform v)?>> then\n    set [touching? v] to [1]\nelse\n    set [touching? v] to [0]\nend\n\nwhen I receive [tick - player v]\nMoved by Moving Platform\nJump\nMove Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet Costume\n\ndefine Jump\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    if <<(wallslide?) > [0]> and <(jumping?) = [0]>> then\n        start sound [Jump v]\n        set [jumping? v] to [1]\n        set [falling? v] to [3]\n        set [wallslide? 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 <(wallslide?) > [0]> then\n    Check Can Wallslide\n    if <(speed y) < [0]> then\n        set [speed y v] to ((speed y) * (0.6))\n    end\nend\n\ndefine Move 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 <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> - <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>>>)\nif <(Key x) = [0]> then\n    if <<(falling?) > [2]> and <(wallslide?) < [1]>> then\n        set [speed x v] to ((speed x) * (0.95))\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        stop [this script v]\n    else\n        change [frame v] by (0.5)\n    end\nelse\n    change [speed x v] by ((Key x) * (Acceleration))\n    if <not <(direction) = ((Key x) * (90))>> then\n        set [wallslide? v] to [0]\n    end\n    point in direction ((Key x) * (90))\n    change [frame v] by (1)\nend\nset [speed x v] to ((speed x) * (Resistance))\n\ndefine Reset and Begin Level\nset [invulnerable v] to [0]\nset [speed y v] to [0]\nset [speed x v] to [0]\nset [falling? v] to [99]\nset [wallslide? 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: (Spawn x) y: (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 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: [-235] y: []\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((Scene #) + (-1)) Go to x: [235] y: []\nend\nif <not <(Scene #) = [15]>> then\n    if <(y position) > [180]> then\n        Begin Scene # ((Scene #) + (100)) Go to x: [] y: [-160]\n    end\nend\nif <(y position) < [-180]> then\n    Begin Scene # ((Scene #) + (-100)) Go to x: [] y: [180]\nend\nif <<touching (spikes v)?> or <touching (lava v)?>> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Scene # (scene #) Go to x: (x) y: (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 (128)\n    Check Touching Solid\n    if <(touching?) < [1]> then\n        point in direction (temp)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nset [platform dx v] to []\nset [platform dy v] to []\n\ndefine Set Costume\nset rotation style [left-right v]\nif <(wallslide?) > [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 Wallslide\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 Wallslide\nif <(falling?) < [2]> then\n    set [wallslide? 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 [wallslide? 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 [Crunch v]\nrepeat (10)\n    change y by (10)\n    change [ghost v] effect by (10)\nend\nwait (0.5) seconds\nstart sound [Revive v]\nReset and Begin Level\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: (x position) y: (y position) max: [16]\n    if <(touching?) > [0]> then\n        broadcast (Lose Life v)\n    end\nend\n\ndefine Find closest space to: x: (x) y: (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 [player - bounce v]\nset [speed y v] to [15]\n\nwhen I receive [start game v]\nset [spawn scene v] to [1]\nset [spawn x v] to [-150]\nset [spawn y v] to [50]\nset [jump force v] to [12]\nset [resistance v] to [0.8]\nset [jump duration v] to [5.5]\nset [acceleration v] to [2]\nset [gravity v] to [-1]\ndelete all of [inventory v]\nbroadcast (Setup v) and wait\nReset and Begin Level\n\nwhen I receive [player - spring bounce v]\nif < ([costume name v] of [springs v]) contains [Green]?> then\n    if <([direction v] of [springs v]) = [0]> then\n        change [speed y v] by (4.5)\n    end\n    if <([direction v] of [springs v]) = [180]> then\n        change [speed y v] by (4.5)\n    end\n    if <([direction v] of [springs v]) = [90]> then\n        change [speed x v] by (15.5)\n    end\n    if <([direction v] of [springs v]) = [-90]> then\n        change [speed x v] by (-15.5)\n    end\nelse\n    if < ([costume name v] of [springs v]) contains [Red]?> then\n        if <([direction v] of [springs v]) = [0]> then\n            set [speed y v] to [20]\n        end\n        if <([direction v] of [springs v]) = [180]> then\n            set [speed y v] to [-20]\n        end\n        if <([direction v] of [springs v]) = [90]> then\n            change [speed x v] by (30.5)\n        end\n        if <([direction v] of [springs v]) = [-90]> then\n            change [speed x v] by (-30.5)\n        end\n    end\nend\n\nwhen I receive [level complete v]\nstop [other scripts in sprite v]\n\nBegin Scene # [15] Go to x: [] y: []\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (Scene #))\nStamp Outline\nStamp Shadow\n\ndefine Stamp Shadow\nset [brightness v] effect to (-100)\nset [ghost v] effect to (80)\nchange y by (-10)\nstamp\nchange y by (10)\nclear graphic effects\n\ndefine Stamp Outline\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\nwhen I receive [about to change scene v]\nerase all\n\n@Spikes\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [change scene v]\nif <not <(Scene #) = [14]>> then\n    go to x: (0) y: (0)\nend\nswitch costume to (blank v)\nswitch costume to (join [Scene] (Scene #))\n\nwhen I receive [change scene v]\nforever\n    if <(costume [name v]) = [Scene14]> then\n        go to x: (0) y: (-100)\n        glide (0.5) secs to x: (0) y: (-140)\n        wait (0.55) seconds\n        glide (0.5) secs to x: (0) y: (-100)\n        wait (0.55) seconds\n    end\nend\n\n@Lava\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (Scene #))\nforever\n    set y to ((3) * ([sin v] of ((timer) * (180)) ))\nend\n\n@Collectibles\n\nwhen I start as a clone\nset [clone? v] to [yes]\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]) = [Checkpoint]> then\n        start sound [Checkpoint v]\n        set [spawn scene v] to (Scene #)\n        set [spawn x v] to (x position)\n        set [spawn y v] to (y position)\n    else\n        start sound [Collect v]\n        add (costume [name v]) to [inventory v]\n    end\nend\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [change scene v]\nif <(Scene #) = (my scene)> then\n    show\nelse\n    hide\nend\n\nwhen I receive [setup v]\nif <(Clone?) = [yes]> then\n    delete this clone\nend\nif <(Clone?) = [no]> then\n    wait (0) seconds\n    set [frame v] to [0]\n    set [apples v] to [0]\n    hide\n    Place [Apple] at scene: [1] x: [45] y: [2]\n    Place [Apple] at scene: [2] x: [76] y: [-70]\n    Place [Apple] at scene: [2] x: [150] y: [-70]\n    Place [Apple] at scene: [3] x: [87] y: [10]\n    Place [Apple] at scene: [3] x: [-14] y: [56]\n    Place [Apple] at scene: [203] x: [167] y: [115]\n    Place [Apple] at scene: [204] x: [12] y: [55]\n    Place [Apple] at scene: [4] x: [70] y: [-24]\n    Place [Apple] at scene: [5] x: [8] y: [-5]\n    Place [Apple] at scene: [6] x: [44] y: [-76]\n    Place [Apple] at scene: [110] x: [-82] y: [0]\n    Place [Apple] at scene: [110] x: [-40] y: [0]\n    Place [Apple] at scene: [110] x: [-82] y: [43]\n    Place [Apple] at scene: [110] x: [-40] y: [43]\n    Place [Apple] at scene: [110] x: [0] y: [0]\n    Place [Apple] at scene: [110] x: [40] y: [0]\n    Place [Apple] at scene: [110] x: [0] y: [43]\n    Place [Apple] at scene: [110] x: [40] y: [43]\n    Place [Apple] at scene: [102] x: [93] y: [-54]\n    Place [Apple] at scene: [102] x: [200] y: [-54]\n    Place [Apple] at scene: [102] x: [-202] y: [-9]\n    Place [Apple] at scene: [109] x: [-14] y: [-37]\n    Place [Apple] at scene: [109] x: [-160] y: [-37]\n    Place [Apple] at scene: [11] x: [-166] y: [-22]\n    Place [Apple] at scene: [12] x: [4] y: [-7]\n    Place [Apple] at scene: [205] x: [0] y: [90]\n    Place [Apple] at scene: [13] x: [52] y: [-88]\n    Place [Apple] at scene: [14] x: [11] y: [-14]\n    Place [Key 1] at scene: [203] x: [-132] y: [2]\n    Place [Key 1] at scene: [109] x: [205] y: [41]\n    Place [Checkpoint] at scene: [206] x: [3] y: [15]\n    Place [Checkpoint] at scene: [5] x: [-189] y: [-76]\n    Place [Checkpoint] at scene: [8] x: [8] y: [-82]\n    Place [Checkpoint] at scene: [10] x: [62] y: [-82]\n    Place [Checkpoint] at scene: [13] x: [-194] y: [-80]\n    Place [Checkpoint] at scene: [103] x: [-64] y: [-10]\nend\n\ndefine Place (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 flag clicked\nset [clone? v] to [no]\n\n@Moving Platform\n\nwhen I receive [change scene v]\nhide\nif <(Scene #) = [10]> then\n    Door at: x: [-53] y: [-51] key: [Key 1]\nend\nif <(Scene #) = [4]> then\n    switch costume to (normal platform v)\n    show\n    Animate Moving Platforms\nend\nif <(Scene #) = [5]> then\n    switch costume to (big crusher v)\n    show\n    Animate Crushing Platforms\nend\nif <(Scene #) = [15]> then\n    switch costume to (end lift v)\n    show\n    Animate End Lift\nend\n\ndefine Animate Moving Platforms\ngo to x: (-45) y: (-60)\nforever\n    glide (2) secs to x: (126) y: (-60)\n    wait (1) seconds\n    glide (2) secs to x: (-45) y: (-60)\n    wait (1) seconds\nend\n\nwhen I receive [tick - moving 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 <(new y) > (last y)> then\n    change y by (1)\nelse\n    set y to ((last y) + (1))\nend\nif <touching (player v)?> then\n    set [platform dx v] to ((new x) - (last x))\n    set [platform dy v] to ((new y) - (last y))\nend\ngo to x: (new x) y: (new y)\n\ngo to x: (-39) y: (-107)\nforever\n    glide (2) secs to x: (-48) y: (68)\n    wait (1) seconds\n    glide (2) secs to x: (-48) y: (-107)\n    wait (1) seconds\nend\n\ndefine Animate Crushing Platforms\ngo to x: (-16) y: (123)\nforever\n    glide (1) secs to x: (-16) y: (-80)\n    wait (1) seconds\n    glide (1) secs to x: (-16) y: (123)\n    wait (1) seconds\nend\n\ndefine Door at: x: (x) y: (y) key: (key name)\nshow\nswitch costume to (key name)\ngo to x: (x) y: (y)\nforever\n    wait until <touching (player v)?>\n    if <[inventory v] contains (key name)?> then\n        start sound [Open Door v]\n        repeat (24)\n            change y by (4)\n        end\n        wait (1) seconds\n        start sound [Open Door v]\n        repeat (24)\n            change y by (-4)\n        end\n        start sound [Door Ground thing v]\n    else\n        start sound [Locked Door v]\n    end\n    wait until <not <touching (player v)?>>\nend\n\nwhen I receive [about to change scene v]\nerase all\n\ndefine Animate End Lift\ngo to x: (125) y: (-100)\nforever\n    glide (2) secs to x: (125) y: (121)\n    wait (1) seconds\n    glide (2) secs to x: (125) y: (-100)\n    wait (1) seconds\nend\n\n@Enemy\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [change scene v]\nif <(Scene #) = [1]> then\n    Spawn [Red] at x: [130] y: [-105] direction: [-90]\nend\nif <(Scene #) = [203]> then\n    Spawn [Red] at x: [-140] y: [-7] direction: [90]\nend\nif <(Scene #) = [109]> then\n    Spawn [Red] at x: [-75] y: [-32] direction: [-90]\nend\nif <(Scene #) = [206]> then\n    Spawn [Red] at x: [-103] y: [15] direction: [90]\n    Spawn [Red] at x: [134] y: [15] direction: [-90]\nend\n\nwhen I start as a clone\nshow\nset [speed y v] to [0]\nforever\n    if < (costume [name v]) contains [Red]?> then\n        switch costume to (red v)\n    else\n        if < (costume [name v]) contains [Spring]?> then\n            switch costume to (spring v)\n        end\n    end\n    set rotation style [don't rotate v]\n    Move Left or Right\n    Move Up and Down\n    change [frame v] by (0.33)\n    if < (costume [name v]) contains [Red]?> then\n        switch costume to ((1) + (([floor v] of (frame) ) mod (4)))\n    else\n        if < (costume [name v]) contains [Spring]?> then\n            switch costume to ((6) + (([floor v] of (frame) ) mod (4)))\n        end\n    end\n    set rotation style [left-right v]\n    if <<(Invulnerable) = [0]> and <<touching (player v)?> or <<touching (lava v)?> or <touching (spikes v)?>>>> then\n        Touching Danger\n    end\nend\n\nwhen I receive [about to change scene v]\ndelete this clone\n\ndefine Move Up and Down\nchange [speed y v] by (Gravity)\nchange y by (speed y)\nrepeat until <not <touching (level v)?>>\n    change y by (1)\n    if < (costume [name v]) contains [Red]?> then\n        set [speed y v] to [0]\n    else\n        if < (costume [name v]) contains [Spring]?> then\n            if <(pick random (1) to (pick random (1) to (6))) = [1]> then\n                set [speed y v] to [14]\n            else\n                set [speed y v] to [0]\n            end\n        end\n    end\nend\n\ndefine Move Left or Right\nmove (2) steps\nrepeat (4)\n    if <not <<touching (level v)?> or <<touching (_edge_ v)?> or <touching (spikes v)?>>>> then\n        if <not <<touching (safe zones v)?> or <<touching (moving platform v)?> or <touching color (#5ce664)?>>>> then\n            stop [this script v]\n        end\n    end\n    change y by (1)\nend\nchange y by (-4)\nmove (-2) steps\nturn right (180) degrees\n\ndefine Touching Danger\nif <<([speed y v] of [player v]) < [-3]> or <<touching (spikes v)?> or <touching (lava v)?>>> then\n    if <not <<touching (spikes v)?> or <touching (lava v)?>>> then\n        broadcast (Player - Bounce v)\n    end\n    if < (costume [name v]) contains [Red]?> then\n        switch costume to (redsquished v)\n    else\n        if < (costume [name v]) contains [Spring]?> then\n            switch costume to (springsquished v)\n        end\n    end\n    start sound [Squish Pop v]\n    wait (0.3) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n        change y by (4)\n    end\n    delete this clone\nend\nbroadcast (Lose Life v)\n\ndefine Spawn (type) at x: (x) y: (y) direction: (dir)\nswitch costume to (type)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\n\n@Springs\n\nwhen I start as a clone\nset [clone? v] to [yes]\nforever\n    if <touching (player v)?> then\n        broadcast (Player - Spring Bounce v)\n        if < (costume [name v]) contains [Green]?> then\n            switch costume to (greensq v)\n            wait (0.25) seconds\n            switch costume to (green v)\n        else\n            if < (costume [name v]) contains [Red]?> then\n                switch costume to (redsq v)\n                wait (0.25) seconds\n                switch costume to (red v)\n            end\n        end\n    end\nend\n\nwhen I receive [change scene v]\nif <(Scene #) = (my scene)> then\n    show\nelse\n    hide\nend\n\nwhen I receive [start game v]\ngo to [back v] layer\nif <(Clone?) = [yes]> then\n    delete this clone\nend\nif <(Clone?) = [no]> then\n    wait (0) seconds\n    hide\n    Place [Green] at scene: [11] x: [-66] y: [-125] direction: [0]\n    Place [Red] at scene: [13] x: [0] y: [-105] direction: [0]\n    Place [Red] at scene: [13] x: [-100] y: [-105] direction: [0]\n    Place [Red] at scene: [13] x: [110] y: [-105] direction: [0]\nend\n\ndefine Place (costume name) at scene: (scene #) x: (x) y: (y) direction: (dir)\nset [my scene v] to (scene #)\nswitch costume to (costume name)\ngo to x: (x) y: (y)\npoint in direction (dir)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\nwhen flag clicked\nset [clone? v] to [no]\n\n@Menu\n\nwhen I start as a clone\nif <(cloneID) = [5]> then\n    forever\n        if <touching color (#000000)?> then\n            set [speed y v] to [0]\n        else\n            change [speed y v] by (-1)\n        end\n    end\nend\n\ndefine Build (num) Start (start)\nset [cloneid v] to (start)\nrepeat (num)\n    change [cloneid v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\ngo to [front v] layer\nshow\nset volume to (45) %\nif <(cloneID) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (bg v)\n    forever\n        play sound [Pixelland v] until done\n    end\nend\nif <(cloneID) = [2]> then\n    switch costume to (text v)\n    go to x: (0) y: (50)\n    forever\n        point in direction ((90) + (([cos v] of (((timer) - (3)) * (100)) ) * (5)))\n    end\nend\nif <(cloneID) = [3]> then\n    switch costume to (play1 v)\n    go to x: (0) y: (-65)\n    forever\n        point in direction ((90) + (([cos v] of (((timer) - (3)) * (100)) ) * (4)))\n        if <touching (mouse-pointer v)?> then\n            switch costume to (play2 v)\n            change size by (((120) - (size)) * (0.5))\n        else\n            switch costume to (play1 v)\n            change size by (((100) - (size)) * (0.5))\n        end\n    end\nend\nif <(cloneID) = [4]> then\n    switch costume to (v v)\n    go to x: (60) y: (65)\n    forever\n        point in direction ((90) + (([cos v] of (((timer) - (3)) * (100)) ) * (5)))\n    end\nend\nif <(cloneID) = [5]> then\n    switch costume to (run-01 v)\n    set size to (70) %\n    go to x: (-163) y: (-87)\n    forever\n        if <(pick random (1) to (70)) = [1]> then\n            if <touching color (#000000)?> then\n                switch costume to (jump01 v)\n                set [speed y v] to [12]\n            end\n        else\n            if <touching color (#000000)?> then\n                switch costume to ((6) + ([floor v] of ((frame) mod (16)) ))\n                change [frame v] by (1)\n            end\n        end\n        change y by (speed y)\n    end\nend\n\nwhen I start as a clone\nif <(cloneID) = [3]> then\n    forever\n        if <<touching (mouse-pointer v)?> or <mouse down?>> then\n            wait until <not <mouse down?>>\n            if <touching (mouse-pointer v)?> then\n                broadcast (Start Transition v)\n            end\n        end\n    end\nend\n\nwhen I receive [start game v]\nset [deleteallclones? v] to [1]\nwait (0.0001) seconds\nset [deleteallclones? v] to [0]\n\nwhen I start as a clone\nforever\n    if <(DeleteAllClones?) = [1]> then\n        delete this clone\n    end\nend\n\nwhen I start as a clone\nif <(cloneID) = [7]> then\n\nwhen I receive [main menu v]\nhide\nBuild [5] Start [0]\n\n@Counter\n\ndefine text: (text) size: (size) go to x: (x) y: (y) spacing: (spacing) centered? (centered) textID: (textid)\nif <(centered) = [true]> then\n    go to x: ((((length of (text)) * ((spacing) * (size))) * (-0.5)) + (((spacing) * (size)) / (2))) y: (y)\nelse\n    go to x: (x) y: (y)\nend\nset size to (size) %\nset [idx v] to [1]\nrepeat (length of (text))\n    switch costume to (letter (idx) of (text))\n    set [cloneid v] to (textid)\n    create clone of (_myself_ v)\n    change [idx v] by (1)\n    change x by ((spacing) * (size))\nend\n\nwhen I start as a clone\ngo to [front v] layer\nshow\nclear graphic effects\nset [brightness v] effect to (100)\nset [clone x v] to (x position)\nset [clone y v] to (y position)\nif <(CloneID) = [1]> then\n    change y by (10)\nend\nforever\n    change x by (((clone x) - (x position)) / (5))\n    change y by (((clone y) - (y position)) / (5))\nend\n\nwhen I receive [delete number clones v]\ndelete this clone\n\nwhen I receive [start game v]\nset [updatecounter v] to ((Apples) + (1))\nhide\nforever\n    if <not <(updateCounter) = (Apples)>> then\n        broadcast (Delete number clones v)\n        text: (Apples) size: [150] go to x: [-210] y: [147] spacing: [0.10] centered? [false] textID: [1]\n        set [updatecounter v] to (Apples)\n    end\nend\n\nwhen I receive [level complete v]\nbroadcast (Delete number clones v)\n\n@Transition\n\nwhen I receive [start transition v]\ngo to [front v] layer\nbroadcast (Start Game v)\n\nwhen I receive [start transition v]\npoint in direction (90)\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (black v)\nset size to (100) %\nshow\nrepeat (5)\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #1 v)\n    turn right (1) degrees\nend\nset size to ((size) * (0.5)) %\nrepeat (2)\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #2 v)\n    turn right (2) degrees\nend\nrepeat (2)\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #3 v)\n    turn right (2) degrees\nend\nrepeat (3)\n    switch costume to (mini v)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #4 v)\n    turn right (1) degrees\nend\nrepeat (5)\n    set size to ((size) * (1.2)) %\n    switch costume to (mask #5 v)\n    switch costume to (mini v)\n    turn right (1) degrees\nend\nhide\n\nwhen I receive [main menu v]\nhide\ngo to [back v] layer\n\n@Safe Zones\n\nwhen flag clicked\nset [ghost v] effect to (100)\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@End Detector\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\nwhen I receive [change scene v]\nset [touching end detector? v] to [0]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (Scene #))\nforever\n    if <<touching (player v)?> and <not <(touching end detector?) = [1]>>> then\n        set [touching end detector? v] to [1]\n        broadcast (Level Complete v) and wait\n    end\nend\n\n@End Screen\n\nwhen I receive [main menu v]\ngo to [back v] layer\nhide variable [also apples v]\nhide\n\nwhen I receive [level complete v]\ngo to [front v] layer\nswitch costume to (pick random (1) to (8))\nshow variable [also apples v]\nshow\n\nwhen I receive [start game v]\nforever\n    set [also apples v] to (Apples)\nend\n\nwhen I receive [level complete v]\nwait (0.05) seconds\nplay sound [BeepBox-Song \(2\) v] until done\n\nwhen I receive [level complete v]\nstop all sounds\n\n