Kirby's Dreamland 3 - A Scrolling Platformer

Instructions: ---------------------------------------------------------------------\nUse arrows to move (↑ to jump, ← & →)\n---------------------------------------------------------------------\nTouch the right wall to get to the next level\n---------------------------------------------------------------------

@Stage\n\nwhen flag clicked\nset [level v] to [1]\n\nwhen flag clicked\nstart sound [2018-05-19_-_Video_Game_Adventure_-_David_Fesliyan.mp3 v]\n\n@Player\n\nwhen flag clicked\nshow\nshow variable [level v]\npoint in direction (90)\ngo to x: (-215) y: (-146)\nset [x velocity v] to [0]\nset [y velocity v] to [0]\nforever\n    Platform (12) (-1) (0.7) (2)\nend\n\ndefine None\nswitch costume to (hitbox v)\nif <key (right arrow v) pressed?> then\n    point in direction (90)\n    change [x velocity v] by (running speed)\nend\nif <key (left arrow v) pressed?> then\n    point in direction (-90)\n    change [x velocity v] by ((running speed) * (-1))\nend\nset [x velocity v] to ((X Velocity) * (friction))\nchange x by (X Velocity)\nif <touching (level v)?> then\n    set [slope v] to [0]\n    repeat until <<(Slope) = [8]> or <not <touching (level v)?>>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by ((Slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (X Velocity) ) )\n            if <touching (level v)?> then\n                change x by ((([abs v] of (X Velocity) ) / (X Velocity)) * (-1))\n            end\n        end\n        set [x velocity v] to [0]\n    end\nend\nchange y by (Y Velocity)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (Y Velocity) ) )\n        if <touching (level v)?> then\n            change y by ((([abs v] of (Y Velocity) ) / (Y Velocity)) * (-1))\n        end\n    end\n    if <<(([abs v] of (Y Velocity) ) / (Y Velocity)) = [-1]> and <key (up arrow v) pressed?>> then\n        set [y velocity v] to (jump height)\n    else\n        set [y velocity v] to [0]\n    end\nelse\n    change [y velocity v] by (-1)\nend\nswitch costume to (idle v)\nif <(Y Velocity) > [2]> then\n    switch costume to (jump v)\nend\nif <(Y Velocity) < [-3]> then\n    switch costume to (fall v)\nend\nif <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n    switch costume to (Walk)\nend\n\nwhen flag clicked\nset [walk v] to [5]\nforever\n    change [walk v] by (1)\n    if <(Walk) > [8]> then\n        set [walk v] to [5]\n    end\n    wait (0.05) seconds\nend\n\nwhen flag clicked\nforever\n    if <touching (flag v)?> then\n        go to x: (-215) y: (-146)\n        change [level v] by (1)\n        broadcast (idk v)\n    end\nend\n\nwhen flag clicked\nset [deaths v] to [0]\nforever\n    if <touching (spikes v)?> then\n        change [deaths v] by (1)\n        go to x: (-215) y: (-146)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [11]> then\n        hide\n    end\nend\n\nwhen flag clicked\nset [time v] to [0]\nforever\n    repeat until <(Level) = [11]>\n        wait (1) seconds\n        change [time v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#ff0000)?> then\n        change [deaths v] by (1)\n        go to x: (-215) y: (-146)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [11]> then\n        show variable [time v]\n        show variable [deaths v]\n        hide variable [level v]\n    else\n        hide variable [time v]\n        hide variable [deaths v]\n        hide variable [level v]\n    end\nend\n\nwhen flag clicked\nshow\nshow variable [level v]\n\nwhen flag clicked\nshow variable [level v]\n\n@Level\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    go to x: (0) y: (0)\n    if <(LEVEL) = [2]> then\n        broadcast (Change v)\n        switch costume to (2 v)\n    end\nend\n\nwhen I receive [yaya v]\nswitch costume to (2 v)\n\nwhen flag clicked\nswitch costume to (1 v)\n\nwhen I receive [idk v]\nnext costume\n\n@Flag\n\nwhen flag clicked\nforever\n    if <(Level) = [1]> then\n        go to x: (225) y: (37)\n    end\n    if <(Level) = [2]> then\n        go to x: (224) y: (-150)\n    end\n    if <(Level) = [3]> then\n        go to x: (231) y: (-82)\n    end\n    if <(Level) = [4]> then\n        go to x: (225) y: (101)\n    end\n    if <(Level) = [5]> then\n        go to x: (-75) y: (-34)\n    end\n    if <(Level) = [6]> then\n        go to x: (221) y: (106)\n    end\n    if <(Level) = [7]> then\n        go to x: (-210) y: (127)\n    end\n    if <(Level) = [8]> then\n        go to x: (-129) y: (111)\n    end\n    if <(Level) = [9]> then\n        go to x: (-207) y: (117)\n    end\n    if <(Level) = [10]> then\n        go to x: (211) y: (109)\n    end\n    if <(Level) = [11]> then\n        hide\n    end\nend\n\nwhen flag clicked\nshow\nforever\n    wait (0.05) seconds\n    next costume\n    if <touching (player v)?> then\n        broadcast (yaya v)\n    end\nend\n\n@Spikes\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if <(Level) = [1]> then\n        switch costume to (costume1 v)\n    end\n    if <(Level) = [2]> then\n        switch costume to (costume2 v)\n    end\n    if <(Level) = [3]> then\n        switch costume to (costume3 v)\n    end\n    if <(Level) = [4]> then\n        switch costume to (costume4 v)\n    end\n    if <(Level) = [5]> then\n        switch costume to (costume5 v)\n    end\n    if <(Level) = [6]> then\n        switch costume to (costume6 v)\n    end\n    if <(Level) = [7]> then\n        switch costume to (costume7 v)\n    end\n    if <(Level) = [8]> then\n        switch costume to (costume8 v)\n    end\n    if <(Level) = [9]> then\n        switch costume to (costume9 v)\n    end\n    if <(Level) = [10]> then\n        switch costume to (costume10 v)\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\ngo to [front v] layer\n\n