ERUPTION||A Scrolling Platformer

Instructions: CONTROLS:\nARROW KEYS TO MOVE\nBackground Story:\nYou had been working in a island which had a dormant volcano but it suddenly erupted. NOW YOU HAVE TO ESCAPE!!!\n\n\n\n

@Stage\n\nwhen flag clicked\nbroadcast (green flag v)\nbroadcast (setup v)\nbroadcast (Play game v)\n\nwhen flag clicked\nforever\n    play sound [Midnight v] until done\n    wait (1) seconds\nend\n\nwhen I receive [win v]\nstop [other scripts in sprite v]\n\n@blank\n\n@Player\n\ndefine start\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sy v] to [0]\nset [sx v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nswitch costume to (costume1 v)\nset size to (100) %\npoint in direction (90)\nshow\n\ndefine game on\nbroadcast (reset v)\nbroadcast (setup v)\nset [x v] to (checkpoint x)\nset [y v] to (checkpoint y)\nset [scroll x v] to (checkpoint x)\nset [scroll y v] to (checkpoint y)\nset [sx v] to [0]\nswitch costume to (costume1 v)\nset size to (100) %\npoint in direction (90)\nshow\n\ndefine tick\nTest - die\nif <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<mouse down?> and <<(mouse x) < [0]> and <(mouse y) < [170]>>>> then\n    change [sx v] by (-2)\n    point in direction (-90)\nend\nif <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<mouse down?> and <<(mouse x) > [0]> and <(mouse y) < [170]>>>> then\n    change [sx v] by (2)\n    point in direction (90)\nend\nif <<<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <key (space 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\nif <<key (s v) pressed?> and <(score visible) = [0]>> then\n    set [score visible v] to [1]\n    hide list [scores v]\nelse\n    if <<key (s v) pressed?> and <(score visible) = [1]>> then\n        set [score visible v] to [0]\n        show list [scores v]\n    end\nend\nif <key (0 v) pressed?> then\n    delete all of [scores v]\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 <(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)) / (4)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL X) > [8926]> then\n    set [scroll x v] to [8926]\nend\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nchange [scroll y v] by (round ((((y) - (SCROLL Y)) + (50)) / (7)))\nposition\nTest - die\n\nwhen I receive [play game v]\nshow variable [timer v]\ngo to [front v] layer\nset [checkpoint x v] to [0]\nset [checkpoint y v] to [0]\nbroadcast (reset v) and wait\nbroadcast (setup v) and wait\nstart\nforever\n    tick\n    broadcast (tick v)\n    go to [front v] layer\n    set [player x v] to (x position)\n    set [player y v] to (y position)\n    set [player d v] to (direction)\n    if <(EXIT) = [DIE]> then\n        game over\n    end\n    if <(EXIT) = [WIN]> then\n        go to [back v] layer\n        broadcast (WIN v)\n        stop [this script v]\n    end\nend\n\ndefine Test - die\nif <<(y position) < [-179]> or <touching (obstacles v)?>> then\n    set [exit v] to [DIE]\nelse\n    if <touching (helicopter v)?> then\n        add (Timer) to [scores v]\n        hide variable [timer v]\n        set [exit v] to [WIN]\n        broadcast (WIN v)\n        stop [this script v]\n    else\n        clear graphic effects\n    end\nend\n\ndefine change player x by (sx)\nchange [x v] by (sx)\nposition\nif <touching (platform v)?> then\n    repeat (12)\n        change [y v] by (1)\n        position\n        if <not <touching (platform v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    repeat until <not <touching (platform 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 change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nposition\nrepeat until <not <touching (platform 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 game over\nstart sound [Basketball Bounce v]\nstart\ngame on\n\nhide\n\n@platform\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((platform: x) - (SCROLL X)) ((platform: y) - (SCROLL Y))\n\nwhen I receive [setup v]\ngo to [back v] layer\nset size to (100) %\nhide\nset [platform: x v] to [0]\nset [platform: y v] to [0]\nswitch costume to (level 1 1 v)\ngo to [front v] layer\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [120]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [120]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [174]\nclone at x: [470] y: [0]\nclone at x: [470] y: [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]\ngo to [front v] layer\n\ndefine clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [platform: x v] by (x)\nchange [platform: y v] by (y)\nnext costume\n\nwhen I receive [hide v]\nhide\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [the eend v]\nstop [other scripts in sprite v]\nswitch costume to (level 1 1 v)\ngo to x: (0) y: (0)\n\nwhen flag clicked\nhide\n\n@obstacles\n\nwhen I receive [green flag v]\ngo to [front v] layer\nhide\n\nwhen I receive [tick v]\nposition ((spike: x) - (SCROLL X)) ((spike: y) - (SCROLL Y))\n\nwhen I receive [setup v]\nset size to (100) %\nhide\nset [spike: x v] to [0]\nset [spike: y v] to [0]\nswitch costume to (level 1 1 v)\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [120]\nclone at x: [470] y: [0]\nclone at x: [470] y: [120]\nclone at x: [470] y: [0]\nclone at x: [470] y: [0]\nclone at x: [470] y: [174]\nclone at x: [470] y: [0]\nclone at x: [470] y: [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)\ncreate clone of (_myself_ v)\nchange [spike: x v] by (x)\nchange [spike: y v] by (y)\nnext costume\n\nwhen I receive [hide v]\nhide\n\nwhen flag clicked\nhide\n\n@Sprite1\n\nwhen flag clicked\nforever\n    go to x: ((round ((0) - (SCROLL X))) * (0.03)) y: ((round ((0) - (SCROLL Y))) * (0.003))\nend\n\n@sparks\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nset size to (pick random (30) to (100)) %\ngo to [front v] layer\nshow\ngo to x: (230) y: (pick random (-200) to (200))\npoint in direction (pick random (-105) to (-75))\nrepeat (5)\n    change [ghost v] effect by (pick random (-3) to (-10))\nend\nrepeat until <(x position) < [-235]>\n    move (10) steps\nend\nrepeat (5)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\n    wait (0.5) seconds\nend\n\n@Checkpoint 1\n\nwhen I receive [green flag v]\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to [284]\n        set [checkpoint y v] to [-8]\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((Checkpoint 1: x) - (SCROLL X)) ((Checkpoint 1: y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\nset [checkpoint 1: x v] to [0]\nset [checkpoint 1: y v] to [0]\nclone at x: [300] y: [-75]\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\ndefine clone at x: (x) y: (y)\nset [checkpoint 1: x v] to (x)\nset [checkpoint 1: y v] to (y)\n\n@Checkpoint 2\n\nwhen I receive [green flag v]\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to (my x)\n        set [checkpoint y v] to ((my y) + (30))\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((my x) - (SCROLL X)) ((my y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\ngo to x: [991] y: [-68]\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\ndefine go to x: (x) y: (y)\nset [my x v] to (x)\nset [my y v] to (y)\n\n@Checkpoint 3\n\nwhen I receive [green flag v]\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to (my x)\n        set [checkpoint y v] to ((my y) + (30))\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((my x) - (SCROLL X)) ((my y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\ngo to x: [1884] y: [-68]\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\ndefine go to x: (x) y: (y)\nset [my x v] to (x)\nset [my y v] to (y)\n\n@Checkpoint 4\n\nwhen I receive [green flag v]\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to (my x)\n        set [checkpoint y v] to ((my y) + (30))\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((my x) - (SCROLL X)) ((my y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\ngo to x: [3030] y: [-68]\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\ndefine go to x: (x) y: (y)\nset [my x v] to (x)\nset [my y v] to (y)\n\n@TB\n\nwhen flag clicked\nreset timer\nhide\nforever\n    set [timer v] to (timer)\nend\n\nwhen [timer v] > (Timer)\nhide variable [timer v]\ngo to [front v] layer\nshow\n\nwhen flag clicked\n\nforever\n    if <(Timer) < [50]> then\n    end\nend\n\n@Checkpoint 5\n\nwhen I receive [green flag v]\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to (my x)\n        set [checkpoint y v] to ((my y) + (30))\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((my x) - (SCROLL X)) ((my y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\ngo to x: [4487] y: [-68]\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\ndefine go to x: (x) y: (y)\nset [my x v] to (x)\nset [my y v] to (y)\n\n@Checkpoint 6\n\nwhen I receive [green flag v]\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to (my x)\n        set [checkpoint y v] to ((my y) + (30))\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((my x) - (SCROLL X)) ((my y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\ngo to x: [5132] y: [43]\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\ndefine go to x: (x) y: (y)\nset [my x v] to (x)\nset [my y v] to (y)\n\n@Checkpoint 7\n\nwhen I receive [green flag v]\nwait (1) seconds\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to (my x)\n        set [checkpoint y v] to ((my y) + (30))\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((my x) - (SCROLL X)) ((my y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\ngo to x: [6646] y: [159]\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\ndefine go to x: (x) y: (y)\nset [my x v] to (x)\nset [my y v] to (y)\n\n@Checkpoint 8\n\nwhen I receive [green flag v]\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to (my x)\n        set [checkpoint y v] to ((my y) + (30))\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((my x) - (SCROLL X)) ((my y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\ngo to x: [7375] y: [320]\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\ndefine go to x: (x) y: (y)\nset [my x v] to (x)\nset [my y v] to (y)\n\n@Checkpoint 9\n\nwhen I receive [green flag v]\nswitch costume to (checkpoint 1 v)\ngo to [front v] layer\nshow\nforever\n    if <touching (player v)?> then\n        set [checkpoint x v] to (my x)\n        set [checkpoint y v] to ((my y) + (30))\n        switch costume to (animation f1 v)\n        start sound [Connect v]\n        repeat (10)\n            next costume\n        end\n        switch costume to (checkpoint achieved v)\n        stop [this script v]\n    end\nend\n\nset size to (100) %\n\nwhen I receive [tick v]\nposition ((my x) - (SCROLL X)) ((my y) - (SCROLL Y))\n\nwhen I receive [setup v]\npoint in direction (90)\nclear graphic effects\nset size to (80) %\nhide\ngo to x: [7985] y: [330]\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\ndefine go to x: (x) y: (y)\nset [my x v] to (x)\nset [my y v] to (y)\n\n@sign\n\nwhen I receive [green flag v]\ngo to [front v] layer\nhide\n\nwhen I receive [tick v]\nposition ((sign: x) - (SCROLL X)) ((sign: y) - (SCROLL Y))\nif <(costume [number v]) = [1]> then\n    if <touching (player v)?> then\n        say [WASD, Arrow Keys or Mobile to move.] for (0) seconds\n    end\nelse\n    if <(costume [number v]) = [2]> then\n        if <touching (player v)?> then\n            say [Get to the helicopter to escape the eruption] for (0) seconds\n        end\n    else\n        if <<(costume [number v]) = [3]> or <(costume [number v]) = [4]>> then\n            if <touching (player v)?> then\n                say [DO NOT TOUCH SPIKES OR LAVA!] for (0) seconds\n            end\n        end\n    end\nend\n\nwhen I receive [setup v]\nset size to (100) %\nhide\nshow\nset [sign: x v] to [0]\nset [sign: y v] to [-3]\nswitch costume to (level 1 1 v)\nclone at x: [250] y: [-3]\nclone at x: [100] y: [-3]\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 [sign: x v] by (x)\nchange [sign: y v] by (y)\nnext costume\n\n@helicopter\n\nwhen flag clicked\nforever\n    Position ((my x) - (SCROLL X)) ((my y) - (SCROLL 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\n@Sprite3\n\nwhen flag clicked\ngo to [front v] layer\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [win v]\nif <(timer) < (☁ Global highscore)> then\n    set [☁ global highscore v] to (timer)\nend\nstop all sounds\ngo to [front v] layer\nshow\nplay sound [Vicetone - United We Dance v] until done\nstop [all v]\n\nwhen I receive [green flag v]\ngo to [front v] layer\nstop [other scripts in sprite v]\nhide\n\n