Soccer Platformer  ver. 2

Instructions: CLICK THE FLAG 3 TIMES OR THERE WILL BE GLITCHES.\n\nCONTROLS:\nIf there are bugs, tell me.\nArrow Keys/WASD/Mobile to move.\nAvoid spikes, lava, crushers, saws, lasers and cannons!\nRide on moving platforms (you move too!)\nPink blocks go invisible when you are close.\nPurple blocks are quite weak and can't hold much weight.\nUse perfect timing on phasing blocks.\nBounce on yellow trampolines.\nSpeed boosts push you right.\nGet the the green areas to advance to the next level.

@Stage\n\nwhen flag clicked\nforever\n    play sound [myinstants.download v] until done\n    play sound [myinstants.download2 v] until done\nend\n\n@Player\n\nwhen flag clicked\nset [x v] to [0]\npoint in direction (90)\nhide\nset size to (20) %\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [game on v]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    set [tick v] to [0]\n    broadcast (Setup v) and wait\n    GameOn\n    repeat until <(EXIT) > []>\n        change [tick v] by (1)\n        Tick\n        broadcast (Clock v) and wait\n    end\n    if <(EXIT) = [win]> then\n        Game-Win\n    else\n        Game-die\n    end\nend\n\ndefine GameOn\nset [in air v] to [0]\nset [sy v] to [0]\nset [sx v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [exit v] to []\nset size to (20) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <not <key (any v) pressed?>> then\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [sx v] by (-2)\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [sx v] by (2)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player X By: (round (sx))\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> then\n    if <(in air) < [5]> then\n        set [sy v] to [15]\n    end\nend\nchange [sy v] by (-2)\nChange Player Y by: (sy)\nTest-die\nif <key (any v) pressed?> then\n    change [scroll x v] by (round (((x) - (SCROLL X)) / (15)))\nend\nif <not <key (any v) pressed?>> then\n    change [scroll x v] by (round (((x) - (SCROLL X)) / (10)))\nend\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (45)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> and <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>>> then\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> and <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>> then\nif <touching (platforms v)?> then\n    point in direction (90)\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    Position\n    set [sy 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)?> 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    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\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\ndefine Game-die\nset [scroll x v] to [0]\nset [exit v] to []\nrepeat (10)\n    change size by (0.5)\n    change [ghost v] effect by (10)\nend\nhide\nwait (0.5) seconds\n\ndefine Test-die\nif <touching (lava v)?> then\n    set [exit v] to [die]\nend\n\ndefine Game-Win\npoint in direction (90)\nhide\nset [scroll x v] to [0]\nset [scroll y v] to [0]\n\nwhen I receive [end intro v]\nbroadcast (Green Flag v) and wait\nshow\nbroadcast (Game On v) and wait\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nwhen I receive [eye 2 v]\nswitch costume to (eye 2 v)\n\nwhen I receive [eye v]\nswitch costume to (eye v)\n\nwhen I receive [blank v]\nswitch costume to (blank v)\n\n@BG\n\nwhen I receive [green flag v]\nhide\n\nshow\n\nwhen I receive [clock v]\nPosition (((x) - (SCROLL X)) / (2)) (((y) - (SCROLL Y)) / (2))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1 v)\n    Clone At x: [0] y: [0]\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 At x: (x) y: (y)\ngo to [back v] layer\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I start as a clone\nforever\n    go to [back v] layer\nend\n\nwhen I start as a clone\nshow\n\n@Lava\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [clock 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]\nif <(Level) = [1]> then\n    switch costume to (level 1.1 v)\n    Clone At x: [360] y: []\n    Clone At x: [360] y: []\n    Clone At x: [360] y: []\n    Clone At x: [360] y: []\n    Clone At x: [360] y: []\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 At x: (x) y: (y)\ngo to [back v] layer\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I start as a clone\nrepeat (9)\n    go to [front v] layer\nend\n\nwhen I start as a clone\nshow\n\ngo to [back v] layer\n\n@Platforms\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [clock 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]\nif <(Level) = [1]> then\n    switch costume to (costume1 v)\n    Clone At x: [500] y: [0]\n    Clone At x: [500] y: [0]\n    Clone At x: [500] y: [0]\n    Clone At x: [500] y: [0]\n    if <(Level) = [3]> then\n        switch costume to (costume6 v)\n        Clone At x: [500] y: [0]\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 At x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen flag clicked\nrepeat (10)\n    delete this clone\nend\n\nwhen I start as a clone\nforever\n    go to [front v] layer\nend\n\nwhen I receive [exit v]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\n\n@Thumbnail\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\nforever\n    set [aatimer2 v] to (timer)\nend\n\nwhen [timer v] > (AAtimer2)\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [clock v]\nPosition ((x) - (SCROLL X)) (((y) + ((5) * ([sin v] of (((x) + (TICK)) * (10)) ))) - (SCROLL Y))\nif <<<(costume [name v]) = [open]> and <touching (player v)?>> and <<(Level) = [1]> or <(Level) = [2]>>> then\n    start sound [modern-checkpoint v]\n    set [exit v] to [win]\n    broadcast (END GAME  v) and wait\n    wait (1) seconds\nend\nif <<(Collected) = (Collected Max)> or <(Collected) > (Collected Max)>> then\n    switch costume to (open v)\nend\nif <<<(costume [name v]) = [open]> and <touching (player v)?>> and <(Level) = [3]>> then\n    broadcast (END GAME  v) and wait\nend\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (closed v)\n    Clone At x: [2145] y: [5]\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 At x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\nset [collected v] to [0]\n\n@Play\n\nwhen flag clicked\nshow\n\nwhen I receive [end intro v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen flag clicked\nshow\ngo to [front v] layer\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (costume v) and wait\n        broadcast (end intro v) and wait\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        start sound [pop v]\n        hide\n        broadcast (START_GAME v) and wait\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n        change size by (((100) - (size)) / (3))\n    end\nend\n\n@Select2\n\nwhen flag clicked\nshow\ngo to [front v] layer\n\nwhen I receive [end intro v]\nhide\n\nwhen flag clicked\nforever\n    point in direction ((([cos v] of ((tic) * (1.4)) ) * (5)) + (90))\n    change y by (([cos v] of ((tic) * (2.1)) ) * (1.4))\n    change size by (([cos v] of ((tic) * (1.4)) ) * (0.3))\n    change [tic v] by (2)\nend\n\n@Play2\n\nwhen flag clicked\nshow\n\nwhen I receive [end intro v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen flag clicked\nshow\ngo to [front v] layer\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (DIRECTIONS v) and wait\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        start sound [pop v]\n        hide\n    end\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n        change size by (((100) - (size)) / (3))\n    end\nend\n\nbroadcast (costume v) and wait\n\nwhen I receive [exit v]\nshow\n\nstop [other scripts in sprite v]\nstop [this script v]\n\n@RIGHT\n\nwhen I receive [green flag v]\nhide\n\nbroadcast (end intro v) and wait\n\nwhen flag clicked\ngo to [front v] layer\nshow\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (Next v) and wait\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        start sound [pop v]\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n        change size by (((100) - (size)) / (3))\n    end\nend\n\nwait (.1) seconds\n\nhide\n\n@LEFT\n\nwhen I receive [green flag v]\nhide\n\nwhen flag clicked\nshow\ngo to [front v] layer\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (LEFT v) and wait\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        start sound [pop v]\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n        change size by (((100) - (size)) / (3))\n    end\nend\n\nwait (.1) seconds\n\nbroadcast (START_GAME v) and wait\n\n@Costume Selection\n\nwhen flag clicked\nshow\nswitch costume to (costume1 v)\n\nwhen I receive [end intro v]\nhide\n\nwhen I receive [next v]\nnext\n\nwhen I receive [costume v]\nif <(costume [number v]) = [1]> then\n    broadcast (blank v) and wait\nend\nif <(costume [number v]) = [2]> then\n    broadcast (eye v) and wait\nend\nif <(costume [number v]) = [3]> then\n    broadcast (eye 2 v) and wait\nend\n\nwhen I receive [left v]\nback\n\nrepeat (9)\n\nnext costume\n\ndefine back\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nrepeat (8)\n    next costume\nend\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\n\nwhen flag clicked\ngo to [front v] layer\n\ndefine next\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nnext costume\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\n\n@Directions\n\nwhen flag clicked\nhide\n\nwhen I receive [directions v]\nshow\ngo to [front v] layer\n\nwhen I receive [exit v]\nhide\n\n@Game End\n\nwhen flag clicked\nhide\n\nwhen I receive [end game  v]\nshow\nforever\n    go to [front v] layer\nend\n\n@Sprite1\n\nwhen flag clicked\nshow\n\nwhen I receive [end intro v]\nhide\n\n