Worlds - A platformer

Instructions: After 50+ hours of work, I present to you... Worlds - A platformer! Please love, favorite, and follow @sciencedolphin9! Thank you! This is just a platformer engine, but still check it out!\nIt contains:\n- All collisions\n- Spikes\n- Moving Lava\n- Player Animation\n- Different Worlds\n- Much much more!\n---How To Play---\nWASD or arrow keys to move. \nI kept no wall jumping on purpose but if you want I can still add it. \nGet to the right edge of the screen for the next level.\nAvoid lava and spikes\n1, 2, 3, and 4 to switch between different worlds.\nT to show the thumbnail (Just a warning it will stop everything because I don't want people to play and have the thumbnail showing.)\n---Credits---\nFor the first time in all my games, I have no credits (except for the thumbnail next)! 100% code and art is from me! I made most of the art in vector, with some additional changes in bitmap. \nCooltext.com for the "Worlds A Platformer" on the thumbnail/\n---What I Am Working On--- \n[I will not add anything as of May 2021]\nThis is probably the best project I have made in scratch, so I will probably keep on adding lots of stuff to it. This is what I will add:\n- Trampolines\n- Saws\n- Bosses/Bossfights\n- More Worlds\n- More skins (For different worlds)\n-Mobile\n- More! (Please comment for ideas and suggestions! If you comment, there is a higher chance I will add it because user suggestions always add what they want more and is more fun!)\n---Lag---\nIf you experience lag please tell what happened in the comments and use this turbowarp link: https://turbowarp.org/521385332\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n---Tags---\n#All #Games #Platformer #Art #Animation #Engine #Best\n#Remix #Friendly

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nforever\n    switch backdrop to (World #)\nend\n\n@player\n\ndefine Respawn (x) (y)\ngo to x: (x) y: (y)\nset [sy v] to [0]\nset [sx v] to [0]\n\ndefine Tick <ceiling>\nchange [in air v] by (1)\nrepeat until <not <touching (level v)?>>\n    if <ceiling> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [in air v] to [0]\n    end\n    set [sy v] to [0]\nend\n\ndefine Walk\nrepeat until <<(wall angle) = [4]> or <not <touching (level v)?>>>\n    change y by (1)\n    change [wall angle v] by (1)\nend\nif <(wall angle) = [4]> then\n    change x by ((0) - (sx))\n    change y by (-4)\nend\nif <(x position) < [-220]> then\n    set x to (-220)\nend\nif <(x position) > [221]> then\n    set x to (221)\nend\nchange [sx v] by ((<<key (d v) pressed?> or <key (right arrow v) pressed?>> - <<key (a v) pressed?> or <key (left arrow v) pressed?>>) * (2))\nset [sx v] to ((sx) * (0.8))\nif <(<<key (d v) pressed?> or <key (right arrow v) pressed?>> - <<key (a v) pressed?> or <key (left arrow v) pressed?>>) = [1]> then\n    switch costume to (moving player v)\n    point in direction (90)\nend\nset [wall angle v] to [0]\nif <(<<key (a v) pressed?> or <key (left arrow v) pressed?>> - <<key (d v) pressed?> or <key (right arrow v) pressed?>>) = [1]> then\n    switch costume to (moving player v)\n    point in direction (-90)\nend\nif <(<<key (a v) pressed?> or <key (left arrow v) pressed?>> - <<key (d v) pressed?> or <key (right arrow v) pressed?>>) = [0]> then\n    switch costume to (still player v)\n    point in direction (0)\nend\n\nwhen I receive [start game loop v]\nset [in air v] to [10]\nforever\n    change [sy v] by (-1)\n    change y by (sy)\n    change x by (sx)\n    Walk\n    Tick <(sy) > [0]>\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <[3] > (in air)>> then\n        set [sy v] to [13]\n    end\n    Next Level Check\n    Respawn Check\n    create clone of (_myself_ v)\nend\n\ndefine Respawn Check\nif <<touching (spike v)?> or <touching (lava v)?>> then\n    stop [other scripts in sprite v]\n    repeat (25)\n        change [ghost v] effect by (4)\n    end\n    Respawn [-180] [0]\n    wait (0.5) seconds\n    repeat (25)\n        change [ghost v] effect by (-4)\n    end\n    broadcast (Start Game Loop v)\nend\n\ndefine Next Level Check\nif <[220] < (x position)> then\n    stop [other scripts in sprite v]\n    repeat (25)\n        change [ghost v] effect by (4)\n    end\n    change [level # v] by (1)\n    if <(Level #) = [2]> then\n        Respawn [-200] [0]\n    else\n        Respawn [-180] [0]\n    end\n    wait (0.5) seconds\n    repeat (25)\n        change [ghost v] effect by (-4)\n    end\n    broadcast (Start Game Loop v)\nend\n\nwhen I start as a clone\nswitch costume to (blank v)\nrepeat (20)\n    change size by (-5)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen I receive [green flag v]\nRespawn [-180] [0]\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nbroadcast (Start Game Loop v) and wait\n\nwhen flag clicked\nhide\n\n@Level\n\nwhen flag clicked\nforever\n    switch costume to ((Level #) + (2))\nend\n\n@Lava\n\nwhen flag clicked\nforever\n    switch costume to (Level #)\n    if <(costume [number v]) = [1]> then\n        go to x: (([cos v] of (((timer) - (3)) * (200)) ) * (50)) y: (0)\n    else\n        go to x: (0) y: ((([cos v] of (((timer) - (3)) * (200)) ) * (7)) - (10))\n    end\n    if <<<(World #) = [2]> or <<(World #) = [3]> or <(World #) = [4]>>> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [back v] layer\n    end\nend\n\n@Spike\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level #)\nend\n\n@Type 2 Level\n\nwhen flag clicked\nforever\n    switch costume to ((Level #) + (1))\n    if <<<(World #) = [1]> or <(World #) = [3]>> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [back v] layer\n    end\n    if <<(World #) = [2]> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [front v] layer\n    end\nend\n\n@Type 2 Lava\n\nwhen flag clicked\nforever\n    switch costume to (Level #)\n    if <(costume [number v]) = [1]> then\n        go to x: (([cos v] of (((timer) - (3)) * (200)) ) * (50)) y: (0)\n    else\n        go to x: (0) y: ((([cos v] of (((timer) - (3)) * (200)) ) * (7)) - (10))\n    end\n    if <<<(World #) = [1]> or <(World #) = [4]>> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [back v] layer\n    end\nend\n\n@Type 2 Spike\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level #)\n    if <<<(World #) = [1]> or <(World #) = [3]>> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [back v] layer\n    end\n    if <<<(World #) = [2]> or <(World #) = [4]>> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [front v] layer\n    end\nend\n\n@Type 4 Level\n\nwhen flag clicked\nforever\n    switch costume to ((Level #) + (1))\n    if <<<(World #) = [1]> or <<(World #) = [2]> or <(World #) = [3]>>> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [back v] layer\n    end\n    if <<(World #) = [4]> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [front v] layer\n    end\nend\n\n@Type 4 Lava\n\nwhen flag clicked\nforever\n    switch costume to (Level #)\n    if <(costume [number v]) = [1]> then\n        go to x: (([cos v] of (((timer) - (3)) * (200)) ) * (50)) y: (0)\n    else\n        go to x: (0) y: ((([cos v] of (((timer) - (3)) * (200)) ) * (7)) - (10))\n    end\n    if <<<(World #) = [1]> or <<(World #) = [2]> or <(World #) = [3]>>> and <not <(STOP EVERYTHING BUT INTRO) = [1]>>> then\n        go to [back v] layer\n    end\nend\n\n@Text\n\nwhen I receive [green flag v]\nset [green flag v] to [1]\nforever\n    if <(Darkness text) = [1]> then\n        set [brightness v] effect to (100)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen flag clicked\nset [green flag v] to [0]\nforever\n    switch costume to (Level #)\n    if <(World #) = [4]> then\n        set [darkness text v] to [1]\n    else\n        set [darkness text v] to [0]\n    end\n    if <(green flag) = [0]> then\n        hide\n    else\n        show\n    end\nend\n\n@World Setter\n\nwhen I receive [green flag v]\nforever\n    if <key (1 v) pressed?> then\n        set [world # v] to [1]\n    end\n    if <key (2 v) pressed?> then\n        set [world # v] to [2]\n    end\n    if <key (3 v) pressed?> then\n        set [world # v] to [3]\n    end\n    if <key (4 v) pressed?> then\n        set [world # v] to [4]\n    end\nend\n\n@intro\n\nwhen flag clicked\nset [stop everything but intro v] to [0]\nswitch costume to (blank fader v)\nset [level # v] to [1]\nrepeat (4)\n    set [world # v] to [1]\n    wait (0.4) seconds\n    set [world # v] to [2]\n    wait (0.4) seconds\n    set [world # v] to [3]\n    wait (0.4) seconds\n    set [world # v] to [4]\n    wait (0.4) seconds\nend\nset [stop everything but intro v] to [1]\ncreate clone of (_myself_ v)\nwait (4) seconds\nrepeat (4)\n    next costume\n    create clone of (_myself_ v)\nend\nnext costume\nwait (4) seconds\nrepeat (3)\n    create clone of (_myself_ v)\n    wait (0.7) seconds\nend\nwait (2) seconds\nnext costume\ncreate clone of (_myself_ v)\nnext costume\nwait (1) seconds\nrepeat (10)\n    create clone of (_myself_ v)\n    wait (0.7) seconds\nend\nwait (1) seconds\nset [stop everything but intro v] to [0]\nset [stop intro v] to [1]\nbroadcast (Green Flag v) and wait\n\nwhen flag clicked\nforever\n    hide\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nif <(costume [number v]) = [1]> then\n    set size to (100) %\n    set [ghost v] effect to (100)\n    repeat (100)\n        change [ghost v] effect by (-1)\n    end\nend\nif <(costume [number v]) = [2]> then\n    go to x: (-220) y: (0)\n    set [ghost v] effect to (50)\n    repeat (50)\n        change [ghost v] effect by (-1)\n    end\n    repeat (10)\n        change x by (22)\n    end\nend\nif <(costume [number v]) = [3]> then\n    go to x: (220) y: (0)\n    set [ghost v] effect to (50)\n    repeat (50)\n        change [ghost v] effect by (-1)\n    end\n    repeat (10)\n        change x by (-22)\n    end\n    delete this clone\nend\nif <(costume [number v]) = [4]> then\n    go to x: (0) y: (180)\n    set [ghost v] effect to (50)\n    repeat (50)\n        change [ghost v] effect by (-1)\n    end\n    repeat (10)\n        change y by (-18)\n    end\n    delete this clone\nend\nif <(costume [number v]) = [5]> then\n    go to x: (0) y: (-180)\n    set [ghost v] effect to (50)\n    repeat (50)\n        change [ghost v] effect by (-1)\n    end\n    repeat (10)\n        change y by (18)\n    end\n    delete this clone\nend\nif <(costume [number v]) = [2]> then\n    wait (1) seconds\n    repeat (25)\n        change size by (2)\n    end\nend\nif <(costume [number v]) = [6]> then\n    set size to (0) %\n    repeat (25)\n        change size by (20)\n    end\n    delete this clone\nend\nif <(costume [number v]) = [2]> then\n    wait (4) seconds\n    repeat (5)\n        change y by (7)\n    end\nend\nif <(costume [number v]) = [7]> then\n    set size to (0) %\n    go to x: (0) y: (-20)\n    repeat (25)\n        change size by (2)\n    end\nend\nif <(costume [number v]) = [8]> then\n    set size to (0) %\n    repeat (25)\n        change size by (10)\n    end\n    delete this clone\nend\nif <(costume [number v]) = [2]> then\n    wait (9) seconds\n    delete this clone\nend\nif <(costume [number v]) = [1]> then\n    wait (17.75) seconds\n    delete this clone\nend\nif <(costume [number v]) = [7]> then\n    wait (7.9) seconds\n    delete this clone\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\nwhen [t v] key pressed\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (final thumbnail v)\nshow\nstop [all v]\n\n