Little Square's Adventure


@Stage\n\nwhen flag clicked\nwait until <(Start) = []>\nwait until <(Screen) = []>\nset [next level v] to [0]\nset [restart v] to [0]\nset [level v] to [1]\nset [screen v] to [Gameplay]\nset [start v] to [1]\nforever\n    play sound [TheFatRat - Monody \(feat. Laura Brehm\).mp3 v] until done\nend\n\n@Level\n\nwhen flag clicked\nset [start v] to []\nset [screen v] to []\nforever\n    if <(Start) = [1]> then\n        if <(Screen) = [Gameplay]> then\n            go to [front v] layer\n            switch costume to (Level)\n            set [current level v] to (Level)\n            go [backward v] (10) layers\n            go to x: (0) y: (0)\n            show\n            repeat until <<not <(Start) = [1]>> or <not <(Screen) = [Gameplay]>>>\n                if <not <(Current Level) = (Level)>> then\n                    switch costume to (Level)\n                    set [current level v] to (Level)\n                end\n                if <touching (player v)?> then\n                    broadcast (Touching Floor v)\n                end\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\n@Player\n\nwhen flag clicked\nset [start v] to []\nset [screen v] to []\nforever\n    if <(Start) = [1]> then\n        if <(Screen) = [Gameplay]> then\n            Position Player\n            set [direction v] to [1]\n            show\n            repeat until <<not <(Start) = [1]>> or <not <(Screen) = [Gameplay]>>>\n                switch costume to (3 v)\n                go to [front v] layer\n                if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                    change [xv v] by (1)\n                    set [direction v] to [1]\n                end\n                if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                    change [xv v] by (-1)\n                    set [direction v] to [2]\n                end\n                set [xv v] to ((Xv) * (0.9))\n                change x by (Xv)\n                Touching Conditions\n                Touching Floor\n                change [yv v] by (-1)\n                change y by (Yv)\n                if <touching (level v)?> then\n                    change y by ((Yv) * (-1))\n                    set [yv v] to [0]\n                    Touching Conditions\n                end\n                change y by (-4)\n                Jump Conditons\n                Touching Conditions\n                change y by (4)\n                switch costume to (Direction)\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\ndefine Jump Conditons\nif <touching (level v)?> then\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [yv v] to [14]\n    end\nend\n\ndefine Position Player\ngo to x: (-220) y: (-19)\nrepeat until <not <touching (level v)?>>\n    change y by (-1)\nend\n\ndefine Touching Floor\nif <touching (level v)?> then\n    change y by (1)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change x by ((Xv) * (-1))\n                        change y by (-5)\n                        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                            if <(Xv) > [0]> then\n                                set [xv v] to [-5]\n                                Touching Conditions\n                            else\n                                set [xv v] to [5]\n                                Touching Conditions\n                            end\n                            set [yv v] to [10]\n                            Touching Conditions\n                        else\n                            set [xv v] to [0]\n                            Touching Conditions\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Touching Conditions\nif <touching color (#485d8b)?> then\n    set [yv v] to [20]\nend\nif <<touching color (#437340)?> or <touching color (#d8592f)?>> then\n    set [restart v] to [1]\nend\nif <<touching color (#926199)?> or <touching color (#6e4973)?>> then\n    set [next level v] to [1]\nend\n\nwhen flag clicked\nforever\n    if <(Start) = [1]> then\n        if <(Screen) = [Gameplay]> then\n            repeat until <<not <(Start) = [1]>> or <not <(Screen) = [Gameplay]>>>\n                Touching Conditions\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\nwhen I receive [touching floor v]\nTouching Conditions\n\n@Level Scenery\n\nwhen flag clicked\nset [start v] to []\nset [screen v] to []\nforever\n    if <(Start) = [1]> then\n        if <(Screen) = [Gameplay]> then\n            set [current level v] to (Level)\n            switch costume to (Level)\n            go [backward v] (500) layers\n            go to x: (0) y: (0)\n            show\n            repeat until <<not <(Start) = [1]>> or <not <(Screen) = [Gameplay]>>>\n                if <not <(Current Level) = (Level)>> then\n                    go [backward v] (500) layers\n                    switch costume to (Level)\n                    set [current level v] to (Level)\n                end\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\n@Level Logic\n\nwhen flag clicked\nset [start v] to []\nset [screen v] to []\nforever\n    if <(Start) = [1]> then\n        if <(Screen) = [Gameplay]> then\n            repeat until <<not <(Start) = [1]>> or <not <(Screen) = [Gameplay]>>>\n                if <(Restart) = [1]> then\n                    set [restart v] to [0]\n                    set [screen v] to [Restart]\n                    wait (0.0001) seconds\n                    set [screen v] to [Gameplay]\n                end\n                if <(Next Level) = [1]> then\n                    set [next level v] to [0]\n                    set [screen v] to [Next Level]\n                    change [level v] by (1)\n                    wait (0.0001) seconds\n                    set [screen v] to [Gameplay]\n                end\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\ndefine Level Skip\nif <(username) = [Kilonap]> then\n    if <key (h v) pressed?> then\n        wait until <not <key (h v) pressed?>>\n        ask [Which level would you like to skip to?] and wait\n        set [screen v] to [Next Level]\n        set [level v] to (answer)\n        wait (0.0001) seconds\n        set [screen v] to [Gameplay]\n    end\nend\n\nwhen flag clicked\nset [start v] to []\nset [screen v] to []\nforever\n    if <(Start) = [1]> then\n        if <(Screen) = [Gameplay]> then\n            repeat until <<not <(Start) = [1]>> or <not <(Screen) = [Gameplay]>>>\n                Level Skip\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\n@Gem Count\n\nwhen flag clicked\nset [start v] to []\nset [screen v] to []\nforever\n    if <(Start) = [1]> then\n        if <(Screen) = [Gameplay]> then\n            set [current level v] to (Level)\n            switch costume to (Level)\n            go to [front v] layer\n            go to x: (-1) y: (-283)\n            show\n            repeat until <<not <(Start) = [1]>> or <not <(Screen) = [Gameplay]>>>\n                if <not <(Current Level) = (Level)>> then\n                    switch costume to (Level)\n                    set [current level v] to (Level)\n                end\n                if <touching (player v)?> then\n                    set [ghost v] effect to (80)\n                    wait until <not <touching (player v)?>>\n                    set [ghost v] effect to (0)\n                end\n            end\n        else\n            hide\n        end\n    else\n        hide\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\n