Sky ----- A Platformer ----- #games #all #stories
@Stage\n\n@Blank\n\n@Player\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\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) = [win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\nbroadcast (Tick v) and wait\n\ndefine Game On\nset [sx v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\npoint in direction (90)\nset size to (100) %\nshow\n\ndefine Tick\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)\n    broadcast (Player 2 v)\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n    change [sx v] by (2)\n    broadcast (Player 1 v)\nend\nset [sx v] to ((sx) * (.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) > (y position)>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y By (sy)\ntest - die\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (10)))\nif <(SCROLL X) < [-50]> then\n    set [scroll x v] to [-50]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (5)))\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\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?>> or <<mouse down?> and <(mouse y) > (y position)>>> 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 [exit v] to []\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\nset [last pressed v] to [1]\nshow\n\ndefine test - die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\nshow\nset [ghost v] effect to (0)\npoint in direction (90)\n\nwhen I receive [play thee game v]\nshow\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen flag clicked\nbroadcast (back v)\nhide\n\nwhen I receive [player 1 v]\nswitch costume to (player 1 v)\n\nwhen I receive [player 2 v]\nswitch costume to (player 2 v)\n\nwhen I receive [back v]\nbroadcast (back 2 v) and wait\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]\nbroadcast (Next Level v)\nset [brightness v] effect to (0)\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: [600] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [300] y: [200]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [200] y: [150]\n        Clone at x: [400] y: [-100]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [600] y: [0]\n            Clone at x: [400] y: [0]\n            Clone at x: [500] y: [0]\n            Clone at x: [300] y: [200]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [200] y: [0]\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]\nset [brightness v] effect to (0)\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 I receive [play game v]\nforever\n    if <<(LEVEL) = [4]> and <(x position) < [90]>> then\n        wait (5) seconds\n        broadcast (Win v)\n    end\nend\n\nClone at x: [360] y: [0]\nClone at x: [360] y: [0]\nClone at x: [400] y: [200]\n\n@Danger\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]\npoint in direction (90)\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: [600] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [230] y: [0]\n    Clone at x: [120] y: [0]\n    Clone at x: [300] y: [200]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [-90] y: [150]\n        Clone at x: [400] y: [-100]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [170] y: [25]\n            Clone at x: [300] y: [0]\n            Clone at x: [400] y: [0]\n            Clone at x: [500] y: [0]\n            Clone at x: [400] y: [200]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [300] y: [0]\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 at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I start as a clone\nif < (costume [name v]) contains [saw]?> then\n    forever\n        turn right (15) degrees\n    end\nend\n\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [setup v]\nswitch costume to (blank v)\nhide\nswitch costume to (blank v)\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    Clone at x: [1690] y: [500]\nelse\n    if <(LEVEL) = [2]> then\n        Clone at x: [1100] y: [100]\n    else\n        if <(LEVEL) = [3]> then\n            Clone at x: [1900] y: [500]\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 at x: (x) y: (y)\nchange [x v] by (x)\nchange [y v] by (y)\nswitch costume to (open v)\nshow\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<touching (player v)?> and <(timer) > [5]>> then\n    set [exit v] to [win]\nend\n\n@TB\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\nwhen I receive [win v]\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\n\n@Words\n\nwhen flag clicked\nhide\nswitch costume to (sun v)\ncreate clone of (_myself_ v)\nswitch costume to (clouds v)\ncreate clone of (_myself_ v)\nswitch costume to (back v)\nshow\nrepeat until <mouse down?>\n    go to x: ((mouse x) / (50)) y: ((mouse y) / (50))\nend\nbroadcast (Play thee game v)\nhide\nstop [this script v]\n\nwhen I start as a clone\nif <(costume [number v]) = [2]> then\n    show\n    go to [front v] layer\n    repeat until <mouse down?>\n        go to x: ((mouse x) / (30)) y: ((mouse y) / (30))\n    end\n    delete this clone\nelse\n    if <(costume [number v]) = [3]> then\n        show\n        go to [front v] layer\n        repeat until <mouse down?>\n            go to x: ((mouse x) / (15)) y: ((mouse y) / (15))\n        end\n        delete this clone\n    end\nend\n\n@Back\n\nwhen flag clicked\ngo to [back v] layer\n\n@Music\n\nwhen flag clicked\nforever\n    play sound [Popsicle v] until done\nend\n\n