-|Simple Platformer|-
@Stage\n\nwhen I receive [door opened v]\nswitch backdrop to (next backdrop v)\n\nwhen flag clicked\nswitch backdrop to (download \(4\) v)\n\nwhen flag clicked\n\nif <(Level) = [50]> then\n\n@player\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (kostým1 v)\nshow\nshow variable [keys v]\nshow variable [level v]\nhide variable [time v]\nhide variable [deaths v]\nset [time v] to [0]\nset [deaths v] to [0]\nset [y velocity v] to [0]\nset [x velocity v] to [0]\ngo to x: (-214) y: (-100)\nforever\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <<(mouse x) > [0]> or <(mouse x) = [0]>>>> then\n        change [x velocity v] by (1)\n        switch costume to (kostým1 v)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <<(mouse x) < [0]> or <(mouse x) = [0]>>>> then\n        change [x velocity v] by (-1)\n        switch costume to (kostým2 v)\n    end\n    set [x velocity v] to ((X velocity) * (.9))\n    change x by (X velocity)\n    change [y velocity v] by (-1)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                    end\n                    if <touching (level v)?> then\n                        change x by ((X velocity) * (-1))\n                        change y by (-5)\n                        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> then\n                            if <(X velocity) > [0]> then\n                                set [x velocity v] to [-5]\n                            else\n                                set [x velocity v] to [5]\n                            end\n                            set [y velocity v] to [10]\n                        else\n                            set [x velocity v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Y velocity)\n    if <touching (level v)?> then\n        change y by ((Y velocity) * (-1))\n        set [y velocity v] to [0]\n    end\n    change y by (-1)\n    if <touching (level v)?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> then\n            change [y velocity v] by (10)\n        end\n    end\n    change y by (1)\n    if <(x position) > [210]> then\n        go to x: (-214) y: (-100)\n        change [level v] by (1)\n        set [y velocity v] to [0]\n        set [x velocity v] to [0]\n    end\n    if <touching (lava! v)?> then\n        go to x: (-214) y: (-100)\n        change [deaths v] by (1)\n    end\n    if <(Level) = [17]> then\n        hide variable [keys v]\n        hide variable [level v]\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    wait (1) seconds\n    change [time v] by (1)\nend\n\nwhen I receive [door opened v]\ngo to x: (-214) y: (-100)\n\n@doors\n\nwhen flag clicked\ngo to x: (231) y: (92)\nhide\ngo to [back v] layer\nforever\n    if <touching (player v)?> then\n        think [you need a key to unlock this door. Press space to unlock] for (1) seconds\n    end\n    if <<touching (player v)?> and <<(keys) > [1]> or <(keys) = [1]>>> then\n        if <key (space v) pressed?> then\n            broadcast (door opened v)\n        end\n    end\n    if <(Level) = [6]> then\n        show\n    end\n    if <(Level) = [11]> then\n        show\n    end\n    if <(Level) = [16]> then\n        show\n        go to x: (225) y: (6)\n    end\n    if <(Level) = [17]> then\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [door opened v]\nhide\nchange [keys v] by (-1)\nchange [level v] by (1)\n\n@Arrow1\n\nwhen flag clicked\ngo to x: (-187) y: (-140)\nhide\n\nwhen I receive [game end v]\ngo to [front v] layer\nshow\nforever\n    repeat (10)\n        change y by (1)\n    end\n    repeat (10)\n        change y by (-1)\n    end\nend\n\n@lava!\n\nwhen flag clicked\ngo to [front v] layer\nshow\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\ngo to x: (56) y: (-59)\n\nwhen flag clicked\nforever\n    if <(Level) > [15]> then\n        hide\n    end\nend\n\n@level\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nset [level v] to [1]\nforever\n    switch costume to (Level)\n    if <(Level) = [17]> then\n        hide\n        broadcast (outro v)\n        stop [this script v]\n    end\nend\n\n@sounds\n\nwhen flag clicked\nforever\n    wait (0.1) seconds\n    repeat (2)\n        play sound [Video Game 1 v] until done\n    end\n    wait (0.1) seconds\n    repeat (1)\n        play sound [Video Game 2 v] until done\n    end\n    wait (0.1) seconds\n    repeat (2)\n        play sound [Video Game 1 v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [17]> then\n        stop all sounds\n        stop [other scripts in sprite v]\n        play sound [Cheer v] until done\n    end\nend\n\n@key\n\nwhen flag clicked\nshow variable [keys v]\nset [keys v] to [0]\n\nwhen flag clicked\nforever\n    if <touching (player v)?> then\n        change [keys v] by (1)\n        hide\n    end\n    if <<(keys) = [0]> and <(Level) = [1]>> then\n        show\n        go to x: (90) y: (16)\n        if <touching (player v)?> then\n            change [keys v] by (1)\n            hide\n        end\n    end\n    if <<(keys) = [1]> and <(Level) = [4]>> then\n        show\n        go to x: (161) y: (-30)\n        if <touching (player v)?> then\n            change [keys v] by (1)\n            hide\n        end\n    end\n    if <<(keys) = [1]> and <(Level) = [10]>> then\n        show\n        go to x: (247) y: (-22)\n        if <touching (player v)?> then\n            change [keys v] by (1)\n            hide\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <not <<<(keys) = [0]> and <(Level) = [1]>> or <<<(keys) = [1]> and <(Level) = [4]>> or <<(keys) = [1]> and <(Level) = [10]>>>>> then\n        hide\n    end\nend\n\n
Use your arrows to move on computer.\nDrag your finger across the screen to move on mobile.\n\nIf you finish the platformer say that you did in the comments!\n\nIf you like this game then consider following me.\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nPlay Zomb_Shooter here: https://scratch.mit.edu/projects/496304739