Prison Break || A Scrolling Platformer || Mobile Friendly
@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join ((SCROLL X) + (mouse x)) (join [,] ((SCROLL Y) + (mouse y))))\n\n@Blank\n\n@player\n\nwhen I receive [green flag v]\nhide\ngo to [back v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Set Up 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\nset [checkpoint v] to [0]\nset [x v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [y v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [sx v] to [0]\nset size to (100) %\nshow\nset [ghost v] effect to (0)\n\ndefine tick\nif <key (left arrow v) pressed?> then\n    change [sx v] by (-2)\nend\nif <key (right arrow v) pressed?> then\n    change [sx v] by (2)\nend\nif <(mouse x) > (x position)> then\n    if <mouse down?> then\n        change [sx v] by (2)\n    end\nend\nif <(x position) > (mouse x)> then\n    if <mouse down?> then\n        change [sx v] by (-2)\n    end\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?> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(mouse y) > (y position)> then\n    if <mouse down?> then\n        if <(in air) < [4]> then\n            set [sy v] to [16]\n        end\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nchange player y by (sy)\nTest - Die\nposition\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\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\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 (-10)\n    if <key (up arrow 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    if <(mouse y) > (y position)> then\n        if <mouse down?> 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        end\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 Test - Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\ndefine game win\nstart sound [Win v]\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\nbroadcast (game win !!! v)\nwait (1) seconds\n\nwhen I receive [end of intro. start game v]\nhide\nset [collected v] to [0]\nbroadcast (Play Game v) and wait\nbroadcast (Green Flag v) and wait\n\nwhen flag clicked\nswitch costume to (player v)\nhide\n\nwhen I receive [game win !!! v]\nhide\nstop [other scripts in sprite v]\n\n@Platforms\n\nwhen I receive [green flag v]\ngo to [back v] layer\nhide\n\nwhen I receive [tick v]\ngo to [back v] layer\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [set up v]\nhide\ngo to [back v] layer\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 : [416] y : [0]\n    clone at x : [500] y : [0]\n    clone at x : [500] y : [0]\n    clone at x : [610] y : [0]\n    clone at x : [620] y : [0]\n    clone at x : [610] y : [200]\n    clone at x : [400] y : [200]\n    clone at x : [630] y : [180]\n    clone at x : [605] y : [45]\n    clone at x : [470] y : [-200]\n    clone at x : [750] y : [50]\n    clone at x : [750] y : [300]\n    clone at x : [750] y : [200]\n    clone at x : [600] y : [100]\n    clone at x : [750] y : [50]\n    clone at x : [750] y : [50]\n    clone at x : [750] y : [50]\nelse\n    if <(LEVEL) = [2]> then\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\ngo to [front v] layer\n\nwhen I receive [game win !!! v]\nhide\nstop [other scripts in sprite v]\n\n@Background art\n\nwhen I receive [green flag v]\ngo to [back v] layer\nhide\n\nwhen I receive [tick v]\ngo to [back v] layer\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [set up v]\nhide\ngo to [back v] layer\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    go [backward v] (5) layers\n    switch costume to (level 1 1 v)\n    clone at x : [395] y : [150]\n    clone at x : [360] y : [0]\n    clone at x : [650] y : [-160]\n    clone at x : [610] y : [0]\n    clone at x : [8750] y : [1400]\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)\ngo [backward v] (5) layers\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I receive [game win !!! v]\nhide\nstop [other scripts in sprite v]\n\n@Sprite1\n\nwhen flag clicked\npoint in direction (100)\ngo to x: (186) y: (-144)\nshow\nwait (23) seconds\nhide\n\nwhen flag clicked\nrepeat (40)\n    repeat (10)\n        turn left (2) degrees\n    end\n    repeat (10)\n        turn right (2) degrees\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (80) %\n        set [color v] effect to (50)\n    else\n        set [color v] effect to (0)\n        set size to (70) %\n    end\nend\n\nwhen this sprite clicked\nhide\nbroadcast (skip story mode v)\n\n@Collectables\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    if <(COLLECTED) = (COLLECTED MAX)> then\n        broadcast (Open portal v)\n    end\n    delete this clone\nend\n\nwhen I receive [set up v]\nhide\nset [collected v] to [0]\nset [collected max v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    clone at x : [70] y : [15]\n    clone at x : [140] y : [15]\n    clone at x : [220] y : [15]\n    clone at x : [290] y : [15]\n    clone at x : [330] y : [15]\n    clone at x : [360] y : [73]\n    clone at x : [410] y : [103]\n    clone at x : [460] y : [82]\n    clone at x : [490] y : [30]\n    clone at x : [500] y : [-20]\n    clone at x : [1505] y : [-105]\n    clone at x : [1540] y : [-105]\n    clone at x : [1505] y : [-75]\n    clone at x : [1540] y : [-75]\n    clone at x : [1820] y : [25]\n    clone at x : [1885] y : [50]\n    clone at x : [2055] y : [50]\n    clone at x : [2085] y : [50]\n    clone at x : [3170] y : [390]\n    clone at x : [3210] y : [390]\n    clone at x : [3250] y : [390]\n    clone at x : [5615] y : [610]\n    clone at x : [5665] y : [610]\n    clone at x : [5935] y : [620]\n    clone at x : [5990] y : [620]\n    clone at x : [6135] y : [550]\n    clone at x : [6190] y : [550]\n    clone at x : [6440] y : [700]\n    clone at x : [6490] y : [700]\n    clone at x : [6540] y : [700]\n    clone at x : [7260] y : [1030]\n    clone at x : [7310] y : [1030]\n    clone at x : [9040] y : [1420]\n    clone at x : [9090] y : [1420]\n    clone at x : [9265] y : [1290]\n    clone at x : [9480] y : [1460]\n    clone at x : [9520] y : [1460]\n    clone at x : [9560] y : [1460]\n    clone at x : [10170] y : [1210]\n    clone at x : [10250] y : [1250]\n    clone at x : [10300] y : [1250]\n    set [collected max v] to [40]\nelse\nend\nset [y 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 [collected max v] by (1)\ncreate clone of (_myself_ v)\n\nwhen I receive [game win !!! v]\nhide\nstop [other scripts in sprite v]\n\n@Story mode\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nswitch costume to (1 v)\npoint in direction (90)\nset size to (0) %\nrepeat (7)\n    repeat (15)\n        change size by (((100) - (size)) / (4))\n    end\n    set size to (100) %\n    wait (1.5) seconds\n    go to x: (0) y: (0)\n    set [x v] to [0]\n    repeat (10)\n        change [x v] by (-5)\n        change x by (x)\n        point in direction ((90) + ((x position) / (6)))\n        change size by (-5)\n    end\n    go to x: (455) y: (0)\n    set size to (100) %\n    next costume\n    start sound [Low Whoosh v]\n    repeat (18)\n        change x by (((0) - (x position)) / (4))\n        point in direction ((90) + ((x position) / (6)))\n    end\n    point in direction (90)\n    set [next v] to [0]\n    go to x: (0) y: (0)\nend\nwait (1) seconds\nbroadcast (end of intro. start game v)\nhide\n\nwhen I receive [skip story mode v]\nhide\nstop [other scripts in sprite v]\nbroadcast (end of intro. start game v)\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\nend\n\n@Game win !!1\n\nwhen I receive [game win !!! v]\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nshow\nswitch costume to (blank v)\nset size to (150) %\nswitch costume to (win screen v)\nrepeat until <(size) < [101]>\n    go to [front v] layer\n    switch costume to (blank v)\n    change size by (((100) - (size)) / (7))\n    switch costume to (win screen v)\n    change [ghost v] effect by (-5)\n    set x to (((((pick random (0) to (1)) * (2)) - (1)) * ((size) - (100))) * (0.75))\n    set y to (((((pick random (0) to (1)) * (2)) - (1)) * ((size) - (100))) * (0.75))\nend\ngo to x: (0) y: (0)\ndraw (round ((TIME) - (2)))\ngo to x: (0) y: (0)\nwait (3) seconds\nset [@id v] to [button]\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nhide\n\n@collected and M colec\n\nwhen flag clicked\nhide variable [collected v]\nhide variable [collected max v]\nhide variable [ongoing timer v]\nhide variable [final timer v]\nhide variable [☁ world record v]\nhide\n\nwhen I receive [end of intro. start game v]\nshow variable [collected v]\nshow variable [collected max v]\nshow variable [ongoing timer v]\nshow\n\nwhen I receive [game win !!! v]\nhide variable [collected v]\nhide variable [collected max v]\nhide variable [ongoing timer v]\nshow variable [final timer v]\nshow variable [☁ world record v]\nhide\n\nwhen I receive [game win !!! v]\nset [final timer v] to (ONGOING TIMER)\n\n@Exit\n\nwhen I receive [green flag v]\ngo to [back v] layer\nswitch costume to (closed v)\nhide\n\nwhen I receive [tick v]\ngo to [back v] layer\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 [set up v]\ngo to [back v] layer\nswitch costume to (closed v)\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    clone at x : [10455] y : [1315]\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 v)\n\nwhen flag clicked\ngo to [back v] layer\nswitch costume to (closed v)\nhide\n\n@Danger\n\nwhen I receive [green flag v]\ngo to [back v] layer\nhide\n\nwhen I receive [tick v]\ngo to [back v] layer\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [set up v]\nhide\ngo to [back v] layer\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 : [416] y : [0]\n    clone at x : [500] y : [0]\n    clone at x : [500] y : [0]\n    clone at x : [610] y : [0]\n    clone at x : [620] y : [0]\n    clone at x : [610] y : [200]\n    clone at x : [400] y : [200]\n    clone at x : [630] y : [180]\n    clone at x : [605] y : [45]\n    clone at x : [470] y : [-200]\n    clone at x : [750] y : [50]\n    clone at x : [750] y : [300]\n    clone at x : [750] y : [200]\n    clone at x : [600] y : [100]\n    clone at x : [750] y : [50]\n    clone at x : [750] y : [50]\n    clone at x : [750] y : [50]\nelse\n    if <(LEVEL) = [2]> then\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\ngo to [front v] layer\n\n@Time & WC\n\nwhen I receive [end of intro. start game v]\nreset timer\nset [ongoing timer v] to [0]\nset [final timer v] to [0]\nforever\n    set [ongoing timer v] to (round (timer))\nend\n\nwhen flag clicked\nset [ongoing timer v] to [0]\nset [final timer v] to [0]\n\nwhen I receive [game win !!! v]\nset [☁ world record v] to [99999]\nforever\n    if <(FINAL TIMER) < (☁ World Record)> then\n        set [☁ world record v] to (FINAL TIMER)\n    end\nend\n\n@When stop clicked code\n\nwhen flag clicked\ngo to x: (00) y: (0)\ngo to [front v] layer\nhide\n\nwhen [timer v] > (1.2)\nif <(exit) = [reg]> then\n    if <<(current [hour v]) < [19]> and <(current [hour v]) > [7]>> then\n        switch costume to (day v)\n    else\n        switch costume to (night v)\n    end\n    set [ghost v] effect to (100)\n    show\n    go to [front v] layer\n    repeat (10)\n        go to [front v] layer\n        change [ghost v] effect by (-10)\n    end\nend\n\n@Music\n\nwhen flag clicked\nforever\n    play sound [vexento-masked-heroes v] until done\nend\n\n
       ✿ PRISON BREAK ✿\n      ✿ A Scrolling Platformer ✿\n\n                             ✦✦✦ Info ✦✦✦\nLagging ? Play here with less lag\nhttps://scratch.mit.edu/projects/513500469/\n\nWelcome to the PRISON BREAK - A Platformer !!! Collect coins to escape from the prison and rejoice your victory. Make sure to watch out for dangerous critters! Reach to safer lands outside the prison !!!\nThis took me over 2 months to make and a lot of hard work has been put on it. This has over 750+ blocks so pls like, fav and follow !!! Sorry for the lag :(\n___________________________________________\n\n        ✦✦✦ How this project came to reality ✦✦✦\n\nI was indeed working on a Scrolling platformer but had no theme to it. Whatever I thought of was not possible or wasn't up to the mark and soon i played an escape game online and this idea sparked !!! Can we get this top loved guys ?!?!\nPropose it to be featured here https://scratch.mit.edu/studios/4228481/\n___________________________________________\n\n       ✦✦✦ How to play ✦✦✦\n➜ Jump over Spike, Lava and other dangers \n➜ Collect coins \n➜ You cannot win without collecting all the coins\n➜ Use arrow keys to move\n➜ Tap for mobile controls\n➜ Send your fastest time in the comments section\n➜ World Records are stored in cloud data\n➜ If you break the record then comment below\n___________________________________________\n      \n        ✦✦✦ Credits ✦✦✦\n➜ Basic Scrolling Engine by @griffpatch (laptop)\n➜ Mobile controls by @rishavscratchwork\n➜ 80% art by @rishavscratchwork\n➜ 50% code by me (remaining @griffpatch)\n➜ Art inspiration by @StratfordJames \n➜ Story mode script by @rishavscratchwork\n➜ Thx to @jas6kaur6, @RockstarNimesh & \n    @TheSpankingLegend for testing\n➜ Thumbnail text from www.cooltext.com\n➜ World Record scripts by @rishavscratchwork\n➜ Player art by @rishavscratchwork\n➜ Song - Vexento Masked Heroes\n___________________________________________\n\n          ✦✦✦ Tags ✦✦✦\n#all #games #platformer #scrolling #prison #escape #fun #adventure #cool #awesome #hard #superb #amazing\n\nUmmm .... any more tags needed ??