Around the world | Platformer

Instructions: --------------------------------About---------------------------------\n                             Hello scratchers! \nThis is my first project in scratch. It's a platformer. It's little laggy but I hope that you will like it :)\n\n----------------------------Instructions------------------------------\nArrow keys :)

@Stage\n\nwhen flag clicked\nforever\n    play sound [Unity v] until done\nend\n\nwhen flag clicked\nswitch backdrop to (intro v) and wait\nbroadcast (intro v)\n\nwhen I receive [city v]\nswitch backdrop to (city v)\n\nwhen I receive [next level v]\nnext backdrop\n\n@Player\n\nwhen I receive [city v]\nshow\nStart Position\ngo to [front v] layer\nshow\nset rotation style [left-right v]\nforever\n    if <(backdrop [number v]) = [22]> then\n        hide\n        broadcast (end v)\n        stop [other scripts in sprite v]\n    end\n    if <not <(backdrop [number v]) = [14]>> then\n        go to [front v] layer\n    end\n    if <<(x position) > [253]> and <<(backdrop [number v]) = [20]> and <(cash) = [10]>>> then\n        broadcast (next level v)\n        Start Position\n    end\n    if <<(x position) > [253]> and <not <(backdrop [number v]) = [20]>>> then\n        broadcast (next level v)\n        Start Position\n    end\n    if <key (up arrow v) pressed?> then\n        if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n            switch costume to (right-up v)\n        else\n            switch costume to (up v)\n        end\n    else\n        if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n            switch costume to (right v)\n        else\n            switch costume to (no v)\n        end\n    end\n    if <(backdrop [number v]) = [4]> then\n        change [y_vel v] by (-2)\n    else\n        if <(backdrop [number v]) = [17]> then\n            change [y_vel v] by (5)\n            if <key (up arrow v) pressed?> then\n                change [y_vel v] by (6)\n            end\n            if <key (down arrow v) pressed?> then\n                change [y_vel v] by (-7)\n            end\n            set [y_vel v] to ((y_vel) * (0.5))\n        else\n            if <(backdrop [number v]) = [11]> then\n                change [y_vel v] by (-0.8)\n                if <key (up arrow v) pressed?> then\n                    change [y_vel v] by (3)\n                end\n                if <key (down arrow v) pressed?> then\n                    change [y_vel v] by (-3)\n                end\n                set [y_vel v] to ((y_vel) * (0.5))\n            else\n                change [y_vel v] by (-1)\n            end\n        end\n    end\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        change [x_vel v] by (1)\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n        change [x_vel v] by (-1)\n    end\n    if <(backdrop [number v]) = [8]> then\n        change [x_vel v] by (-0.7)\n    end\n    if <(backdrop [number v]) = [7]> then\n        set [x_vel v] to ((x_vel) * (0.97))\n    else\n        set [x_vel v] to ((x_vel) * (0.9))\n    end\n    change x by (x_vel)\n    if <<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> then\n        change y by (1)\n        if <<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> then\n            change y by (1)\n            if <<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> then\n                change y by (1)\n                if <<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> then\n                    change y by (1)\n                    if <<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> then\n                        change y by (1)\n                        if <<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> then\n                            change y by (1)\n                            if <<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> then\n                                change y by (-6)\n                                if <not <(backdrop [number v]) = [11]>> then\n                                    if <key (up arrow v) pressed?> then\n                                        set [y_vel v] to [8]\n                                        if <(x_vel) > [0]> then\n                                            set [x_vel v] to [-10]\n                                        else\n                                            set [x_vel v] to [10]\n                                        end\n                                    else\n                                        change x by ((x_vel) * (-1.4))\n                                        set [x_vel v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y_vel)\n    if <<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> then\n        change y by ((y_vel) * (-1))\n        set [y_vel v] to [0]\n    end\n    change y by (-1)\n    if <not <(backdrop [number v]) = [11]>> then\n        if <<<touching (level v)?> or <<touching (move v)?> and <not <(backdrop [number v]) = [15]>>>> and <key (up arrow v) pressed?>> then\n            set [y_vel v] to [12]\n        end\n    end\n    if <<(x position) < [-253]> or <<touching (obstacles v)?> or <<(y position) = [210]> or <(y position) < [-175]>>>> then\n        Start Position\n    end\n    if <touching (trampoline v)?> then\n        set [y_vel v] to [20]\n    end\n    change y by (1)\nend\n\ndefine Start Position\nset [y_vel v] to [0]\nset [x_vel v] to [0]\nset size to (100) %\ngo to x: (-220) y: (100)\n\nwhen flag clicked\nhide\n\n@Intro\n\nwhen I receive [intro v]\nset [intro end v] to [0]\ngo to x: (20) y: (-100)\nshow\nreset timer\ncreate clone of (_myself_ v)\nswitch backdrop to (intro v)\nswitch costume to (1 v)\nset size to (20) %\nrepeat (130)\n    change size by (1)\n    next costume\n    change y by (0.3)\n    if <(costume [number v]) = [56]> then\n        switch costume to (1 v)\n    end\nend\ncreate clone of (_myself_ v)\nrepeat until <(intro end) = [1]>\n    next costume\n    if <(costume [number v]) = [56]> then\n        switch costume to (1 v)\n    end\nend\nhide\n\nwhen I start as a clone\nif <(timer) < [1]> then\n    switch costume to (kostým1 v)\n    set size to (100) %\n    go to x: (0) y: (0)\n    show\n    go to [front v] layer\n    wait until <(intro end) = [1]>\n    delete this clone\nelse\n    switch costume to (kostým2 v)\n    set size to (100) %\n    go to x: (0) y: (0)\n    show\n    go to [front v] layer\nend\nforever\n    set [brightness v] effect to (0)\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (-20)\n        if <mouse down?> then\n            wait until <not <mouse down?>>\n            broadcast (city v)\n            delete this clone\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [city v]\nset [intro end v] to [1]\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@Level\n\nwhen I receive [city v]\nshow\nswitch costume to (city v)\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@Obstacles\n\nwhen I receive [city v]\nshow\nswitch costume to (city v)\ngo to [front v] layer\n\nwhen flag clicked\nset rotation style [all around v]\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [next level v]\nshow\ngo to x: (0) y: (0)\nnext costume\nwait (0) seconds\nif <(backdrop [number v]) = [10]> then\n    hide\n    repeat until <(backdrop [number v]) = [11]>\n        wait (0.5) seconds\n        create clone of (_myself_ v)\n    end\n    show\nend\nif <(backdrop [number v]) = [12]> then\n    repeat until <(backdrop [number v]) = [13]>\n        go to x: (0) y: (0)\n        repeat until <<([x position v] of [player v]) = [-220]> or <(backdrop [number v]) = [13]>>\n            move (3) steps\n        end\n    end\nend\nif <(backdrop [number v]) = [15]> then\n    repeat until <(backdrop [number v]) = [16]>\n        go to x: (0) y: (0)\n        repeat until <<([x position v] of [player v]) = [-220]> or <(backdrop [number v]) = [13]>>\n            change y by (1.8)\n        end\n    end\nend\nif <(backdrop [number v]) = [16]> then\n    hide\n    repeat until <(backdrop [number v]) = [17]>\n        create clone of (_myself_ v)\n        wait (pick random (0.5) to (1.5)) seconds\n    end\n    broadcast (dlt clns v)\n    show\nend\nwait (0.2) seconds\nbroadcast (dlt clns v)\nif <(backdrop [number v]) = [18]> then\n    set rotation style [left-right v]\n    set [id v] to [0]\n    hide\n    repeat (2)\n        change [id v] by (1)\n        create clone of (_myself_ v)\n    end\n    wait until <(backdrop [number v]) = [19]>\n    set rotation style [all around v]\n    broadcast (dlt clns v)\n    show\nend\n\nwhen I start as a clone\nif <(backdrop [number v]) = [10]> then\n    show\n    go to x: (150) y: (50)\n    point towards (player v)\n    repeat until <<touching (_edge_ v)?> or <touching (level v)?>>\n        move (8) steps\n    end\n    delete this clone\nelse\n    if <(backdrop [number v]) = [18]> then\n        if <(id) = [1]> then\n            go to x: (-90) y: (-101)\n            show\n            forever\n                point in direction (-90)\n                glide (3) secs to x: (196) y: (-101)\n                point in direction (90)\n                glide (3) secs to x: (-90) y: (-101)\n            end\n        else\n            show\n            point in direction (90)\n            go to x: (110) y: (0)\n            forever\n                glide (2) secs to x: (110) y: (144)\n                glide (2) secs to x: (110) y: (0)\n            end\n        end\n    else\n        set [speed v] to [-1]\n        show\n        go to x: (pick random (-281) to (281)) y: (223)\n        set size to (pick random (60) to (100)) %\n        repeat until <(y position) < [-190]>\n            change [speed v] by (-1)\n            change y by (speed)\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [dlt clns v]\ndelete this clone\n\nbroadcast (dlt clns v)\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@Trampoline\n\nwhen I receive [city v]\nshow\nswitch costume to (city v)\ngo to [back v] layer\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@move\n\nwhen I receive [city v]\nshow\nswitch costume to (city v)\ngo to [front v] layer\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [next level v]\ngo to x: (0) y: (0)\nshow\nnext costume\nwait (0) seconds\nif <(backdrop [number v]) = [5]> then\n    set [move v] to [1]\n    repeat until <(move) = [0]>\n        glide (1.5) secs to x: (270) y: (0)\n        glide (1.5) secs to x: (0) y: (0)\n    end\nend\nif <(backdrop [number v]) = [7]> then\n    set [move v] to [1]\n    repeat until <(move) = [0]>\n        go to [front v] layer\n        glide (1.5) secs to x: (170) y: (0)\n        glide (1.5) secs to x: (0) y: (0)\n    end\nend\nif <(backdrop [number v]) = [15]> then\n    hide\n    set [move v] to [1]\n    repeat until <(move) = [0]>\n        create clone of (_myself_ v)\n        wait (pick random (0.01) to (0.2)) seconds\n    end\nend\nif <(backdrop [number v]) = [18]> then\n    show\n    create clone of (_myself_ v)\n    repeat until <(backdrop [number v]) = [19]>\n        wait until <not <([x position v] of [player v]) = [-220]>>\n        wait until <([x position v] of [player v]) = [-220]>\n        show\n        create clone of (_myself_ v)\n    end\nend\nif <(backdrop [number v]) = [19]> then\n    next costume\n    hide\n    delete all of [drips v]\n    repeat (5)\n        add [1] to [drips v]\n    end\n    set [id v] to [0]\n    go to x: (-38) y: (-8)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    go to x: (-100) y: (-53)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [id v] by (1)\n    go to x: (48) y: (-53)\n    create clone of (_myself_ v)\n    go to x: (132) y: (7)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    go to x: (205) y: (-152)\n    change [id v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [next level v]\n\nwhen I start as a clone\nif <(backdrop [number v]) = [18]> then\n    next costume\n    wait until <touching (player v)?>\n    broadcast (hide v)\n    delete this clone\nelse\n    if <(backdrop [number v]) = [19]> then\n        show\n        repeat until <(backdrop [number v]) = [20]>\n            if <(item (id) of [drips v]) = [0]> then\n                hide\n                wait until <(item (id) of [drips v]) = [1]>\n                show\n            end\n        end\n        delete this clone\n    else\n        set [speed v] to [-3]\n        go to [back v] layer\n        show\n        go to x: (pick random (-230) to (230)) y: (230)\n        repeat until <<(backdrop [number v]) = [16]> or <(y position) < [-180]>>\n            change y by (speed)\n            change [speed v] by (-1)\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [hide v]\nhide\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@salt pan special\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nset [nxt v] to [0]\nwait (0.1) seconds\nif <(backdrop [number v]) = [6]> then\n    set [nxt v] to [1]\n    go to [front v] layer\n    show\n    switch costume to (kostým1 v)\n    create clone of (_myself_ v)\n    repeat until <(nxt) = [0]>\n        go to x: ([x position v] of [player v]) y: (([abs v] of ([y position v] of [player v]) ) * (-1))\n    end\nend\n\nwhen I start as a clone\ngo to x: (0) y: (0)\nswitch costume to (kostým2 v)\nshow\ngo to [front v] layer\nwait until <(nxt) = [0]>\ndelete this clone\n\nwhen I receive [next level v]\n\nset [nxt v] to [0]\n\nwhen flag clicked\nforever\n    if <(nxt) = [0]> then\n        hide\n    end\nend\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@Darkness\n\nwhen flag clicked\nhide\nforever\n    if <(backdrop [number v]) = [13]> then\n        show\n        go to (player v)\n        go to [front v] layer\n    else\n        hide\n    end\nend\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@Bamboo \n\nwhen flag clicked\nhide\nforever\n    f\nend\n\ndefine f\ngo to x: (0) y: (0)\nif <(backdrop [number v]) = [14]> then\n    show\n    go to [front v] layer\nelse\n    hide\nend\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@dripleaf\n\nwhen flag clicked\nwait (1) seconds\nhide\nswitch costume to (costume1 v)\nwait until <(backdrop [number v]) = [19]>\nwait (0.3) seconds\nset [id v] to [1]\ngo to x: (-38) y: (-8)\ncreate clone of (_myself_ v)\ngo to x: (-100) y: (-53)\nchange [id v] by (1)\ncreate clone of (_myself_ v)\ngo to x: (48) y: (-53)\nchange [id v] by (1)\ncreate clone of (_myself_ v)\nchange [id v] by (1)\ngo to x: (132) y: (7)\ncreate clone of (_myself_ v)\nchange [id v] by (1)\ngo to x: (205) y: (-152)\ncreate clone of (_myself_ v)\nwait until <(backdrop [number v]) = [20]>\nswitch costume to (costume2 v)\nwait (0.25) seconds\nrepeat until <(backdrop [number v]) = [21]>\n    set [cash v] to [0]\n    go to x: (-184) y: (-153)\n    create clone of (_myself_ v)\n    go to x: (-111) y: (160)\n    create clone of (_myself_ v)\n    go to x: (-111) y: (120)\n    create clone of (_myself_ v)\n    go to x: (102) y: (146)\n    create clone of (_myself_ v)\n    go to x: (-158) y: (156)\n    create clone of (_myself_ v)\n    go to x: (-17) y: (-80)\n    create clone of (_myself_ v)\n    go to x: (142) y: (-83)\n    create clone of (_myself_ v)\n    go to x: (86) y: (-148)\n    create clone of (_myself_ v)\n    go to x: (14) y: (15)\n    create clone of (_myself_ v)\n    go to x: (218) y: (129)\n    create clone of (_myself_ v)\n    wait until <<(backdrop [number v]) = [21]> or <not <([x position v] of [player v]) = [-220]>>>\n    wait until <<(backdrop [number v]) = [21]> or <([x position v] of [player v]) = [-220]>>\n    broadcast (dlt clns v)\nend\n\nwhen I start as a clone\nif <(backdrop [number v]) = [20]> then\n    show\n    forever\n        if <(backdrop [number v]) = [21]> then\n            delete this clone\n        end\n        if <touching (player v)?> then\n            change [cash v] by (1)\n            delete this clone\n        end\n    end\nelse\n    show\n    set [ghost v] effect to (100)\n    repeat until <(backdrop [number v]) = [20]>\n        wait until <<touching (player v)?> or <(backdrop [number v]) = [20]>>\n        if <(backdrop [number v]) = [20]> then\n            delete this clone\n        end\n        wait (0) seconds\n        replace item (id) of [drips v] with [0]\n        set [ghost v] effect to (0)\n        wait (2) seconds\n        replace item (id) of [drips v] with [1]\n        set [ghost v] effect to (100)\n    end\n    delete this clone\nend\n\nwhen I receive [dlt clns v]\ndelete this clone\n\nbroadcast (next level v)\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@Trail\n\nwhen I start as a clone\nset [ghost v] effect to (20)\nrepeat (20)\n    change [ghost v] effect by (4)\n    change size by (-5)\nend\ndelete this clone\n\nwhen I receive [city v]\nforever\n    show\n    set size to (100) %\n    set [ghost v] effect to (100)\n    go to (player v)\n    wait (0) seconds\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nhide\nclear graphic effects\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n@thumb\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\ngo to [front v] layer\n\n@end\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nshow\n\n