PLATFORMER GAME

Instructions: press up arrow to jump ,left arrow to move forward and right arrow to move backward\nThis game is only for computer player\n\nmobile player https://scratch.mit.edu/projects/456418559/\nhardest platformer-https://scratch.mit.edu/projects/456514564/

@Stage\n\n@Sprite1\n\nwhen flag clicked\nset [level v] to [1]\nbroadcast (start level v)\n\nwhen I receive [start level v]\nset [jumping v] to [false]\nset [x velocity v] to [0]\nset [y velocity v] to [0]\nforever\n    change [y velocity v] by (-1)\n    if <key (left arrow v) pressed?> then\n        if <(x velocity) > [-10]> then\n            change [x velocity v] by (-2)\n        end\n        if <(costume [number v]) = [1]> then\n            switch costume to (costume2 v)\n        else\n            switch costume to (costume1 v)\n        end\n    end\n    if <key (right arrow v) pressed?> then\n        if <(x velocity) < [10]> then\n            change [x velocity v] by (2)\n        end\n        if <(costume [number v]) = [3]> then\n            switch costume to (costume4 v)\n        else\n            switch costume to (costume3 v)\n        end\n    end\n    if <(x velocity) > [0]> then\n        change [x velocity v] by (-1)\n    end\n    if <(x velocity) < [0]> then\n        change [x velocity v] by (1)\n    end\n    change x by (x velocity)\n    move vertical\n    move horizontal\n    if <touching color (#ff8500)?> then\n        broadcast (next level v)\n    end\n    if <<(y position) < [-179]> or <touching color (#f11515)?>> then\n        broadcast (start level v)\n    end\nend\n\nwhen [up arrow v] key pressed\nif <(jumping) = [false]> then\n    set [y velocity v] to [15]\n    set [jumping v] to [true]\nend\n\ndefine move horizontal\nif <touching color (#00ff25)?> then\n    if <(x velocity) > [0]> then\n        repeat until <not <touching color (#00ff25)?>>\n            change x by (-2)\n        end\n    else\n        repeat until <not <touching color (#00ff25)?>>\n            change x by (2)\n        end\n    end\n    set [x velocity v] to [0]\nend\n\ndefine move vertical\nchange y by (y velocity)\nif <touching color (#00ff25)?> then\n    if <(y velocity) > [0]> then\n        repeat until <not <touching color (#00ff25)?>>\n            change y by (-1)\n        end\n    else\n        repeat until <not <touching color (#00ff25)?>>\n            change y by (1)\n        end\n        set [jumping v] to [false]\n    end\n    set [y velocity v] to [0]\nend\n\nwhen I receive [start level v]\nif <(level) = [1]> then\n    go to x: (-168) y: (-96)\n    switch backdrop to (backdrop1 v)\nend\nif <(level) = [2]> then\n    go to x: (194) y: (-123)\n    switch backdrop to (backdrop2 v)\nend\nif <(level) = [3]> then\n    go to x: (-152) y: (148)\n    switch backdrop to (backdrop3 v)\nend\nif <(level) = [4]> then\n    go to x: (-206) y: (-136)\n    switch backdrop to (backdrop4 v)\nend\nif <(level) = [5]> then\n    go to x: (-203) y: (-100)\n    switch backdrop to (backdrop5 v)\nend\nif <(level) = [6]> then\n    go to x: (-213) y: (-61)\n    switch backdrop to (backdrop6 v)\nend\nif <(level) = [7]> then\n    hide\n    switch backdrop to (backdrop 4 v)\n    wait (0.1) seconds\n    stop [all v]\nend\n\nwhen I receive [next level v]\nchange [level v] by (1)\nstop [other scripts in sprite v]\nbroadcast (start level v)\n\nwhen flag clicked\nshow\n\nwhen backdrop switches to [backdrop 4 v]\nstart sound [Goal Cheer v]\n\nwhen backdrop switches to [backdrop2 v]\nstart sound [Video Game 2 v]\n\nwhen backdrop switches to [backdrop3 v]\nstart sound [Video Game 2 v]\n\nwhen backdrop switches to [backdrop1 v]\nstart sound [Video Game 2 v]\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I receive [start level v]\nstop [other scripts in sprite v]\nif <(level) = [3]> then\n    show\nelse\n    hide\nend\nmove platform\n\ndefine move platform\ngo to x: (-27) y: (-137)\nforever\n    glide (1) secs to x: (-33) y: (54)\n    glide (1) secs to x: (-27) y: (-137)\nend\n\n