The Night || A Scrolling Platformer
@Stage\n\nwhen flag clicked\nhide variable [??? v]\nswitch backdrop to (1 v)\nforever\n    play sound (pick random (1) to (2)) until done\nend\n\nwhen I receive [reset v]\nif <(backdrop [number v]) = [3]> then\n    set [ghost v] effect to (20)\nend\n\nwhen I receive [win v]\nhide variable [time v]\nset [??? v] to (TIME)\nshow variable [??? v]\nswitch backdrop to (backdrop1 v)\n\n@Level\n\nwhen I start as a clone\n\nwhen I start as a clone\nif <(costume [number v]) = [11]> then\n    forever\n        repeat (150)\n            change [x v] by (2)\n        end\n        repeat (150)\n            change [x v] by (-2)\n        end\n    end\nend\n\nwhen I receive [green flag v]\nhide\nswitch backdrop to (1 v)\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Position (x) (y)\nset [brightness v] effect to (-100)\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 [setip v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (2-1 v)\n        Clone at x: [480] y: [0]\n        Clone at x: [480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (3-1 v)\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n        else\n            switch costume to (end v)\n        end\n    end\nend\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\n\n    forever\n        repeat (120)\n            change [x v] by (-2)\n        end\n        clear graphic effects\n        repeat (120)\n            change [x v] by (2)\n        end\n    end\nend\n\nwhen I receive [win v]\nif  then\n    delete this clone\nend\nstop [other scripts in sprite v]\n\n\n    forever\n        repeat (120)\n            change [x v] by (-3)\n        end\n        clear graphic effects\n        repeat (120)\n            change [x v] by (3)\n        end\n    end\nend\n\nset [scroll x v] to [0]\n\ncreate clone of (_myself_ v)\n\nif <(LEVEL) = [4]> then\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\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 (Setip v) and wait\n    Game on\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v) and wait\n    end\n    if <(EXIT) = [Win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\ndefine Game on\npoint in direction (90)\nset rotation style [left-right v]\nset [x v] to [-122]\nset [y v] to [0]\nset [speed y v] to [0]\nset [speed x v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset size to (10) %\nclear graphic effects\nshow\n\ndefine Tick\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [speed x v] by (-2)\n    point in direction (-90)\nend\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [speed x v] by (2)\n    point in direction (90)\nend\nset [speed x v] to ((Speed x) * (0.8))\nif <([abs v] of (Speed x) ) > [0.9]> then\n    Change player x by (round (Speed x))\nend\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <(in air) < [4]> then\n        set [speed y v] to [16]\n    end\nend\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <touching (water v)?> then\n        set [speed y v] to [10]\n    end\nend\nif <<key (down arrow v) pressed?> or <<mouse down?> and <(y position) > (mouse y)>>> then\n    if <touching (water v)?> then\n        set [speed y v] to [-10]\n    end\nend\nif <(Speed y) > [-20]> then\n    change [speed y v] by (-2)\nend\nChange player y by (Speed y)\nTest - Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL X) > [960]> then\n    set [scroll x v] to [960]\nend\nif <touching (bounce v)?> then\n    set [speed y v] to [26]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <<<touching (spikes v)?> or <touching (lava v)?>> or <touching (blades v)?>> then\n    set [exit v] to [Die]\nend\nchange [effect v] by (.02)\n\ndefine Change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (level 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 [speed y 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 (level v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (level v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    set [speed x v] to [0]\n    repeat until <not <touching (level 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\nclear graphic effects\nset rotation style [all around v]\nrepeat (20)\n    turn right (15) degrees\n    change y by (10)\n    change [ghost v] effect by (5)\n    broadcast (Tick v) and wait\nend\nset [exit v] to []\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 (-0.25)\n    change [ghost v] effect by (2)\n    broadcast (Tick v) and wait\nend\nhide\nclear graphic effects\nchange [level v] by (1)\nwait (1) seconds\n\ndefine Test - Die\n\nwhen I receive [win v]\nif  then\n    hide\nend\nstop [other scripts in sprite v]\n\nwhen [r v] key pressed\nset [exit v] to [Die]\n\nif <(SCROLL Y) < [0]> then\n\nif <(LEVEL) = [5]> then\n    set [scroll x v] to [0]\n    set [scroll y v] to [0]\nend\n\nwhen I start as a clone\nclear graphic effects\nset [brightness v] effect to (-100)\nrepeat (10)\n    Position ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\ndefine Position (x) (y)\nset [brightness v] effect to (-50)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\ncreate clone of (_myself_ v)\n\n@Spikes\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 [setip 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: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2-1 v)\n        Clone at x: [480] y: [0]\n        Clone at x: [480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3-1 v)\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 3-6 v)\n            else\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\nset [brightness v] effect to (-50)\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 receive [win v]\nif  then\n    delete this clone\nend\nstop [other scripts in sprite v]\n\nwhen I start as a clone\nif <(costume [number v]) = [11]> then\n    forever\n        repeat (150)\n            change [x v] by (2)\n        end\n        clear graphic effects\n        repeat (150)\n            change [x v] by (-2)\n        end\n    end\nend\n\n@Light Source\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 [setip v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [ghost v] effect to (10)\ngo to [back v] layer\nif <(LEVEL) = [1]> then\n    switch costume to (1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (2-1 v)\n        Clone at x: [480] y: [0]\n        Clone at x: [480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (3-1 v)\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (end v)\n            else\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to [back v] layer\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 receive [win v]\nif  then\n    delete this clone\nend\nstop [other scripts in sprite v]\n\nwhen I start as a clone\nif <(costume [number v]) = [12]> then\n    forever\n        go to [back v] layer\n        repeat (150)\n            change [x v] by (2)\n        end\n        clear graphic effects\n        repeat (150)\n            change [x v] by (-2)\n        end\n    end\nend\n\nClone at x: [480] y: [0]\nClone at x: [480] y: [0]\nClone at x: [480] y: [0]\nClone at x: [480] y: [0]\n\n@Thumbnail\n\nwhen [timer v] > (0.01)\nclear graphic effects\nshow\nswitch costume to (costume2 v)\nset size to (100) %\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nrepeat (20)\n    go to [front v] layer\n    change [ghost v] effect by (-5)\nend\ngo to [front v] layer\n\nwhen flag clicked\nforever\n    hide\n    set [ghost v] effect to (100)\n    reset timer\n    switch costume to (costume1 v)\n    set size to (120) %\n    switch costume to (dot3 v)\nend\n\n@Grass\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 [setip v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [ghost v] effect to (30)\ngo to [front v] layer\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2-1 v)\n        Clone at x: [480] y: [0]\n        Clone at x: [480] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (3-1 v)\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n            Clone at x: [480] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (end v)\n            else\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\nset [brightness v] effect to (-100)\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 receive [win v]\nif  then\n    delete this clone\nend\nstop [other scripts in sprite v]\n\nwhen I start as a clone\nif <(costume [number v]) = [11]> then\n    forever\n        repeat (150)\n            change [x v] by (2)\n        end\n        clear graphic effects\n        repeat (150)\n            change [x v] by (-2)\n        end\n    end\nend\n\n@Lava\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 [setip 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: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\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 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\ngo to [back v] layer\nforever\n    set [ghost v] effect to (0)\n    set [brightness v] effect to (-50)\n    repeat (20)\n        change [y v] by (-0.5)\n    end\n    repeat (20)\n        change [y v] by (0.5)\n    end\nend\n\n@Bounce\n\nwhen I receive [green flag v]\nhide\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\nif <touching (player v)?> then\n    switch costume to (close flag3 v)\nelse\n    switch costume to (close flag v)\nend\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 [setip v]\nhide\ngo to [back v] layer\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    Clone at x: [888] y: [-78]\n    Clone at x: [1347] y: [-28]\nelse\n    if <(LEVEL) = [2]> then\n        Clone at x: [403] y: [25]\n    else\n        if <(LEVEL) = [3]> then\n            Clone at x: [-122] y: [-74]\n            Clone at x: [226] y: [20]\n            Clone at x: [582] y: [-68]\n            Clone at x: [1144] y: [-75]\n        else\n            Clone at x: [1720] y: [-75]\n            Clone at x: [1951] y: [-75]\n        end\n    end\nend\nset [x v] to [-99999]\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nswitch costume to (close flag3 v)\nswitch costume to (close flag2 v)\nswitch costume to (close flag v)\n\nrepeat (2)\n    next costume\nend\nrepeat (2)\n    switch costume to ((costume [number v]) - (1))\nend\n\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<(costume [name v]) = [Open]> and <touching (player v)?>> then\n    set [exit v] to [Win]\nend\n\nwhen I receive [setip v]\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (closed v)\n    Clone at x: [1144] y: [184]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (closed v)\n        Clone at x: [936] y: [90]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (closed v)\n            Clone at x: [861] y: [418]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (closed v)\n                set [x v] to [-99999]\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 at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open exit v]\nswitch costume to (open v)\n\ndelete this clone\n\n@Coins\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nnext costume\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    change [collected v] by (1)\n    if <(COLLECTED) = (COLLECT MAX)> then\n        broadcast (Open exit v)\n    end\n    delete this clone\nend\n\nwhen I receive [setip v]\nhide\nset [collected v] to [0]\nset [collect max v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (dot v)\n    Clone at x: [-15] y: [0]\n    Clone at x: [200] y: [0]\n    Clone at x: [451] y: [59]\n    Clone at x: [608] y: [121]\n    Clone at x: [676] y: [121]\n    Clone at x: [811] y: [-52]\n    Clone at x: [990] y: [142]\n    Clone at x: [1108] y: [7]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (dot v)\n        Clone at x: [-212] y: [33]\n        Clone at x: [6] y: [-22]\n        Clone at x: [130] y: [79]\n        Clone at x: [251] y: [-11]\n        Clone at x: [251] y: [200]\n        Clone at x: [526] y: [200]\n        Clone at x: [595] y: [-56]\n        Clone at x: [780] y: [-17]\n        Clone at x: [932] y: [-17]\n        Clone at x: [1070] y: [137]\n        Clone at x: [1170] y: [138]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (dot v)\n            Clone at x: [-217] y: [62]\n            Clone at x: [-50] y: [259]\n            Clone at x: [221] y: [196]\n            Clone at x: [399] y: [119]\n            Clone at x: [565] y: [150]\n            Clone at x: [911] y: [40]\n            Clone at x: [1191] y: [113]\n            Clone at x: [1020] y: [205]\n            Clone at x: [856] y: [310]\n            Clone at x: [1072] y: [313]\n        else\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 at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [collect max v] by (1)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nforever\n    set [display value v] to (join (COLLECTED) (join [ / ] (COLLECT MAX)))\nend\n\nwhen [space v] key pressed\nset [mesee v] to (join ((mouse x) + (SCROLL X)) (join [,] ((mouse y) + (SCROLL Y))))\n\n@LIGHT2\n\nwhen flag clicked\nforever\n    set [weordp v] to [80]\n    repeat (20)\n        change [weordp v] by (0.5)\n    end\n    repeat (20)\n        change [weordp v] by (-0.5)\n    end\nend\n\nwhen I receive [tick v]\ngo to (player v)\ngo to [back v] layer\nset [ghost v] effect to (40)\nset size to ((([size v] of [player v]) - (10)) + (Weordp)) %\n\n@LIGHT3\n\nwhen flag clicked\nforever\n    set [weordp v] to [50]\n    repeat (20)\n        change [weordp v] by (0.5)\n    end\n    repeat (20)\n        change [weordp v] by (-0.5)\n    end\nend\n\nwhen I receive [tick v]\ngo to [back v] layer\nset [ghost v] effect to (20)\nset size to ((([size v] of [player v]) - (10)) + (Weordp)) %\ngo to (player v)\n\n@Blades\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 [setip 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: [480] y: [-88]\n    Clone at x: [600] y: [-88]\n    Clone at x: [720] y: [-88]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2-1 v)\n        Clone at x: [486] y: [17]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3-1 v)\n            Clone at x: [320] y: [0]\n        else\n        end\n    end\nend\nset [x v] to [-99999]\n\ndefine Position (x) (y)\nset [brightness v] effect to (-50)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\npoint in direction (([cos v] of ((Effect) * (120)) ) * (200))\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\n
=========================\nThis is a sequel of Four Seasons || A scrolling platfomer. ( https://scratch.mit.edu/projects/405557881 )\nThere are four levels in this game. Can you complete all? (Except for the last one, it's impossible)\n=========================\nStoryline: You decided to take a walk after dinner, but suddenly, you got lost! You tried to find your way back home, but it didn't work. So you decided to spend the night outside and look for rescue.\n=========================\nCredits to @Griffpatch for the engine\nCredits to @Benelem12 and @TimMcCool for inspiration \nCredits to @-XAF- for music\nCredits to me, @0014049 for everything else\n=========================\nThe levels might be hard, but all of them are possible! I tried them on both PC and iPhone.\n=========================\nTags: #Games #Night #Scrolling #Platformer #Mobile #Friendly #Graphics #Portal #Coins #Player #0014049 #Pi #Person #STGP