Platformer Games Challenge (sort of)
@Stage\n\n@player\n\ndefine engine\nchange x (((2) * <(xspeed) > [0]>) - (1))\nchange y (((2) * <(yspeed) > [0]>) - (1))\nchange [yspeed v] by (-1.5)\nset [xspeed v] to ((0.8) * ((xspeed) + ((2) * (<key (right arrow v) pressed?> - <key (left arrow v) pressed?>))))\n\ndefine change x (positive)\nrepeat ([abs v] of (xspeed) )\n    change x by (positive)\n    if <touching (level v)?> then\n        change y by (2)\n        if <touching (level v)?> then\n            change y by (-2)\n            change x by (() - (positive))\n            set [xspeed v] to [0]\n        end\n    end\nend\n\ndefine change y (positive)\nrepeat ([abs v] of (yspeed) )\n    change y by (positive)\n    if <touching (level v)?> then\n        change y by (() - (positive))\n        set [yspeed v] to (((18) * <[0] > (positive)>) * <key (up arrow v) pressed?>)\n    end\nend\n\nwhen flag clicked\nset [xspeed v] to [0]\nset [yspeed v] to [0]\ngo to x: (-120) y: (-100)\nforever\n    engine\nend\n\n@level\n\n@slides\n\nwhen flag clicked\ngo to x: (-203) y: (44)\nswitch costume to (1 v)\nrepeat until <touching (player v)?>\n    turn right (2) degrees\n    set y to (((5) * ([sin v] of ((180) * (timer)) )) + (44))\nend\nbroadcast (flash v)\npoint in direction (90)\ngo to x: (0) y: (0)\nswitch costume to (2 v)\nforever\n    if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > [50]>>> then\n        if <[11] > (costume [number v])> then\n            broadcast (flash v)\n            next costume\n            wait until <not <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > [50]>>>>\n        end\n    end\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <[-50] > (mouse x)>>> then\n        if <(costume [number v]) > [2]> then\n            broadcast (flash v)\n            switch costume to ((costume [number v]) - (1))\n            wait until <not <<key (left arrow v) pressed?> or <<mouse down?> and <[-50] > (mouse x)>>>>\n        end\n    end\nend\n\n@flash\n\nwhen I receive [flash v]\nshow\nclear graphic effects\nrepeat (9)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nhide\n\n