Platformer


@Stage\n\nwhen flag clicked\nset volume to (100) %\nforever\n    play sound [Vexento - Pixel Party v] until done\nend\n\nwhen flag clicked\nforever\n    if <key (w v) pressed?> then\n        change volume by (1)\n    end\n    if <key (s v) pressed?> then\n        change volume by (-1)\n    end\nend\n\n@-ball-(er)\n\nwhen flag clicked\nbroadcast (del v)\nset [yv v] to [0]\nset [xv v] to [0]\nset [level v] to [1]\nswitch costume to (ball v)\nset size to (50) %\npoint in direction (90)\nshow\nset [ghost v] effect to (0)\ngo to x: (-211) y: (0)\nforever\n    omega\nend\n\ndefine omega\nif <not <touching (sprite1 v)?>> then\n    switch costume to (join [ball] (<key (right arrow v) pressed?> + (<key (left arrow v) pressed?> * (-1))))\n    change [xv v] by ((<key (left arrow v) pressed?> * (-3)) + (<key (right arrow v) pressed?> * (3)))\nend\nset [xv v] to ((Xv) * (0.7))\nchange x by (Xv)\ndetect slope: (8) (20) (13)\nchange [yv v] by (-1)\nchange y by (Yv)\nif <touching (sprite1 v)?> then\n    out2 <(Yv) > [0]>\nend\nchange y by (-1)\nif <<touching (sprite1 v)?> and <<key (up arrow v) pressed?> or <key (space v) pressed?>>> then\n    start sound [Jump v]\n    set [yv v] to [15]\nend\nif <touching (sprite4 v)?> then\n    set [yv v] to [18]\nend\nchange y by (1)\nif <<touching (sprite3 v)?> or <(y position) < [-178]>> then\n    go to x: (-220) y: (0)\n    point in direction (90)\n    set [yv v] to [0]\n    set [xv v] to [0]\nelse\nend\nif <(x position) > [239]> then\n    change [level v] by (1)\n    hide\n    go to x: (-220) y: (0)\n    point in direction (90)\n    set [yv v] to [0]\n    set [xv v] to [0]\n    broadcast (message1 v) and wait\n    show\nend\n\nwhen I receive [del v]\ndelete this clone\n\ndefine out <>\nset [i v] to [0]\nif <boolean1> then\n    repeat until <<not <touching (sprite1 v)?>> or <(i) > [8]>>\n        change [i v] by (1)\n        change x by (-1)\n    end\nelse\n    if <[0] > (Xv)> then\n        repeat until <<not <touching (sprite1 v)?>> or <(i) > [8]>>\n            change [i v] by (1)\n            change x by (1)\n        end\n    end\nend\n\ndefine out2 <>\nset [i v] to [0]\nif <boolean1> then\n    repeat until <<not <touching (sprite1 v)?>> or <(i) > [24]>>\n        change [i v] by (1)\n        change y by (-1)\n    end\n    set [yv v] to [-1]\nelse\n    repeat until <<not <touching (sprite1 v)?>> or <(i) > [24]>>\n        change [i v] by (1)\n        change y by (1)\n    end\n    set [yv v] to [0]\nend\n\ndefine None\nset [i v] to [0]\nrepeat until <<(i) > (maxslope)> or <not <touching (sprite1 v)?>>>\n    change [i v] by (1)\n    change y by (1)\nend\nset [i2 v] to (i)\nif <touching (sprite1 v)?> then\n    out <(Xv) > [0]>\n    change y by ((0) - (i2))\n    if <<key (up arrow v) pressed?> or <key (space v) pressed?>> then\n        start sound [Jump v]\n        if <(Xv) > [0]> then\n            set [xv v] to ((0) - (walljump))\n        else\n            set [xv v] to (walljump)\n        end\n        set [yv v] to (jumpheight)\n    else\n        set [xv v] to [0]\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\ngo to [front v] layer\nshow\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [message1 v]\nswitch costume to (join [costume] (level))\n\n@Sprite3\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (2) layers\nshow\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [message1 v]\nswitch costume to (join [costume] (level))\n\n@Sprite2\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nswitch costume to (costume3 v)\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@Sprite4\n\nwhen flag clicked\ngo [backward v] (0) layers\nwait (0) seconds\ngo to [front v] layer\nshow\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [message1 v]\nswitch costume to (join [costume] (level))\n\n