Scrolling Platformer Game | Scratch Scrolling Platformer copy-2
@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [, ] ((mouse y) + (SCROLL Y))))\nshow variable [mouse v]\n\nwhen I receive [changebackdrop v]\nif <(LEVEL) = [1]> then\n    switch backdrop to (newbackground2048x1536 v)\nend\nif <(LEVEL) = [2]> then\n    switch backdrop to (newbackground2048x2 v)\nend\nif <(LEVEL) = [3]> then\n    switch backdrop to (backdrop_3 v)\nend\nif <(LEVEL) = [4]> then\n    switch backdrop to (newbackground2048x1536 v)\nend\nif <(LEVEL) = [5]> then\n    switch backdrop to (backdrop_3 v)\nend\nif <(LEVEL) = [6]> then\n    switch backdrop to (backdrop_2 v)\nend\n\nwhen flag clicked\nset [level v] to [1]\nswitch backdrop to (newbackground2048x1536 v)\nforever\n    set volume to (50) %\n    play sound [videogame music v] until done\nend\n\n@Laggy\n\n@Player\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [activate rock trap v] to [N]\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) and wait\n    end\n    if <(EXIT) = [Win]> then\n        Game-Win\n    else\n        Game-Die\n        set [activate rock trap v] to [N]\n        change [deaths v] by (1)\n    end\nend\n\ndefine Game On\nset [x v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [sx v] to [0]\nset [exit v] to []\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset size to (50) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    point in direction (-90)\n    change [sx v] by (-2)\nend\nif <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n    point in direction (90)\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 (w v) pressed?> or <key (up arrow 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)\nTrap-Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [Die]\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 <(y) < [-180]> then\n    set [exit v] to [Die]\nend\nif <(ACTIVATE ROCK TRAP) = [N]> then\n    if <<(LEVEL) = [3]> and <(x) > [590]>> then\n        set [activate rock trap v] to [Y]\n    end\n    if <<(LEVEL) = [5]> and <(x) > [170]>> then\n        set [activate rock trap v] to [Y]\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 (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)\nchange [in air v] by (1)\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\n\ndefine Trap-Die\nif <touching (danger v)?> then\n    set [exit v] to [Die]\n    start sound [crunch v]\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)\nset [activate rock trap v] to [N]\nwait (1) seconds\nbroadcast (changeBackdrop v) and wait\n\nwhen I receive [player die v]\nset [exit v] to [Die]\n\nwhen [timer v] > (STOP TIMER)\nhide\n\nwhen I receive [start game v]\nswitch costume to (costume1 v)\nset [deaths v] to [0]\nbroadcast (changeBackdrop v) and wait\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [bounce v]\nset [sy v] to [30]\nChange Player Y By (sy)\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]\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nend\nif <(LEVEL) = [2]> then\n    switch costume to (level 2 1 v)\n    Clone at x: [150] y: [200]\n    Clone at x: [360] y: [100]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (level 3 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nend\nif <(LEVEL) = [4]> then\n    switch costume to (level 4 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nend\nif <(LEVEL) = [5]> then\n    switch costume to (level 5 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [145]\n    Clone at x: [360] y: [200]\n    Clone at x: [360] y: [100]\n    Clone at x: [360] y: [50]\nend\nif <(LEVEL) = [6]> then\n    switch costume to (level 1 1 v)\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\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]\nset [x v] to [0]\nset [y v] to [0]\nhide\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nend\nif <(LEVEL) = [2]> then\n    switch costume to (level 2 1 v)\n    Clone at x: [150] y: [200]\n    Clone at x: [360] y: [100]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (level 3 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nend\nif <(LEVEL) = [4]> then\n    switch costume to (level 4 1 v)\n    Clone at x: [360] y: [0]\nend\nif <(LEVEL) = [5]> then\n    switch costume to (level 5 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [145]\n    Clone at x: [360] y: [200]\n    Clone at x: [360] y: [100]\n    Clone at x: [360] y: [50]\nend\nif <(LEVEL) = [6]> then\n    switch costume to (level 6 1 v)\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\n@Colectables\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    change [collected v] by (1)\n    start sound [collect v]\n    if <(COLLECTED) = (COINS)> then\n        broadcast (Open Portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [coins v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    Clone at x: [-170] y: [10]\n    Clone at x: [100] y: [40]\n    Clone at x: [311] y: [60]\n    Clone at x: [611] y: [20]\n    Clone at x: [611] y: [104]\n    Clone at x: [730] y: [50]\n    Clone at x: [1025] y: [-20]\nend\nif <(LEVEL) = [2]> then\n    Clone at x: [-79] y: [-76]\n    Clone at x: [166] y: [232]\n    Clone at x: [226] y: [232]\n    Clone at x: [191] y: [270]\n    Clone at x: [428] y: [339]\n    Clone at x: [543] y: [396]\n    Clone at x: [635] y: [481]\nend\nif <(LEVEL) = [3]> then\n    Clone at x: [-75] y: [0]\n    Clone at x: [56] y: [-65]\n    Clone at x: [250] y: [-10]\n    Clone at x: [685] y: [20]\n    Clone at x: [910] y: [-60]\n    Clone at x: [988] y: [60]\n    Clone at x: [1120] y: [168]\nend\nif <(LEVEL) = [4]> then\n    Clone at x: [-175] y: [5]\n    Clone at x: [80] y: [40]\n    Clone at x: [370] y: [60]\n    Clone at x: [550] y: [75]\n    Clone at x: [715] y: [195]\n    Clone at x: [815] y: [90]\n    Clone at x: [910] y: [90]\nend\nif <(LEVEL) = [5]> then\n    Clone at x: [-90] y: [0]\n    Clone at x: [370] y: [220]\n    Clone at x: [340] y: [-35]\n    Clone at x: [810] y: [130]\n    Clone at x: [1470] y: [460]\n    Clone at x: [1920] y: [530]\n    Clone at x: [2295] y: [480]\nend\nset [x v] to [-999999999]\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\n    next costume\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 [coins v] by (1)\nset size to (20) %\ncreate clone of (_myself_ v)\n\nwhen flag clicked\n\nforever\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 Portal]> and <touching (player v)?>> then\n    start sound [portal v]\n    set [exit v] to [Win]\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) < [6]> then\n    if <(LEVEL) = [1]> then\n        switch costume to (close portal v)\n        Clone at x: [1110] y: [-5]\n    end\n    if <(LEVEL) = [2]> then\n        switch costume to (close portal v)\n        Clone at x: [709] y: [541]\n    end\n    if <(LEVEL) = [3]> then\n        switch costume to (close portal v)\n        Clone at x: [1235] y: [150]\n    end\n    if <(LEVEL) = [4]> then\n        switch costume to (close portal v)\n        Clone at x: [990] y: [50]\n    end\n    if <(LEVEL) = [5]> then\n        switch costume to (close portal v)\n        Clone at x: [2480] y: [360]\n    end\nelse\n    set [x v] to [-9999999999]\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 portal v]\nswitch costume to (open portal v)\n\n@Saw\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\n    set size to (50) %\n    go to [back v] layer\n    turn right (12) degrees\nelse\n    hide\nend\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<touching (player v)?> and <(PLAYER DYING) = [N]>> then\n    set [player dying v] to [Y]\n    broadcast (Player Die v) and wait\n    set [player dying v] to [N]\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)\nswitch costume to (saw1 v)\ncreate clone of (_myself_ v)\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [player dying v] to [N]\nif <(LEVEL) = [2]> then\n    switch costume to (saw v)\n    Clone at x: [65] y: [130]\nend\nif <(LEVEL) = [3]> then\n    switch costume to (saw v)\nend\nif <(LEVEL) = [4]> then\n    switch costume to (saw v)\n    Clone at x: [915] y: [-20]\nend\nif <(LEVEL) = [5]> then\n    switch costume to (saw v)\n    Clone at x: [800] y: [70]\n    Clone at x: [830] y: [70]\nend\nset [x v] to [-999999999]\n\nwhen I start as a clone\nforever\n    next costume\n    wait (0.05) seconds\nend\n\nClone at x: [-63] y: [-85]\nClone at x: [1128] y: [85]\n\n@Play\n\nwhen flag clicked\nset size to (0) %\ngo to x: (0) y: (-90)\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        set [ghost v] effect to (30)\n    else\n        change size by (((100) - (size)) / (3))\n        set [ghost v] effect to (-10)\n    end\nend\n\nwhen flag clicked\nwait until <<touching (mouse-pointer v)?> and <mouse down?>>\nstart sound [pop v]\nhide\nbroadcast (Start Game v)\nstop [this script v]\n\n@Words\n\nwhen flag clicked\nset size to (0) %\ngo to x: (-6) y: (70)\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        set [ghost v] effect to (30)\n    else\n        change size by (((100) - (size)) / (3))\n        set [ghost v] effect to (-10)\n    end\nend\n\nwhen I receive [start game v]\nhide\n\n@You Win\n\nwhen I receive [start game v]\ngo to x: (0) y: (0)\nwait (2) seconds\nwait until <(LEVEL) = [6]>\nwait (1) seconds\nshow\nhide variable [level v]\nbroadcast (Stop Timer v)\n\nwhen I receive [start game v]\nset [timer v] to [0]\nreset timer\nforever\n    set [timer v] to (timer)\nend\n\nwhen I receive [stop timer v]\nstop [other scripts in sprite v]\n\nwhen flag clicked\nhide\nhide variable [timer v]\nhide variable [deaths v]\nhide variable [fps v]\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo [forward v] (99) layers\nhide\nset [stop timer v] to [0.1]\nforever\n    set [stop timer v] to ((timer) + (0.1))\nend\n\nwhen [timer v] > (STOP TIMER)\nhide variable [level v]\nhide variable [timer v]\nhide variable [deaths v]\ngo to x: (0) y: (300)\nshow\nglide (0.5) secs to x: (0) y: (0)\n\nwhen I receive [start game v]\nshow variable [level v]\nshow variable [timer v]\nshow variable [deaths v]\n\n@Trampoline\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    Clone at x: [360] y: [-35]\nend\nif <(LEVEL) = [3]> then\n    Clone at x: [539] y: [-75]\nend\nif <(LEVEL) = [4]> then\n    Clone at x: [300] y: [-40]\nend\nif <(LEVEL) = [5]> then\n    Clone at x: [250] y: [-50]\n    Clone at x: [890] y: [74]\n    Clone at x: [1075] y: [220]\nend\nset [x v] to [-999999999]\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 [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nswitch costume to (springboarddown v)\ncreate clone of (_myself_ v)\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        broadcast (Bounce v)\n        start sound [boing v]\n        repeat (2)\n            next costume\n            wait (0.1) seconds\n        end\n        switch costume to (springboardup v)\n    end\nend\n\n
Hi Guys,\nUse arrow keys to control the player, avoid traps, collect 7 coins go into portal for next level.\nLOV,FAV,FOLLOW