Duck Obby - A Top Down Platformer


@Stage\n\nwhen flag clicked\nforever\n    play sound [Super_Mario_3D_Land_Music_Title_Sc_\(getmp2 v] until done\nend\n\nwhen I receive [start all v]\nif <(stage) = [1]> then\n    switch backdrop to (backdrop1 v)\n    play sound [Ripple Field 1 - Kirby's Dream Land 2 v] until done\n    forever\n        play sound [Ripple Field 1 - Kirby's Dream Land 3 v] until done\n    end\nelse\n    switch backdrop to (backdrop2 v)\n    play sound [Challenge_Stage_-_Kirbys_Return_to_\(getmp2 v] until done\n    forever\n        play sound [Challenge_Stage_-_Kirbys_Return_to_\(getmp3 v] until done\n    end\nend\n\nwhen I receive [play v]\nstop [other scripts in sprite v]\nif <(stage) = [1]> then\n    switch backdrop to (backdrop1 v)\nelse\n    switch backdrop to (backdrop2 v)\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I receive [death v]\nstop [other scripts in sprite v]\nset [speedy v] to [0]\nstart sound [deaht sound  v]\nswitch costume to (costume3 v)\nrepeat until <(size) < [100]>\n    change size by (-2)\n    turn right (10) degrees\nend\ngo to [back v] layer\nrepeat until <(size) < [10]>\n    change size by (-2)\n    turn right (10) degrees\nend\nbroadcast (respawn v)\n\nwhen I receive [respawn v]\nstart sound [Teleport2 v]\nset [time: v] to [0]\nset [speedy v] to [0]\nreset timer\nshow\ngo to [front v] layer\nset size to (100) %\nswitch costume to (costume1 v)\nbroadcast (reset v)\nforever\n    point towards (mouse-pointer v)\n    turn right (90) degrees\n    if <(speedy) = [1]> then\n        set [walking v] to [1]\n        set [momentum v] to [12]\n    else\n        if <mouse down?> then\n            set [walking v] to [1]\n            if <(momentum) < [7]> then\n                change [momentum v] by (0.5)\n            else\n                set [momentum v] to [7]\n            end\n        else\n            set [walking v] to [0]\n            if <(momentum) > [0]> then\n                change [momentum v] by (-0.5)\n            else\n                set [momentum v] to [0]\n            end\n        end\n    end\nend\n\nwhen I receive [respawn v]\nset [speedy v] to [0]\nforever\n    if <<<key (space v) pressed?> or <(jumping button) > [0]>> and <(size) < [105]>> then\n        start sound [Big Boing v]\n        set [jump grav v] to [10]\n        repeat (21)\n            change size by (jump grav)\n            change [jump grav v] by (-1)\n        end\n        set size to (100) %\n    end\nend\n\nwhen I receive [play v]\nshow\nset size to (100) %\nswitch costume to (costume1 v)\n\nforever\n    point towards (mouse-pointer v)\n    turn right (90) degrees\n    if <(speedy) = [1]> then\n        set [walking v] to [1]\n        set [momentum v] to [15]\n    else\n        if <mouse down?> then\n            set [walking v] to [1]\n            if <(momentum) < [7]> then\n                change [momentum v] by (0.5)\n            else\n                set [momentum v] to [7]\n            end\n        else\n            set [walking v] to [0]\n            if <(momentum) > [0]> then\n                change [momentum v] by (-0.5)\n            else\n                set [momentum v] to [0]\n            end\n        end\n    end\nend\n\nwhen I receive [trampoline v]\nset size to (100) %\nstart sound [Big Boing v]\nchange [momentum v] by (5)\nset [jump grav v] to [20]\nrepeat (41)\n    change size by (jump grav)\n    change [jump grav v] by (-1)\nend\nset size to (100) %\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I receive [respawn v]\nshow\nswitch costume to (costume7 v)\nset [walking v] to [1]\nrepeat (10)\n    go to (sprite1 v)\n    point in direction ([direction v] of [sprite1 v])\n    set size to ([size v] of [sprite1 v]) %\n    if <(walking) = [1]> then\n        next costume\n        next costume\n    end\nend\nforever\n    go to (sprite1 v)\n    point in direction ([direction v] of [sprite1 v])\n    set size to ([size v] of [sprite1 v]) %\n    if <(walking) = [1]> then\n        next costume\n        next costume\n    end\n    if <<<<touching (sprite4 v)?> and <([costume # v] of [sprite4 v]) = ((stage) * (2))>> and <not <touching (sprite5 v)?>>> and <([size v] of [sprite1 v]) < [101]>> then\n        broadcast (death v)\n        hide\n        stop [this script v]\n    end\n    if <<<<touching (sprite5 v)?> and <([costume # v] of [sprite5 v]) = ((stage) * (2))>> and <not <touching (sprite4 v)?>>> and <([size v] of [sprite1 v]) < [101]>> then\n        broadcast (death v)\n        hide\n        stop [this script v]\n    end\n    if <<not <touching (sprite3 v)?>> and <<not <touching (sprite4 v)?>> and <<not <touching (sprite5 v)?>> and <([size v] of [sprite1 v]) < [101]>>>> then\n        broadcast (death v)\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nforever\n    go to (sprite1 v)\n    point in direction ([direction v] of [sprite1 v])\n    set size to ([size v] of [sprite1 v]) %\n    switch costume to (costume7 v)\nend\n\n\n    broadcast (death v)\n    hide\n    stop [this script v]\nend\n\nwhen I receive [play v]\nshow\ngo to (sprite1 v)\npoint in direction ([direction v] of [sprite1 v])\ngo [backward v] (2) layers\nset size to ([size v] of [sprite1 v]) %\nswitch costume to (costume7 v)\nset [momentum v] to [0]\nif <(stage) > [1]> then\n    broadcast (countdown v) and wait\nend\nwait (0) seconds\nbroadcast (start all v)\nbroadcast (respawn v)\n\n@Sprite3\n\nwhen flag clicked\nhide\n\nwhen I receive [respawn v]\ngo to x: (975) y: (0)\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nglide (0.5) secs to x: (-1127) y: (697)\n\nwhen I receive [play v]\nhide\nset size to (100) %\nswitch costume to (costume2 v)\nset size to (500) %\nswitch costume to (join [stage] (stage))\ngo to x: (975) y: (0)\ngo to [back v] layer\nset rotation style [don't rotate v]\nshow\nforever\n    point in direction ([direction v] of [sprite1 v])\n    turn right (90) degrees\n    move (momentum) steps\nend\n\n@Sprite4\n\nwhen flag clicked\nhide\n\ndefine change1\nrepeat (2)\n    set [brightness v] effect to (100)\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    wait (0.2) seconds\nend\nswitch costume to (join [stage] (join (stage) [b]))\n\ndefine change2\nrepeat (2)\n    set [brightness v] effect to (100)\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    wait (0.2) seconds\nend\nswitch costume to (join [stage] (join (stage) [a]))\n\nwhen I receive [platforms v]\nhide\nset size to (100) %\nswitch costume to (costume2 v)\nset size to (500) %\nswitch costume to (join [stage] (join (stage) [a]))\ngo to x: (0) y: (0)\ngo to [back v] layer\nset rotation style [don't rotate v]\nshow\nforever\n    go to (sprite3 v)\nend\n\nwhen I receive [start all v]\nswitch costume to (join [stage] (join (stage) [a]))\nforever\n    wait (1) seconds\n    change1\n    wait (1) seconds\n    change2\nend\n\nwhen I receive [reset v]\nstop [other scripts in sprite v]\nbroadcast (platforms v)\nswitch costume to (join [stage] (join (stage) [a]))\nforever\n    wait (1) seconds\n    change1\n    wait (1) seconds\n    change2\nend\n\n@Sprite5\n\nwhen flag clicked\nhide\n\ndefine change1\nrepeat (2)\n    set [brightness v] effect to (100)\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    wait (0.2) seconds\nend\nswitch costume to (join [stage] (join (stage) [b]))\n\ndefine change2\nrepeat (2)\n    set [brightness v] effect to (100)\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    wait (0.2) seconds\nend\nswitch costume to (join [stage] (join (stage) [a]))\n\nwhen I receive [platforms v]\nhide\nset size to (100) %\nswitch costume to (costume3 v)\nset size to (500) %\nswitch costume to (join [stage] (join (stage) [b]))\ngo to x: (0) y: (0)\ngo to [back v] layer\nset rotation style [don't rotate v]\nshow\nforever\n    go to (sprite3 v)\nend\n\nwhen I receive [start all v]\nswitch costume to (join [stage] (join (stage) [b]))\nforever\n    wait (1) seconds\n    change2\n    wait (1) seconds\n    change1\nend\n\nwhen I receive [reset v]\nstop [other scripts in sprite v]\nbroadcast (platforms v)\nswitch costume to (join [stage] (join (stage) [b]))\nforever\n    wait (1) seconds\n    change2\n    wait (1) seconds\n    change1\nend\n\n@Sprite6\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nplay sound [Triumph v] until done\nstop [all v]\n\nwhen I receive [play v]\nshow\nset size to (100) %\nswitch costume to (costume2 v)\nset size to (500) %\nswitch costume to (costume3 v)\ngo to x: (0) y: (0)\ngo to [back v] layer\ngo [forward v] (3) layers\nset rotation style [don't rotate v]\nrepeat (10)\n    go to (sprite3 v)\nend\nrepeat until <touching (sprite2 v)?>\n    go to (sprite3 v)\nend\nbroadcast (win v)\nforever\n    go to (sprite3 v)\nend\n\n@Sprite11\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nshow\nset size to (100) %\nswitch costume to (costume2 v)\nset size to (500) %\nswitch costume to (join [stage] (stage))\ngo to x: (0) y: (0)\ngo to [back v] layer\ngo [forward v] (3) layers\nset rotation style [don't rotate v]\nrepeat (10)\n    go to (sprite3 v)\nend\nforever\n    go to (sprite3 v)\n    if <<touching (sprite2 v)?> and <([size v] of [sprite1 v]) < [105]>> then\n        broadcast (trampoline v)\n    end\nend\n\n@Sprite7\n\n@Sprite8\n\nwhen flag clicked\nhide\n\ngo to [front v] layer\nshow\n\n@Sprite9\n\nwhen flag clicked\ngo to x: (0) y: (90)\nshow\nforever\n    glide (1) secs to x: (0) y: (70)\n    glide (1) secs to x: (0) y: (90)\nend\n\nwhen I receive [play v]\nstop [other scripts in sprite v]\nhide\n\n@Sprite10\n\nwhen flag clicked\ngo to x: (0) y: (-100)\nshow\nforever\n    glide (1) secs to x: (0) y: (-110)\n    glide (1) secs to x: (0) y: (-100)\nend\n\nwhen I receive [play v]\nstop [other scripts in sprite v]\nhide\n\nwhen this sprite clicked\nset [stage v] to [1]\nif <(mouse x) > [0]> then\n    set [stage v] to [2]\nend\nbroadcast (play v)\n\n@Sprite12\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nshow\nset size to (100) %\nswitch costume to (costume2 v)\nset size to (500) %\nswitch costume to (join [stage] (stage))\ngo to x: (0) y: (0)\ngo to [back v] layer\ngo [forward v] (3) layers\nset rotation style [don't rotate v]\nrepeat (10)\n    go to (sprite3 v)\nend\nbroadcast (speed thinge v)\nforever\n    go to (sprite3 v)\nend\n\nwhen I receive [speed thinge v]\nforever\n    if <<touching (sprite2 v)?> and <([size v] of [sprite1 v]) < [105]>> then\n        start sound [Ricochet v]\n        set [speedy v] to [1]\n        wait until <not <touching (sprite2 v)?>>\n        wait (1) seconds\n        set [speedy v] to [0]\n    end\nend\n\n@3/2/1\n\nwhen I receive [countdown v]\nstop [other scripts in sprite v]\nswitch costume to (costume1 v)\nrepeat (3)\n    start sound [Collect v]\n    go to [front v] layer\n    clear graphic effects\n    show\n    go to [front v] layer\n    wait (0.5) seconds\n    repeat (10)\n        go to [front v] layer\n        change [ghost v] effect by (5)\n    end\n    next costume\nend\nstart sound [Collect2 v]\ngo to [front v] layer\nclear graphic effects\nshow\nwait (0.5) seconds\nrepeat (4)\n    go to [front v] layer\n    change [ghost v] effect by (25)\nend\nnext costume\nhide\n\nwhen flag clicked\nhide\n\n@Sprite13\n\nwhen flag clicked\nset [time: v] to [0]\nhide variable [time: v]\nhide variable [your time: v]\nhide variable [☁ world record \(challenge\): v]\n\nwhen I receive [start all v]\nif <(stage) > [1]> then\n    reset timer\n    show variable [time: v]\n    forever\n        set [time: v] to (timer)\n    end\nend\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\nif <(stage) > [1]> then\n    hide variable [time: v]\n    set [your time: v] to (Time:)\n    show variable [your time: v]\n    if <(stage) = [2]> then\n        show variable [☁ world record \(challenge\): v]\n        if <<(Your Time:) < (☁ World Record \(Challenge\):)> and <(Your Time:) > [20]>> then\n            start sound [Clapping v]\n            set [☁ world record \(challenge\): v] to (Your Time:)\n        end\n    end\nend\n\n@dumb ad\n\nwhen flag clicked\nif <(ad) = [1]> then\n    go to x: (0) y: (0)\n    show\n    wait until <<touching (mouse-pointer v)?> and <mouse down?>>\n    set [ad v] to [0]\n    stop [other scripts in sprite v]\n    glide (0.2) secs to x: (180) y: (0)\n    hide\nelse\n    hide\nend\n\nset [ad v] to [1]\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    glide (1) secs to x: (0) y: (-5)\n    glide (1) secs to x: (0) y: (0)\nend\n\nwhen I receive [play v]\nstop [other scripts in sprite v]\nhide\n\n@boing button\n\nwhen I receive [play v]\nif <(mobile controls) = [1]> then\n    set [jumping button v] to [0]\n    show\n    forever\n        if <<touching (mouse-pointer v)?> and <mouse down?>> then\n            set [brightness v] effect to (-10)\n            set [ghost v] effect to (70)\n            set [jumping button v] to [1]\n        else\n            set [brightness v] effect to (0)\n            set [ghost v] effect to (50)\n            set [jumping button v] to [0]\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\n@Sprite14\n\nwhen flag clicked\nset [mobile controls v] to [0]\nswitch costume to (join [costume] (mobile controls))\ngo to x: (0) y: (-5)\nshow\nforever\n    glide (1) secs to x: (0) y: (0)\n    glide (1) secs to x: (0) y: (-5)\nend\n\nwhen I receive [play v]\nstop [other scripts in sprite v]\nhide\n\nwhen this sprite clicked\nset [mobile controls v] to ((1) - (mobile controls))\nswitch costume to (join [costume] (mobile controls))\n\n