Green - A Platformer | Mobile Friendly
@Stage\n\nwhen flag clicked\nswitch backdrop to (empty v)\n\nwhen I receive [game start! v]\nwait (0.5) seconds\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [next v]\nnext backdrop\n\n@Player\n\ndefine fast\nrepeat (6)\n    if <touching (levels v)?> then\n        change y by (1)\n    end\nend\n\ndefine Y Collision\nrepeat until <not <touching (levels v)?>>\n    if <(y) > [0]> then\n        change y by (-1)\n    else\n        change y by (1)\n    end\nend\n\ndefine X Collision\nrepeat until <not <touching (levels v)?>>\n    if <(x) > [0]> then\n        change x by (-1)\n    else\n        change x by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(y position) = [-180]> then\n        set [died? v] to [Yes]\n        start sound [Crunch v]\n        set [y v] to [12]\n        broadcast (fall v)\n        wait (1.5) seconds\n        set [x v] to [0]\n        set [y v] to [0]\n        go to x: (-200) y: (-75)\n    else\n        set [died? v] to [No]\n        if <touching (danger v)?> then\n            set [died? v] to [Yes]\n            broadcast (die v)\n            play sound [Crunch v] until done\n            wait (1) seconds\n            set [x v] to [0]\n            set [y v] to [0]\n        else\n            set [died? v] to [No]\n            if <touching (portal v)?> then\n                start sound [Connect v]\n                change [level v] by (1)\n                broadcast (slide v)\n                wait (1.5) seconds\n            end\n            if <touching (bouncy v)?> then\n                start sound [Water Drop v]\n                set [y v] to [21]\n                if <(Level) = [7]> then\n                    set [y v] to [17]\n                else\n                    set [y v] to [21]\n                end\n            end\n            if <touching (fake v)?> then\n                think [o0f]\n            else\n                think []\n            end\n        end\n    end\nend\n\nwhen I receive [next v]\ngo to x: (-200) y: (-75)\nset [x v] to [0]\nset [y v] to [0]\nclear graphic effects\n\nwhen I receive [die v]\nswitch costume to (costume3 v)\nset [y v] to [12]\nrepeat (12)\n    change [y v] by (-1)\n    turn right (4) degrees\n    change y by (y)\nend\nrepeat (5)\n    change [y v] by (-1)\n    turn right (4) degrees\n    change y by (y)\n    change [ghost v] effect by (20)\nend\nwait (0.5) seconds\nReset\n\nwhen I receive [fall v]\nset [y v] to [16]\nrepeat (12)\n    change [y v] by (-2)\n    turn right (4) degrees\n    change y by (y)\nend\nrepeat (5)\n    change [y v] by (-1)\n    turn right (4) degrees\n    change y by (y)\n    change [ghost v] effect by (20)\nend\nwait (0.5) seconds\nReset\n\nwhen I receive [game start! v]\nswitch costume to (player v)\nshow\ngo to x: (-200) y: (-75)\nwait (0.5) seconds\npoint in direction (90)\nset rotation style [left-right v]\nset [x v] to [0]\nset [y v] to [0]\nset [level v] to [1]\nforever\n    Platformer\nend\n\nwhen flag clicked\nhide\n\ndefine Platformer\nif <(Paused?) = [No]> then\n    if <(Died?) = [No]> then\n        change [y v] by (-1)\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(item (2) of [outputs v]) = [1]>> then\n            change [x v] by (0.8)\n        end\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(item (3) of [outputs v]) = [1]>> then\n            change [x v] by (-0.8)\n        end\n        set [x v] to ((x) * (0.9))\n        change x by (x)\n        if <touching (levels v)?> then\n            fast\n            if <touching (levels v)?> then\n                change y by (-6)\n                X Collision\n                if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(item (1) of [outputs v]) = [1]>> then\n                    set [y v] to [12]\n                    if <([abs v] of (x) ) = (x)> then\n                        set [x v] to [-8]\n                    else\n                        set [x v] to [8]\n                    end\n                else\n                    set [y v] to [0]\n                end\n            end\n        end\n        change y by (y)\n        if <touching (levels v)?> then\n            Y Collision\n            if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(y) < [0]>> or <(item (1) of [outputs v]) = [1]>> then\n                set [y v] to [14]\n            else\n                set [y v] to [0]\n            end\n        end\n    end\nend\n\ndefine Reset\ngo to x: (-200) y: (-75)\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\nset [ghost v] effect to (0)\nswitch costume to (player v)\n\n@Levels\n\nwhen flag clicked\nhide\nswitch costume to (level 1 v)\n\nwhen I receive [next v]\nswitch costume to (Level)\n\nwhen I receive [game start! v]\nshow\n\n@Next\n\nwhen I receive [slide v]\nshow\ngo to [front v] layer\ngo to x: (0) y: (-1000)\nrepeat (40)\n    change y by (((0) - (y position)) / (5))\nend\nbroadcast (next v)\nset y to (1)\nrepeat (8)\n    change y by (y position)\nend\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [you won v]\ngo to x: (0) y: (0)\nstop [other scripts in sprite v]\n\n@Portal\n\nwhen I receive [next v]\nif <(Level) = [2]> then\n    go to x: (219) y: (-49)\nelse\n    if <(Level) = [3]> then\n        go to x: (-203) y: (131)\n    else\n        if <(Level) = [4]> then\n            go to x: (223) y: (-37)\n        else\n            if <(Level) = [5]> then\n                go to x: (-193) y: (144)\n            else\n                if <(Level) = [6]> then\n                    go to x: (218) y: (-36)\n                else\n                    if <(Level) = [7]> then\n                        go to x: (207) y: (-73)\n                    else\n                        if <(Level) = [8]> then\n                            go to x: (210) y: (-48)\n                        else\n                            if <(Level) = [9]> then\n                                go to x: (211) y: (-49)\n                            else\n                                if <(Level) = [10]> then\n                                    go to x: (196) y: (78)\n                                else\n                                    hide\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\ngo to x: (197) y: (-49)\n\nwhen I receive [game start! v]\nshow\nset [speed v] to [0]\nforever\n    if <(Paused?) = [No]> then\n        change [speed v] by (6)\n        point in direction ((([sin v] of (speed) ) * (50)) + (90))\n        delete this clone\n    end\nend\n\n@TN\n\nwhen flag clicked\nset [hide all v] to [no]\ngo to x: (240) y: (0)\nshow\ngo to [front v] layer\ngo [forward v] (3000) layers\nset [ghost v] effect to (100)\n\nwhen I receive [ready v]\nset [hide all v] to [yes]\nrepeat (30)\n    change [xv v] by ((0) - ((x position) / (3)))\n    set [xv v] to ((xv) * (.70))\n    change x by (xv)\nend\nwait (0.3) seconds\nbroadcast (Game Start! v)\n\nwhen I receive [ready v]\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\nwhen I receive [game start! v]\nhide\n\n@Danger\n\nwhen flag clicked\nhide\nswitch costume to (level 1 v)\n\nwhen I receive [next v]\nswitch costume to (Level)\n\nwhen I receive [game start! v]\nshow\n\nwhen I receive [next v]\nif <(Level) = [14]> then\n    hide\nend\n\n@Bouncy\n\nwhen flag clicked\nhide\n\nwhen I receive [next v]\nif <(Level) = [2]> then\n    switch costume to (costume1 v)\n    show\n    go to x: (-150) y: (-121)\nelse\n    if <(Level) = [3]> then\n        switch costume to (costume1 v)\n        hide\n    else\n        if <(Level) = [4]> then\n            switch costume to (costume1 v)\n            hide\n        else\n            if <(Level) = [5]> then\n                switch costume to (costume2 v)\n                show\n                go to x: (0) y: (0)\n            else\n                if <(Level) = [6]> then\n                    switch costume to (costume1 v)\n                    hide\n                else\n                    if <(Level) = [7]> then\n                        switch costume to (costume1 v)\n                        show\n                        go to x: (20) y: (-61)\n                    else\n                        if <(Level) = [8]> then\n                            switch costume to (costume3 v)\n                            show\n                            go to x: (0) y: (-120)\n                        else\n                            if <(Level) = [9]> then\n                                switch costume to (costume1 v)\n                                show\n                                go to x: (12) y: (-79)\n                            else\n                                if <(Level) = [10]> then\n                                    switch costume to (costume1 v)\n                                    show\n                                    go to x: (82) y: (-166)\n                                else\n                                    if <(Level) = [11]> then\n                                        switch costume to (costume1 v)\n                                        show\n                                        go to x: (-118) y: (-85)\n                                    else\n                                        hide\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\n@Fake\n\nwhen flag clicked\ngo to [back v] layer\nhide\n\nwhen I receive [next v]\nif <(Level) = [6]> then\n    show\nelse\n    hide\nend\n\n@Skip button\n\nwhen flag clicked\nhide\n\nwhen I receive [game start! v]\nset [can skip? v] to [2]\ngo to x: (180) y: (-154)\nshow\nforever\n    if <not <(Level) = [11]>> then\n        if <not <(Can skip?) < [1]>> then\n            if <touching (mouse-pointer v)?> then\n                change size by (((125) - (size)) / (2))\n                if <mouse down?> then\n                    change size by (((90) - (size)) / (2))\n                    wait (0.2) seconds\n                    broadcast (slide v)\n                    change [level v] by (1)\n                    change [can skip? v] by (-1)\n                end\n            else\n                change size by (((100) - (size)) / (2))\n            end\n        else\n            set [ghost v] effect to (80)\n        end\n    end\nend\n\nwhen I receive [next v]\nif <(Level) = [11]> then\n    set [ghost v] effect to (80)\n    stop [this script v]\nend\n\nwhen I receive [slide v]\nhide\n\nwhen I receive [next v]\nshow\n\n@Pause button\n\nwhen flag clicked\nhide\ngo to x: (0) y: (-153)\n\nwhen I receive [game start! v]\nset [paused? v] to [No]\nswitch costume to (ll v)\nshow\nforever\n    if <(costume [number v]) = [1]> then\n        if <touching (mouse-pointer v)?> then\n            change size by (((55) - (size)) / (2))\n            if <mouse down?> then\n                change size by (((40) - (size)) / (2))\n                change size by (((45) - (size)) / (2))\n                wait (0.2) seconds\n                switch costume to (|> v)\n                set [paused? v] to [Yes]\n            end\n        else\n            change size by (((40) - (size)) / (2))\n        end\n    else\n        if <(costume [number v]) = [2]> then\n            if <touching (mouse-pointer v)?> then\n                change size by (((55) - (size)) / (2))\n                if <mouse down?> then\n                    change size by (((40) - (size)) / (2))\n                    change size by (((45) - (size)) / (2))\n                    wait (0.2) seconds\n                    switch costume to (ll v)\n                    set [paused? v] to [No]\n                end\n            else\n                change size by (((40) - (size)) / (2))\n            end\n        end\n    end\nend\n\n@Music\n\nwhen flag clicked\ngo to x: (222) y: (160)\nset size to (88) %\nset volume to (100) %\nswitch costume to (on v)\n\nwhen this sprite clicked\nif <(volume) = [100]> then\n    switch costume to (off v)\n    set volume to (0) %\n    repeat (4)\n        set size to ((50) + ((size) / (3))) %\n    end\n    set size to ((60) + ((size) / (3))) %\nelse\n    switch costume to (on v)\n    set volume to (100) %\n    repeat (4)\n        set size to ((50) + ((size) / (3))) %\n    end\n    set size to ((60) + ((size) / (3))) %\nend\n\nwhen I receive [ready v]\nforever\n    play sound [Music v] until done\nend\n\n@Menu\n\nwhen flag clicked\nset size to (500) %\ngo to [back v] layer\ngo to x: (0) y: (0)\nshow\n\nwhen flag clicked\nwait (1) seconds\nforever\n    go to x: ((mouse x) / (10)) y: ((mouse y) / (10))\nend\n\nwhen flag clicked\nset [xv v] to [0]\ngo to x: (240) y: (0)\nforever\n    change [xx v] by ((0) - ((x position) / (3)))\n    set [xx v] to ((xx) * (.70))\n    change x by (xx)\nend\n\nwhen I receive [ready v]\nhide\n\n@Play\n\nwhen this sprite clicked\nstart sound [Connect v]\nbroadcast (Ready v)\nhide\n\nwhen I receive [intro done v]\nwait (0.6) seconds\ngo to [front v] layer\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to ((size) + (((80) - (size)) / (3))) %\n    else\n        set size to ((size) + (((70) - (size)) / (3))) %\n    end\n    if <not <(hide all) = [yes]>> then\n        if <(Menu Ins) = [show]> then\n            hide\n        else\n            show\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nhide\n\n@Instructions\n\nwhen this sprite clicked\nset [menu ins v] to [show]\n\nwhen I receive [intro done v]\nwait (0.6) seconds\ngo to [front v] layer\ngo [forward v] (1) layers\ngo to [front v] layer\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to ((size) + (((80) - (size)) / (3))) %\n        if <mouse down?> then\n            change size by (((40) - (size)) / (2))\n        end\n    else\n        set size to ((size) + (((70) - (size)) / (3))) %\n    end\n    if <not <(hide all) = [yes]>> then\n        if <(Menu Ins) = [show]> then\n            hide\n        else\n            show\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nset [xv v] to [0]\ngo to x: (240) y: (-70)\nforever\n    change [xv v] by ((0) - ((x position) / (3)))\n    set [xv v] to ((xv) * (.70))\n    change x by (xv)\nend\n\nwhen I receive [ready v]\nhide\n\nwhen flag clicked\nhide\n\n@Ins\n\nwhen flag clicked\ngo to x: (0) y: (-3)\nset size to (10) %\ngo [backward v] (10) layers\nforever\n    if <(Menu Ins) = [show]> then\n        show\n        set [ghost v] effect to (0)\n        change size by (((size) - (100)) / (-3))\n    else\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        set [ghost v] effect to (100)\n        set size to (10) %\n        hide\n    end\nend\n\n@Sprite2\n\nwhen this sprite clicked\nset [menu ins v] to [hide]\nstart sound [A Bass v]\n\nwhen flag clicked\nset [menu ins v] to [hide]\ngo to x: (156) y: (109)\ngo to [front v] layer\ngo [forward v] (90000000000) layers\nset [ghost v] effect to (100)\nforever\n    if <(Menu Ins) = [show]> then\n        wait (0.2) seconds\n        show\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    else\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        set [ghost v] effect to (100)\n        hide\n    end\nend\n\n@Intro\n\nwhen flag clicked\nset [ghost v] effect to (0)\nhide\ngo to [front v] layer\nclear graphic effects\nswitch costume to (bg v)\ncreate clone of (_myself_ v)\nwait (0.1) seconds\nswitch costume to (logo v)\ncreate clone of (_myself_ v)\nwait (0.8) seconds\nswitch costume to (text games v)\ncreate clone of (_myself_ v)\nwait (2) seconds\nbroadcast (intro done v)\n\nwhen I start as a clone\nif <(costume [name v]) = [bg]> then\n    go to x: (0) y: (0)\n    set size to (100) %\n    show\nend\nif <(costume [name v]) = [logo]> then\n    point in direction (0)\n    go to x: (0) y: (0)\n    set size to (0) %\n    show\n    start sound [Whoosh v]\n    repeat (20)\n        change size by (((100) - (size)) / (3))\n        turn right (((90) - (direction)) / (3)) degrees\n    end\n    wait (0.1) seconds\n    repeat (30)\n        change x by (((-110) - (x position)) / (3))\n    end\n    wait (0.2) seconds\nend\nif < (costume [name v]) contains [text]?> then\n    go to x: (0) y: (0)\n    set size to (100) %\n    go [backward v] (1) layers\n    show\n    start sound [Bass v]\n    repeat (30)\n        change x by (((40) - (x position)) / (3))\n    end\nend\n\nwhen I receive [intro done v]\nif <(costume [name v]) = [bg]> then\n    wait (0.5) seconds\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\n@joystick\n\nwhen flag clicked\nhide\n\ndefine joystick at (x) (y)\nset [joystick: x v] to (x)\nset [joystick: y v] to (y)\ngo to x: (x) y: (y)\nset size to (100) %\nset [id v] to [stick]\ncreate clone of (_myself_ v)\nset [id v] to [bg]\ncreate clone of (_myself_ v)\nset [id v] to []\nhide\n\nwhen I start as a clone\nshow\nif <(id) = [stick]> then\n    switch costume to (stick v)\n    set [ghost v] effect to (75)\n    \n        if <<mouse down?> and <(IN BG) > [0]>> then\n            point towards (mouse-pointer v)\n            switch costume to (stick2 v)\n            replace item (1) of [outputs v] with (<<(direction) > [-60]> and <(direction) < [60]>> + (0))\n            replace item (2) of [outputs v] with (<<(direction) > [30]> and <(direction) < [150]>> + (0))\n            replace item (3) of [outputs v] with (<<(direction) > [-150]> and <(direction) < [-30]>> + (0))\n        else\n            point in direction (90)\n            switch costume to (stick v)\n            replace item (1) of [outputs v] with [0]\n            replace item (2) of [outputs v] with [0]\n            replace item (3) of [outputs v] with [0]\n        end\n        go to x: (joystick: x) y: (joystick: y)\n    end\nend\nif <(id) = [bg]> then\n    switch costume to (bg v)\n    set [ghost v] effect to (90)\n    \n        if <not <mouse down?>> then\n            set [in bg v] to (<touching (mouse-pointer v)?> + ())\n        end\n        go to x: (joystick: x) y: (joystick: y)\n    end\n    stop [this script v]\nend\n\nwhen I receive [game start! v]\nif <(PC/MOBILE) = [MOBILE]> then\n    delete all of [outputs v]\n    add [] to [outputs v]\n    add [] to [outputs v]\n    add [] to [outputs v]\n    joystick at [-170] [-110]\nend\n\n@PC/MOBILE\n\nwhen flag clicked\nset [pc/mobile v] to [PC]\nshow\nset [cloneid v] to [MOBILE]\ncreate clone of (_myself_ v)\nset [cloneid v] to [PC]\ncreate clone of (_myself_ v)\n\ndefine Button\nif <touching (mouse-pointer v)?> then\n    change size by (((115) - (size)) / (2))\nelse\n    change size by (((100) - (size)) / (2))\nend\n\nwhen I receive [intro done v]\nwait (0.6) seconds\ngo to [front v] layer\nforever\n    if <(hide all) = [no]> then\n        if <(cloneID) = [PC]> then\n            Button\n            go to x: (38) y: (-146)\n            switch costume to (pc v)\n            set [ghost v] effect to (60)\n            if <touching (mouse-pointer v)?> then\n                if <mouse down?> then\n                    set [pc/mobile v] to [PC]\n                    set [ghost v] effect to (10)\n                    start sound [Clicked v]\n                    wait (0.5) seconds\n                end\n            end\n        else\n            if <(cloneID) = [MOBILE]> then\n                Button\n                go to x: (-38) y: (-146)\n                switch costume to (mobile v)\n                set [ghost v] effect to (60)\n                if <touching (mouse-pointer v)?> then\n                    if <mouse down?> then\n                        set [pc/mobile v] to [MOBILE]\n                        set [ghost v] effect to (10)\n                        start sound [Clicked v]\n                        wait (0.5) seconds\n                    end\n                end\n            end\n        end\n    else\n        hide\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (-106)\nset size to (70) %\nshow\nforever\n    if <(hide all) = [no]> then\n        if <(PC/MOBILE) = [PC]> then\n            switch costume to (costume1 v)\n        else\n            switch costume to (costume2 v)\n        end\n    else\n        hide\n    end\nend\n\n