☀️ Polytopia ☀️ - A Mobile-Friendly Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\nforever\n    if <(Level) = [11]> then\n        switch backdrop to (backdrop3 v)\n    end\n    if <(Level) = [14]> then\n        switch backdrop to (backdrop1 v)\n    end\nend\n\n@Bighead \n\nchange y by (-1)\nchange x by ((Xv) * (-1))\nchange y by (5)\n\nwhen I receive [let’s do dis v]\nNewton\n\nwhen flag clicked\npoint in direction (90)\nhide\n\nwhen I receive [start v]\nshow\nset size to (50) %\ngo to x: (-11) y: (-3)\n\nwhen I receive [next v]\nrepeat (5)\n    turn right (15) degrees\n    change size by (-3)\nend\nnext costume\nrepeat (5)\n    turn left (15) degrees\n    change size by (3)\nend\n\nwhen I receive [previous v]\nrepeat (5)\n    turn right (15) degrees\n    change size by (-3)\nend\nswitch costume to ((costume [number v]) - (1))\nrepeat (5)\n    turn left (15) degrees\n    change size by (3)\nend\n\nwhen I receive [start v]\nwait (1) seconds\nforever\n    play sound [Dreams v] until done\nend\n\n\n\ndefine Wall detection\nchange y by (-5)\nchange x by ((Xv) * (-1.7))\nif <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <([abs v] of (Xv) ) > [.2]> then\n        if <(Xv) > [0]> then\n            set [xv v] to [-6]\n        else\n            set [xv v] to [6]\n        end\n        set [yv v] to [14]\n    else\n        if <(Xv) < [-.2]> then\n            set [yv v] to [-3]\n            set [xv v] to [0]\n        end\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume2 v)\n\nset x to (36)\n\ndefine Newton\nset size to (30) %\nshow\nset rotation style [left-right v]\nset [xv v] to [0]\nset [locked v] to [1]\nset [yv v] to [0]\ngo to x: (-226) y: (-70)\nforever\n    change [yv v] by (-1)\n    if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        point in direction (90)\n        change [xv v] by (0.6)\n    end\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        point in direction (-90)\n        change [xv v] by (-0.6)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            Wall detection\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Yv)\n    if <touching (ground v)?> then\n        change y by ((Yv) - ((Yv) * (2)))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching (ground v)?> then\n        if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [yv v] to [12]\n        end\n    end\n    change y by (1)\n    if <<touching (portal v)?> and <(Locked) = [0]>> then\n        go to x: (-226) y: (-70)\n        broadcast (DYEET v)\n    end\n    if <touching (moomoo v)?> then\n        broadcast (Reset v)\n    end\n    if <touching (bounce pad v)?> then\n        set [yv v] to [30]\n    end\n    if <key (r v) pressed?> then\n        broadcast (Reset v)\n    end\n    if <<(y position) < [-131]> and <not <(Level) = [8]>>> then\n        broadcast (Reset v)\n    end\n    if <touching (sprite5 v)?> then\n        broadcast (Reset v)\n    end\n    if <touching (sprite13 v)?> then\n        change [xv v] by (5)\n    end\n    if <touching (sprite14 v)?> then\n        change y by (([abs v] of (Xv) ) + (1))\n        change [yv v] by (0.01)\n        if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            change [yv v] by (3)\n            set [yv v] to ((Yv) * (0.9))\n        else\n            change [yv v] by (-0.2)\n        end\n        if <(volume) = [100]> then\n            set volume to (30) %\n        end\n    else\n        if <(volume) = [30]> then\n            set volume to (100) %\n        end\n    end\n    if <<touching (key v)?> and <<(Locked) = [1]> and <(Costume) = [0]>>> then\n        set [locked v] to [0]\n        broadcast (Net v)\n    end\nend\n\n\n\nwhen I receive [reset v]\ngo to x: (-226) y: (-70)\nset [locked v] to [1]\nset [yv v] to [0]\nset [xv v] to [0]\nset volume to (100) %\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nrepeat (10)\n    change size by (-2)\n    change [ghost v] effect by (7)\nend\ndelete this clone\n\n@Ground\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [let’s do dis v]\nshow\n\nwhen I receive [yeet v]\nnext costume\n\n@Bounce pad\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [dyeet v]\nnext costume\n\n@Sprite5\n\nwhen flag clicked\nshow\ngo to [back v] layer\nswitch costume to (costume1 v)\nforever\n    if <(Level) > [10]> then\n        go to [front v] layer\n    else\n        go to [back v] layer\n    end\nend\n\nwhen I receive [yeet v]\nshow\nshow\nnext costume\n\n@Sprite8\n\nwhen flag clicked\nshow\n\nwhen I receive [let’s do dis v]\nhide\n\n@Sprite9\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\n\nwhen this sprite clicked\nbroadcast (Next v)\n\nwhen I receive [let’s do dis v]\nhide\n\n@Sprite6\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nset [level v] to [0]\ngo to [back v] layer\nset [ghost v] effect to (50)\nforever\n    if <(Level) = [9]> then\n        set [ghost v] effect to (0)\n    else\n        set [ghost v] effect to (50)\n    end\nend\n\nwhen I receive [let’s do dis v]\nshow\n\nwhen I receive [yeet v]\nnext costume\n\n@Sprite11\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\n\nwhen this sprite clicked\nbroadcast (Let’s do dis v)\nhide\n\n@Sprite13\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [yeet v]\nnext costume\n\n@Sprite14\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    go to [back v] layer\n    go to [back v] layer\n    go to [back v] layer\n    show\nend\n\nwhen I receive [yeet v]\nnext costume\n\n@Sprite10\n\nwhen I receive [start v]\nshow\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nbroadcast (Previous v)\n\nwhen I receive [let’s do dis v]\nhide\n\n@Sprite16\n\nwhen flag clicked\nhide\n\nforever\nend\n\nwhen I receive [let’s do dis v]\nshow\ngo to [front v] layer\n\nwhen this sprite clicked\nbroadcast (Reset v)\n\nwhen flag clicked\nforever\n    point in direction ((([cos v] of ((tic) * (1.4)) ) * (5)) + (90))\n    change y by (([cos v] of ((tic) * (2.1)) ) * (1.4))\n    change size by (([cos v] of ((tic) * (1.4)) ) * (0.3))\n    change [tic v] by (5)\nend\n\n@intro\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    set size to (0) %\n    wait (0.1) seconds\n    show\n    go to [front v] layer\n    repeat until <(round (size)) = [100]>\n        change size by (((100) - (size)) * (.2))\n    end\n    wait (1) seconds\n    hide\n    delete this clone\nelse\n    if <(costume [number v]) = [2]> then\n        set size to (0) %\n        wait (0.2) seconds\n        show\n        go to [front v] layer\n        repeat until <(round (size)) = [100]>\n            change size by (((100) - (size)) * (.2))\n        end\n        wait (1) seconds\n        hide\n        delete this clone\n    else\n        if <(costume [number v]) = [3]> then\n            set size to (0) %\n            wait (0.3) seconds\n            show\n            go to [front v] layer\n            repeat until <(round (size)) = [100]>\n                change size by (((100) - (size)) * (.2))\n            end\n            wait (1.8) seconds\n            delete this clone\n        else\n            if <(costume [number v]) = [4]> then\n                go to x: (0) y: (500)\n                point in direction (180)\n                set size to (120) %\n                wait (0.8) seconds\n                show\n                go to [front v] layer\n                repeat until <<(round (y position)) = [0]> and <(round (direction)) = [90]>>\n                    change y by (((0) - (y position)) * (.2))\n                    turn right (((90) - (direction)) * (.2)) degrees\n                end\n                set [size vel v] to [100]\n                repeat (30)\n                    change size by (size vel)\n                    set [size vel v] to (((size vel) * (0.8)) + (((100) - (size)) * (0.15)))\n                end\n                wait (0.1) seconds\n                hide\n                delete this clone\n            else\n                if <(costume [number v]) = [5]> then\n                    go to x: (0) y: (-500)\n                    set size to (100) %\n                    wait (2.2) seconds\n                    show\n                    go to [front v] layer\n                    repeat until <(round (y position)) = [0]>\n                        change y by (((0) - (y position)) * (.2))\n                    end\n                    wait (0.01) seconds\n                    hide\n                    delete this clone\n                else\n                    if <(costume [number v]) = [6]> then\n                        go to x: (0) y: (-500)\n                        set size to (100) %\n                        wait (2.3) seconds\n                        show\n                        go to [front v] layer\n                        repeat until <(round (y position)) = [0]>\n                            change y by (((0) - (y position)) * (.2))\n                        end\n                        broadcast (introMusicStop v)\n                        repeat (20)\n                            change [ghost v] effect by (5)\n                        end\n                        broadcast (Start v)\n                        hide\n                        delete this clone\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [intromusicstop v]\nrepeat (50)\n    change volume by (-1)\nend\nstop all sounds\nwait (0.2) seconds\nset volume to (100) %\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\ngo to [front v] layer\nshow list [output text v]\nswitch costume to (1 v)\nwait (0.5) seconds\nrepeat (6)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen flag clicked\nset volume to (0) %\nwait (0.17) seconds\nset volume to (100) %\nplay sound [UNSPEAKABLEGAMING-INTRO-SONG-FULL-SOUNDTRACK-.mp3 v] until done\n\n@Sprite7\n\nwhen flag clicked\nhide\ngo to [back v] layer\nforever\n    go to (bighead  v)\nend\n\nwhen I receive [let’s do dis v]\nshow\n\n@Portal\n\nwhen flag clicked\ngo to [back v] layer\nhide\nforever\n    if <<(Locked) = [1]> and <not <(Level) = [14]>>> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume3 v)\n    end\nend\n\ncreate clone of (_myself_ v)\nforever\n\nturn right (15) degrees\nwait (0.1) seconds\n\nwhen I start as a clone\nforever\n\ndefine Position portal\nshow\nif <(Level) = [0]> then\n    go to x: (138) y: (-51)\nend\nif <(Level) = [3]> then\n    go to x: (-9) y: (-11)\nend\nif <(Level) = [5]> then\n    go to x: (-122) y: (140)\nend\nif <(Level) = [6]> then\n    go to x: (70) y: (-51)\nend\nif <(Level) = [7]> then\n    go to x: (180) y: (-29)\nend\nif <(Level) = [9]> then\n    go to x: (210) y: (120)\nend\nif <(Level) = [8]> then\n    go to x: (203) y: (-113)\nend\nif <(Level) = [10]> then\n    go to x: (210) y: (120)\nend\nif <(Level) = [11]> then\n    go to x: (190) y: (-38)\nend\nif <(Level) = [12]> then\n    go to x: (144) y: (-41)\nend\nif <(Level) = [13]> then\n    go to x: (111) y: (-52)\nend\nif <(Level) = [14]> then\n    hide\nend\n\nwhen I receive [let’s do dis v]\nforever\n    broadcast (Portal position v)\nend\n\nset size to (100) %\nturn left (15) degrees\nwait (0.1) seconds\n\nwhen I receive [portal position v]\nPosition portal\n\n@Key\n\nwhen flag clicked\ngo to [back v] layer\nhide\ngo to x: (-205) y: (126)\nforever\n    broadcast (Position v)\n    if <touching (bighead  v)?> then\n        hide\n        set [locked v] to [0]\n    end\n    if <(Locked) = [1]> then\n        show\n    end\nend\n\nwhen I receive [let’s do dis v]\nforever\n    Portal position \nend\n\ndefine Portal position \npoint in direction (90)\nif <(Level) = [0]> then\n    go to x: (-205) y: (126)\nend\nif <(Level) = [1]> then\n    go to x: (-205) y: (145)\nend\nif <(Level) = [2]> then\n    point in direction (180)\n    go to x: (36) y: (-22)\nend\nif <(Level) = [3]> then\n    go to x: (96) y: (80)\n    point in direction (90)\nend\nif <(Level) = [4]> then\n    go to x: (170) y: (130)\nend\nif <(Level) = [5]> then\n    go to x: (149) y: (-50)\nend\nif <(Level) = [6]> then\n    go to x: (128) y: (108)\nend\nif <(Level) = [7]> then\n    go to x: (155) y: (42)\nend\nif <(Level) = [8]> then\n    go to x: (-216) y: (128)\nend\nif <(Level) = [10]> then\n    go to x: (-201) y: (12)\nend\nif <(Level) = [12]> then\n    go to x: (92) y: (136)\nend\nif <(Level) = [13]> then\n    go to x: (74) y: (15)\nend\nif <[] = [14]> then\n    hide\nend\n\nwhen I receive [dyeet v]\nshow\nset [locked v] to [1]\n\nwhen I receive [let’s do dis v]\nshow\n\n@Sprite17\n\nwhen flag clicked\ngo to [back v] layer\nset size to (30) %\nhide\n\nwhen I start as a clone\nshow\ngo to (bighead  v)\nturn right (pick random (0) to (360)) degrees\nrepeat (15)\n    move (5) steps\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen I receive [let’s do dis v]\nforever\n    go to [back v] layer\n    create clone of (_myself_ v)\nend\n\n@Sprite3\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to [front v] layer\ngo [forward v] (545622145621) layers\n\nshow\n\nset [ghost v] effect to (0)\n\n@Sprite15\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\nwhen I receive [dyeet v]\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nbroadcast (Yeet v)\nchange [level v] by (1)\nwait (1) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\n\nshow\n\nhide\n\n@Sprite18\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [let’s do dis v]\nforever\n    create clone of (_myself_ v)\n    wait (0.5) seconds\nend\n\nwhen I start as a clone\nshow\ngo to (random position v)\ngo [backward v] (32) layers\ngo to [back v] layer\ngo [backward v] (1) layers\nset [ghost v] effect to (pick random (25) to (80))\nset size to (pick random (30) to (50)) %\nrepeat (20)\n    change size by (5)\nend\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <[] = [11]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [14]> then\n        switch costume to (costume2 v)\n    end\nend\n\n@Moomoo\n\nwhen flag clicked\nset rotation style [left-right v]\ngo to x: (-9) y: (-70)\nhide\n\ngo to x: (-66) y: (-70)\n\nwhen I receive [let’s do dis v]\nforever\n    if <(Level) = [10]> then\n        show\n        glide (3) secs to x: (102) y: (-68)\n        point in direction (-90)\n        glide (3) secs to x: (-66) y: (-70)\n        point in direction (90)\n    else\n        hide\n    end\nend\n\nif  then\nend\n\n@560BF1E4-9268-4F8E-9AD3-2AF953D70F48\n\nwhen flag clicked\ngo to [front v] layer\ngo [forward v] (5) layers\nset [ghost v] effect to (100)\n\n
Epilepsy Warning: The second room involves some flashes of light and may cause discomfort.\n\nLeft / Right Arrow Keys: Move Left / Right\nUp Arrow Key: Jump\nDown Arrow Key: Open Doors, Advance Text\n\nTry to get to the end - the ending is beautiful, and I will not spoil it! If you play the game and see the ending, don't spoil it yourself! Beating the game gives you a special surprise!\n\nCheck out my other game, too!\nhttps://scratch.mit.edu/projects/56173200/\n\nIf you find a bug, please report it in the comments!