Poison ⇝ A Scrolling Platformer #games
@Stage\n\nwhen [m v] key pressed\nshow variable [mouse v]\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [,] ((mouse y) + (SCROLL Y))))\nwait (2) seconds\nhide variable [mouse v]\n\nwhen I receive [green flag v]\nswitch backdrop to (backdrop2 v)\n\nwhen flag clicked\nforever\n    play sound [Frantic-Factory-ytmp3.com.mp3 v] until done\nend\n\n@Blank\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v)\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [play game v]\nset [checkpoint v] to [0]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(EXIT) = [Die]> then\n        Game - Die\n    else\n        repeat (50)\n            set rotation style [all around v]\n            point towards (portal v)\n            turn right (65) degrees\n            move ((distance to [portal v]) / (5)) steps\n            change size by (-1)\n            change [ghost v] effect by (2)\n        end\n        broadcast (Win v)\n    end\nend\n\ndefine Game On\npoint in direction (90)\nif <(CHECKPOINT) = [0]> then\n    set [x v] to [-200]\n    set [y v] to [-50]\nelse\n    set [x v] to (item (CHECKPOINT) of [cp x v])\n    set [y v] to (item (CHECKPOINT) of [cp y v])\nend\nset [xv v] to [0]\nset [yv v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [scroll x v] to (x)\nset [scroll y v] to (y)\nset size to (65) %\nshow\nset [ghost v] effect to (0)\nswitch costume to (hitbox v)\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <<touching (platforms v)?> or >>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [yv v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <<touching (platforms v)?> or > then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <<touching (platforms v)?> or >> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    Position\n    repeat until <not <<touching (platforms v)?> or >>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game - Die\nrepeat (4)\n    change [ghost v] effect by (25)\nend\nwait (0.75) seconds\nset [exit v] to []\n\ndefine Test - Collision\nif <touching (trampolines v)?> then\n    start sound [Big Boing v]\n    set [yv v] to [30]\n    broadcast (Bounce v)\nend\nif <<<touching (danger v)?> or <touching color (#66ff89)?>> or <<touching (poison enemy v)?> or <<touching (poison v)?> or <touching (spinning spikes v)?>>>> then\n    start sound [explode_11 v]\n    set [exit v] to [Die]\nend\nif <touching (dash v)?> then\n    change [xv v] by (4)\nend\nchange [y v] by (-2)\nPosition\nif <touching (mv v)?> then\n    change [x v] by (x diff -)\n    change [y v] by (y diff -)\n    Position\nelse\n    set [x diff - v] to [0]\n    set [y diff - v] to [0]\nend\nchange [y v] by (2)\nPosition\nif <touching (portal v)?> then\n    set [exit v] to [Win]\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Tick\nset rotation style [left-right v]\nif <<key (a v) pressed?> or <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n    point in direction (-90)\n    change [xv v] by (-2)\nend\nif <<key (d v) pressed?> or <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n    point in direction (90)\n    change [xv v] by (2)\nend\nset [xv v] to ((xv) * (0.8))\nif <([abs v] of (xv) ) > [0.9]> then\n    Change Player x by (round (xv))\nend\nif <<key (w v) pressed?> or <<key (up arrow v) pressed?> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>>> then\n    change [y v] by (10)\n    Position\n    if <(in air) < [4]> then\n        set [yv v] to [16]\n    end\n    change [y v] by (-10)\nend\nif <(yv) > [-20]> then\n    if <touching (water v)?> then\n        set [yv v] to [-2]\n    else\n        change [yv v] by (-2)\n    end\nend\nChange Player y by (yv)\nPosition\nTest - Collision\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (5)))\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (5)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-175]> then\n    set [exit v] to [Die]\nend\nif <(x) < [-240]> then\n    set [x v] to [-240]\nend\n\ngo to (player v)\n\nwhen [timer v] > (0.000001)\nhide\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (level 1 1 v)\nClone at x: [0] y: [480]\nClone at x: [480] y: [0]\nClone at x: [480] y: [0]\nClone at x: [0] y: [-360]\nClone at x: [0] y: [-360]\nClone at x: [0] y: [360]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nshow\n\nbroadcast (Reset v)\nbroadcast (Setup v)\n\n@Trampolines\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (0 v)\nClone at x: [-210] y: [150]\nset [x v] to [-99999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [bounce v]\nrepeat (2)\n    change [y v] by (-5)\nend\nrepeat (10)\n    change [y v] by (1)\nend\n\n@Spinning Spikes\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nset size to (65) %\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nturn right (15) degrees\nif <(x/y) = [x]> then\n    set [x v] to ((ox) + (([cos v] of (((days since 2000) * (100000)) * (v)) ) * (r)))\nelse\n    if <(x/y) = [y]> then\n        set [y v] to ((oy) + (([cos v] of (((days since 2000) * (100000)) * (v)) ) * (r)))\n    end\nend\n\nwhen I receive [setup v]\nhide\npoint in direction (90)\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (saw v)\nClone at x: [270] y: [420] settings: [y] [150] [200]\nClone at x: [520] y: [500] settings: [x] [120] [120]\nClone at x: [520] y: [660] settings: [x] [120] [110]\nClone at x: [765] y: [590] settings: [y] [150] [100]\nClone at x: [980] y: [590] settings: [y] [150] [100]\nClone at x: [1440] y: [250] settings: [x] [150] [200]\nset [x v] to [-9999999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y) settings: (x/y) (range) (speed)\nset [ox v] to (x)\nset [oy v] to (y)\nset [x v] to (x)\nset [y v] to (y)\nset [x/y v] to (x/y)\nset [r v] to (range)\nset [v v] to (speed)\ncreate clone of (_myself_ v)\n\nbroadcast (Reset v)\nbroadcast (Setup v)\n\n@Checkpoints\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    if <not <(CHECKPOINT) = (clone)>> then\n        start sound [Coin v]\n        set [checkpoint v] to (clone)\n    end\nend\nif <(CHECKPOINT) = (clone)> then\n    set [brightness v] effect to (15)\nelse\n    clear graphic effects\nend\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [clone v] to [0]\nswitch costume to (costume1 v)\ndelete all of [cp x v]\ndelete all of [cp y v]\nClone at x: [-140] y: [380]\nClone at x: [876] y: [565]\nClone at x: [1200] y: [250]\nset [x v] to [-9999999999]\nset [clone v] to [0]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [clone v] by (1)\nadd (x) to [cp x v]\nadd (y) to [cp y v]\nswitch costume to (clone)\ncreate clone of (_myself_ v)\n\n@Poison\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nset [ghost v] effect to (60)\nset [y v] to ((oy) + (([cos v] of ((((days since 2000) * (100000)) + (_clone)) * (200)) ) * (8)))\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [_coins v] to [0]\nswitch costume to (p v)\nClone at x: [-30] y: [-160]\nClone at x: [220] y: [-160]\nClone at x: [1150] y: [-160]\nClone at x: [1160] y: [-100]\nset [x v] to [-99999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nset [oy v] to (y)\nset [_clone v] to [0]\nrepeat (3)\n    change [_clone v] by (1)\n    create clone of (_myself_ v)\nend\nnext costume\n\n@Dash\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\ngo to [back v] layer\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nchange [costu v] by (1)\nif <(costu) > [7]> then\n    set [costu v] to [0]\n    next costume\nend\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [costu v] to [0]\nswitch costume to (costume1 v)\nClone at x: [-40] y: [-50]\nClone at x: [230] y: [-50]\nset [x v] to [-99999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nset [oy v] to (y)\ncreate clone of (_myself_ v)\n\n@Mv\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nif <not <(clone id) = [X]>> then\n    MV\nend\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [clone id v] to [0]\nswitch costume to (costume1 v)\nrepeat (4)\n    Clone at x: [530] y: [100] range: [150] [150] set: [90] [0] speed: [1] [1] id change: [90]\nend\nset [x v] to [-99999]\nset [clone id v] to [X]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y) range: (xr) (yr) set: (xs) (ys) speed: (xv) (yv) id change: (id)\nset [x v] to (x)\nset [y v] to (y)\nset [ox v] to (x)\nset [oy v] to (y)\nset [xr v] to (xr)\nset [yr v] to (yr)\nset [xs v] to (xs)\nset [ys v] to (ys)\nset [xv v] to (xv)\nset [yv v] to (yv)\ncreate clone of (_myself_ v)\nchange [clone id v] by (id)\n\ndefine MV\nchange [xs v] by (xv)\nchange [ys v] by (yv)\nif <(xs) > [360]> then\n    set [xs v] to [0]\nend\nif <(ys) > [360]> then\n    set [ys v] to [0]\nend\nset [x v] to ((ox) + (([cos v] of ((xs) + (clone id)) ) * (xr)))\nset [y v] to ((oy) + (([cos v] of ((ys) + (clone id)) ) * (yr)))\nchange [y v] by (1)\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    set [x diff - v] to ((x) - (prev x))\n    set [y diff - v] to (((y) - (2)) - (prev y))\nend\nchange [y v] by (-1)\nset [prev x v] to (x)\nset [prev y v] to (y)\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\n@Poison Shooter\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nif <(clone id) = [1]> then\n    switch costume to (costume1 v)\n    position ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n    if <(count) > [30]> then\n        if <((count) mod (5)) = [0]> then\n            set [clone id v] to [2]\n            create clone of (_myself_ v)\n            set [clone id v] to [1]\n        end\n        if <(count) > [70]> then\n            set [count v] to [0]\n        end\n    end\n    change [count v] by (1)\nend\nif <(clone id) = [2]> then\n    switch costume to (costume2 v)\n    position ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n    if <(count) < [11]> then\n        change [y v] by (14)\n    end\n    change [count v] by (1)\n    if <(count) > [10]> then\n        change [ghost v] effect by (25)\n    end\n    if <(count) > [13]> then\n        delete this clone\n    end\nend\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [count v] to [0]\nswitch costume to (costume1 v)\nClone at x: [170] y: [148]\nClone at x: [20] y: [148]\nClone at x: [-130] y: [148]\nClone at x: [1460] y: [-25]\nset [x v] to [-99999]\nset [clone id v] to [0]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [count v] to [0]\n\n@Poison Enemy\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nTick\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [count v] to [0]\nswitch costume to (costume1 v)\nClone at x: [40] y: [470]\nClone at x: [1260] y: [20]\nset [x v] to [-99999]\nset [clone id v] to [0]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nset [ox v] to (x)\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset [count v] to [0]\nset [yv v] to [0]\n\ndefine Tick\nif <(clone id) = [1]> then\n    switch costume to (costume1 v)\n    set [x v] to ((ox) + (([cos v] of (((days since 2000) * (100000)) * (25)) ) * (90)))\n    position ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n    if <(count) > [20]> then\n        set [clone id v] to [2]\n        repeat (2)\n            create clone of (_myself_ v)\n            change [clone id v] by (1)\n        end\n        set [clone id v] to [1]\n        set [count v] to [0]\n    else\n        change [count v] by (1)\n    end\nend\nif <<(clone id) = [2]> or <(clone id) = [3]>> then\n    switch costume to (costume2 v)\n    position ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n    if <(count) < [6]> then\n        if <(clone id) = [2]> then\n            change [x v] by (-7)\n        else\n            change [x v] by (7)\n        end\n    end\n    change [count v] by (1)\n    if <(yv) < [1]> then\n        change [yv v] by (-1)\n        change [y v] by (yv)\n        position ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n    end\n    if <touching (platforms v)?> then\n        set [yv v] to [50]\n    end\n    if <(yv) > [0]> then\n        set [brightness v] effect to (20)\n        change [ghost v] effect by (25)\n        change size by (yv)\n        change [yv v] by (-1.5)\n    end\n    if <(count) > [6]> then\n        change [ghost v] effect by (5)\n    end\n    if <(count) > [12]> then\n        delete this clone\n    end\nend\n\n@Portal\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nturn right (15) degrees\nset [brightness v] effect to (-5)\n\nwhen I receive [setup v]\nhide\nset [x v] to [1030]\nset [y v] to [80]\nswitch costume to (costume1 v)\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nset [oy v] to (y)\ncreate clone of (_myself_ v)\n\n@Win\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\n\nwhen I receive [win v]\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nstop [all v]\n\n@TN\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n