✦ A Platformer ✦

Instructions: Welcome to Trolled - A platformer!\nAs it says in the title, there are trolls!\nThere are also hidden passages to get past the trolls.\nComment how many trolls you fell for!\nShared in Sep 06, 2019 (not Apr 14 2020)\n\n\nThis is extremely overrated!\n

@Stage\n\nwhen I receive [tick v]\nset [color v] effect to (COLOR)\n\nwhen flag clicked\nforever\n\n@player\n\ndefine Die\nset [exit v] to []\nrepeat (4)\n    hide\n    wait (0.1) seconds\n    show\nend\nwait (0.5) seconds\n\ndefine Test- dying\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\nif <touching (bounce v)?> then\n    set [sy v] to [30]\nend\n\ndefine Win\nset rotation style [don't rotate v]\nrepeat (50)\n    point towards (portal v)\n    turn right (65) degrees\n    move ((distance to [portal v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\n    if <(TURBO?) = [1]> then\n        wait ((1) / (FPS)) seconds\n    end\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\nclear graphic effects\nset rotation style [left-right v]\n\nwhen I receive [green flag clicked v]\nshow variable [collect v]\nset [fps v] to [40]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Set up v) and wait\n    Game On\n    repeat until <(EXIT) > []>\n        reset timer\n        broadcast (Tick v)\n        if <(TURBO?) = [1]> then\n            wait ((1) / (FPS)) seconds\n        end\n    end\n    if <(EXIT) = [win]> then\n        Win\n    else\n        Clone [20]\n        Die\n    end\nend\n\ndefine Game On\npoint in direction (90)\nset size to (100) %\nclear graphic effects\nset [in air v] to [0]\nset rotation style [left-right v]\nset [sy v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [exit v] to []\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nshow\n\ndefine Tick <right> <up> <left>\nif <left> then\n    Change Player X by [-10]\nend\nif <right> then\n    Change Player X by [10]\nend\nif <<up> and <(in air) < [4]>> then\n    set [sy v] to [16]\nend\nchange [sy v] by (-2)\nChange Player Y by (sy)\nTest- dying\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\nset [collect v] to (join (COLLECTED) (join [ of ] (join (COLLECTED MAX) [ coins])))\nchange [scroll y v] by (round (((Y) - (SCROLL Y)) / (10)))\nchange [scroll x v] by (round (((X) - (SCROLL X)) / (10)))\nPosition\nif <(y position) < [-180]> then\n    set [exit v] to [die]\nend\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)?>>\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    set [sy v] to [0]\n    Position\nend\n\ndefine Position\ngo to x: ((X) - (SCROLL X)) y: ((Y) - (SCROLL Y))\n\ndefine Change Player X by (sx)\nif <(sx) < [0]> then\n    point in direction (-90)\nelse\n    point in direction (90)\nend\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    repeat until <not <touching (platforms v)?>>\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\nwhen I receive [tick v]\nset [color v] effect to (COLOR)\nif <(LEVEL) = [1]> then\n    set [color v] to [0]\nend\nif <(LEVEL) = [2]> then\n    set [color v] to [120]\nend\nif <(LEVEL) = [3]> then\n    set [color v] to [160]\nend\n\nwhen I receive [tick v]\nbroadcast (Ready v)\nTick <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<<mouse down?> and <(mouse x) > (x position)>> and <(distance to [mouse-pointer v]) > [20]>>>> <<key (up arrow v) pressed?> or <<key (space v) pressed?> or <<key (w v) pressed?> or <<<mouse down?> and <(mouse y) > (y position)>> and <(distance to [mouse-pointer v]) > [20]>>>>> <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<<mouse down?> and <(x position) > (mouse x)>> and <(distance to [mouse-pointer v]) > [20]>>>>\n\nwhen flag clicked\nset [level v] to [1]\n\nwhen flag clicked\nset [collect v] to [0 of 9 coins]\n\ndefine Clone (num)\nrepeat (num)\n    create clone of (particles v)\nend\n\n@platforms\n\nwhen I receive [tick v]\nset [color v] effect to (COLOR)\n\nClone [0] [0]\n\nwhen I receive [green flag clicked v]\nshow\n\nwhen I receive [tick v]\nPosition ((X) - (SCROLL X)) ((Y) - (SCROLL Y))\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [450] [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone [450] [0]\n        Clone [450] [0]\n        Clone [450] [0]\n        Clone [0] [360]\n        Clone [0] [360]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone [450] [0]\n            Clone [450] [0]\n            Clone [450] [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1  v)\n            else\n            end\n        end\n    end\nend\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 (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nClone [450] [0]\n\nClone [450] [0]\nClone [450] [0]\n\n@Collectables\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [,] ((mouse y) + (SCROLL Y))))\nshow variable [mouse v]\nwait (1) seconds\nhide variable [mouse v]\n\nwhen I receive [tick v]\nset [color v] effect to (COLOR)\n\nwhen I receive [green flag clicked v]\nshow\n\nwhen I receive [tick v]\nPosition ((X) - (SCROLL X)) (((Y) - (SCROLL Y)) + (([sin v] of ((timer) * (300)) ) * (5)))\nif <touching (player v)?> then\n    change [collected v] by (1)\n    if <(COLLECTED) = (COLLECTED MAX)> then\n        broadcast (Open Portal v)\n        start sound [smb3_nspade_match v]\n    else\n        start sound [card pick v]\n    end\n    delete this clone\nend\n\nwhen I receive [set up v]\nset [collected max v] to [0]\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    Clone [150] [-86]\n    Clone [356] [-16]\n    Clone [555] [74]\n    Clone [843] [-40]\n    Clone [929] [82]\n    Clone [1034] [150]\n    Clone [1165] [200]\n    Clone [1432] [123]\n    Clone [1566] [123]\nelse\n    if <(LEVEL) = [2]> then\n        Clone [97] [-70]\n        Clone [180] [12]\n        Clone [463] [25]\n        Clone [744] [-41]\n        Clone [1108] [97]\n        Clone [836] [134]\n        Clone [681] [222]\n        Clone [1600] [300]\n        Clone [1121] [403]\n        Clone [1618] [487]\n        Clone [1378] [437]\n        Clone [984] [178]\n        Clone [1291] [929]\n    else\n        if <(LEVEL) = [3]> then\n            Clone [35] [31]\n            Clone [-239] [-36]\n            Clone [360] [69]\n            Clone [476] [69]\n            Clone [416] [-144]\n            Clone [769] [-103]\n            Clone [769] [-19]\n            Clone [769] [60]\n            Clone [770] [164]\n            Clone [924] [123]\n            Clone [1128] [107]\n            Clone [1306] [208]\n            Clone [1493] [322]\n        end\n    end\nend\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 (x) (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nchange [collected max v] by (1)\n\n@Danger\n\nwhen I receive [tick v]\nset [color v] effect to (COLOR)\n\nwhen I receive [green flag clicked v]\nshow\n\nwhen I receive [tick v]\nPosition ((X) - (SCROLL X)) ((Y) - (SCROLL Y))\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone [450] [0]\n    Clone [450] [0]\n    Clone [450] [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone [450] [0]\n        Clone [450] [0]\n        Clone [450] [720]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone [450] [0]\n            Clone [450] [0]\n            Clone [450] [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 1 4 v)\n            end\n        end\n    end\nend\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 (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Portal\n\nwhen I receive [open portal v]\nswitch costume to (exit open v)\n\nwhen I receive [tick v]\nset [color v] effect to (COLOR)\n\nwhen I receive [green flag clicked v]\nshow\n\nwhen I receive [tick v]\nPosition ((X) - (SCROLL X)) (((Y) - (SCROLL Y)) + (([sin v] of ((timer) * (100)) ) * (20)))\nif <<(costume [number v]) = [2]> and <touching (player v)?>> then\n    set [exit v] to [Win]\nend\n\nwhen I receive [set up v]\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (exit closed v)\n    Position Portal at [1692] [150]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (exit closed v)\n        Position Portal at [1458] [974]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (exit closed v)\n            Position Portal at [1618] [385]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (exit closed v)\n                Position Portal at [999999] [999999]\n            end\n        end\n    end\nend\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 Position Portal at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\n\n@Thumbnail\n\nwhen flag clicked\nbroadcast (Green Flag Clicked v)\nwait (1) seconds\nbroadcast (Play game v)\nrepeat (10)\n    set [color v] to [0]\n    change [ghost v] effect by (10)\nend\nforever\n    go to [front v] layer\n    show\n    set [ghost v] effect to (100)\nend\n\nwhen flag clicked\n\nwhen [space v] key pressed\nclear graphic effects\ngo to [front v] layer\nrepeat (200)\n    change [color v] effect by (1)\nend\n\nwhen I receive [play game v]\nforever\n    play sound [POL-bright-future-short v] until done\nend\n\n@Background stuff\n\nwhen I start as a clone\nshow\ngo to [back v] layer\npoint in direction (pick random (-70) to (-100))\ngo to x: (300) y: (pick random (-180) to (180))\nset size to (pick random (20) to (50)) %\nset [ghost v] effect to (pick random (90) to (95))\ngo to [back v] layer\nrepeat until <(x position) < [-220]>\n    move (10) steps\n    if <(TURBO?) = [1]> then\n        wait ((1) / (FPS)) seconds\n    end\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    hide\n    create clone of (_myself_ v)\n    if <(TURBO?) = [1]> then\n        wait ((1) / (FPS)) seconds\n    end\nend\n\nwhen I receive [tick v]\nset [color v] effect to (COLOR)\n\n@Transitions\n\nwhen I receive [reset v]\ngo to [front v] layer\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\nwhen I receive [tick v]\nset [color v] effect to (COLOR)\n\nwhen I receive [ready v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n@Sprite1\n\nwhen flag clicked\nforever\n    move (10) steps\nend\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    wait (0.05) seconds\n    if <(x position) > [50]> then\n        set [turbo? v] to [1]\n        show variable [fps v]\n    else\n        set [turbo? v] to [0]\n        hide variable [fps v]\n    end\nend\n\n@Particles\n\nwhen I start as a clone\ngo to (player v)\nset [xv v] to (pick random (-10) to (10))\nclear graphic effects\nshow\nset size to (pick random (80) to (120)) %\nset [color v] effect to (COLOR)\nset [yv v] to (pick random (5) to (30))\nrepeat (50)\n    change [yv v] by (-2)\n    go to x: ((x position) + (Xv)) y: ((y position) + (Yv))\n    change [ghost v] effect by (2)\n    if <touching (_edge_ v)?> then\n        delete this clone\n    end\n    if <(TURBO?) = [1]> then\n        wait ((1) / (FPS)) seconds\n    end\nend\n\nwhen flag clicked\nhide\n\n