PIXEL PLATFORMER

Instructions: Welcome to Pixel Platformer!\n\n- WASD or Arrow Keys to move\n- You can Double Jump as well as Wall Jump\n- Collect all the coins to unlock the door and move on to the next level\n- Avoid spikes\n- Love, favorite and Follow!\n- Tell me if there are any glitches\n- Don't cheat\n- Have fun! :D

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nhide variable [level v]\n\nwhen flag clicked\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [beginning v]\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [last lvl v]\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [start v]\nshow variable [level v]\nforever\n    play sound [background music v] until done\nend\n\nwhen I receive [normal lvl v]\nswitch backdrop to (backdrop1 v)\n\n@player\n\ndefine Touch Ground\nif <(Yv) > [0]> then\n    repeat until <not <touching (ground v)?>>\n        change y by (-1)\n        set [yv v] to [0]\n    end\nelse\n    repeat until <not <touching (ground v)?>>\n        change y by (1)\n        set [yv v] to [0]\n        set [falling v] to [0]\n        set [jump v] to [0]\n    end\nend\nDouble Jump\n\ndefine Touch Wall\nrepeat (10)\n    if <touching (ground v)?> then\n        change y by (1)\n    end\nend\nif <touching (ground v)?> then\n    change x by ((round (Xv)) * (-1))\n    change y by (-10)\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n        if <(Xv) > [0]> then\n            set [xv v] to [-5]\n        else\n            set [xv v] to [5]\n        end\n        set [yv v] to [10]\n    else\n        set [xv v] to [0]\n    end\nend\n\ndefine Reset\ngo to x: (-147) y: (-21)\nset size to (200) %\nshow\nclear graphic effects\nset [xv v] to [0]\nset [yv v] to [0]\nset [falling v] to [0]\nset [jump v] to [0]\nset [jump key v] to [0]\nset [collected v] to [0]\nset [in level v] to [1]\nbroadcast (Construct Level v)\n\ndefine Double Jump\nif <<<(falling) > [0]> and <(falling) < [10]>> and <(Yv) < [0]>> then\n    set [jump v] to [1]\nend\nchange y by (-1)\nif <<<key (w v) pressed?> or <key (up arrow v) pressed?>> and <<<touching (ground v)?> or <(falling) < [5]>> and <<(jump) = [0]> and <(jump key) = [0]>>>> then\n    set [yv v] to [12]\n    set [jump v] to [1]\n    set [jump key v] to [1]\n    start sound [Jump v]\nend\nchange y by (1)\nif <<<key (w v) pressed?> or <key (up arrow v) pressed?>> and <<(jump) = [1]> and <(jump key) = [0]>>> then\n    set [yv v] to [12]\n    set [jump v] to [2]\n    set [jump key v] to [1]\n    start sound [Jump v]\nend\n\nwhen flag clicked\nhide\n\ndefine fade\nset [ghost v] effect to (0)\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nset [ghost v] effect to (100)\nwait (0.5) seconds\n\ndefine Detect Door\nif <<touching (door v)?> and <(OK) = [1]>> then\n    start sound [Connect v]\n    wait (0.05) seconds\n    set [in level v] to [0]\n    fade\n    broadcast (Next Level v)\n    change [level v] by (1)\n    broadcast (Construct Level v)\n    Reset\n    wait until <not <touching (door v)?>>\n    set [in level v] to [1]\nend\n\ndefine Detect Obstacles\nif <touching (obstacle v)?> then\n    start sound [Disconnect v]\n    wait (0.05) seconds\n    set [in level v] to [0]\n    fade\n    broadcast (Delete clones v)\n    broadcast (Construct Level v)\n    Reset\n    wait until <not <touching (door v)?>>\n    set [in level v] to [1]\nend\n\nwhen I receive [start v]\nbroadcast (Construct Level v)\n\nbroadcast (Delete clones v) and wait\n\nwhen I receive [start v]\nset [level v] to [1]\nReset\nforever\n    if <(in Level) = [1]> then\n        broadcast (Game v)\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            change [xv v] by (1)\n        end\n        if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n            change [xv v] by (-1)\n        end\n        set [xv v] to ((Xv) * (0.84))\n        change x by (round (Xv))\n        Touch Wall\n        change [yv v] by (-1)\n        change [falling v] by (1)\n        change y by (Yv)\n        Touch Ground\n        if <not <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n            set [jump key v] to [0]\n        end\n        Detect Door\n        Detect Obstacles\n    end\nend\n\n@coin\n\nwhen flag clicked\nhide\n\nwhen I receive [construct level v]\nset [total v] to [0]\nif <(Level) = [1]> then\n    switch costume to (pixil-frame-0 v)\n    Make coin [66] [-110]\n    Make coin [0] [-110]\nelse\n    if <(Level) = [2]> then\n        switch costume to (pixil-frame-0 v)\n        Make coin [-100] [-110]\n        Make coin [-58] [-110]\n        Make coin [3] [40]\n        Make coin [59] [-110]\n        Make coin [-140] [35]\n    else\n        if <(Level) = [3]> then\n            switch costume to (pixil-frame-0 v)\n            Tall Line [-130] [-100]\n            Make coin [-90] [45]\n            Tall Line [7] [-66]\n        else\n            if <(Level) = [4]> then\n                switch costume to (pixil-frame-0 v)\n                Make coin [-72] [20]\n                Make coin [-72] [-20]\n                Make coin [-30] [-35]\n                Make coin [42] [43]\n                Make coin [42] [83]\n                Make coin [117] [35]\n            else\n                if <(Level) = [5]> then\n                    switch costume to (pixil-frame-0 v)\n                    Tall Line [-40] [-95]\n                    Tall Line [181] [-99]\n                    Make coin [30] [47]\n                    Make coin [-50] [105]\n                    Make coin [-15] [105]\n                else\n                    if <(Level) = [6]> then\n                        switch costume to (pixil-frame-2 v)\n                        Make coin [-11] [49]\n                        Make coin [27] [168]\n                        Make coin [143] [40]\n                        Make coin [113] [40]\n                        Make coin [-192] [157]\n                    else\n                        if <(Level) = [7]> then\n                            switch costume to (pixil-frame-2 v)\n                            Tall Line [-27] [-99]\n                            Make coin [28] [16]\n                            Tall Line [98] [4]\n                        else\n                            if <(Level) = [8]> then\n                                switch costume to (pixil-frame-2 v)\n                                switch backdrop to (backdrop2 v)\n                                Make coin [-103] [-2 ]\n                                Make coin [-15] [79]\n                                Make coin [64] [150]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Make coin (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [total v] by (1)\nhide\nstop [this script v]\n\nwhen [space v] key pressed\nshow variable [mousex v]\nshow variable [mousey v]\nset [mousex v] to (mouse x)\nset [mousey v] to (mouse y)\n\nwhen [q v] key pressed\nhide variable [mousex v]\nhide variable [mousey v]\n\nwhen I start as a clone\nforever\n    show\n    go to [front v] layer\n    if <(collect?) = [1]> then\n        repeat until <touching (_edge_ v)?>\n            change [collecty v] by (-1)\n            show\n            change y by (collecty)\n        end\n        delete this clone\n    end\nend\n\nwhen I start as a clone\nset [collecty v] to [0]\nset [collect? v] to [0]\nshow\nforever\n    if <touching (player v)?> then\n        start sound [Coin v]\n        set [collecty v] to [10]\n        change [collected v] by (1)\n        set [collect? v] to [1]\n        wait until <not <touching (player v)?>>\n        stop [this script v]\n    end\nend\n\nwhen I receive [delete clones v]\ndelete this clone\n\ndefine Tall Line (x) (y)\nMake coin (x) (y)\nMake coin (x) ((y) + (40))\nMake coin (x) ((y) + (80))\nMake coin (x) ((y) + (120))\n\n@ground\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [construct level v]\nswitch costume to (join [costume] (Level))\nif <(Level) = [8]> then\n    broadcast (last lvl v)\n    switch backdrop to (backdrop2 v)\nelse\n    broadcast (normal lvl v)\n    switch backdrop to (backdrop1 v)\nend\n\nif  then\nend\n\n\nwhen I receive [start v]\nshow\n\n@obstacle\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nhide\n\nwhen I receive [construct level v]\nswitch costume to (join [costume] (Level))\n\nif <[] = [1]> then\n\nwhen I receive [start v]\nshow\n\n@door\n\nwhen flag clicked\nset size to (40) %\ngo to [back v] layer\nhide\n\nwhen I receive [game v]\nif <(Total) = (Collected)> then\n    switch costume to (costume1 v)\n    set [ok v] to [1]\nelse\n    switch costume to (costume2 v)\n    set [ok v] to [0]\nend\n\nwhen I receive [construct level v]\nif <(Level) = [1]> then\n    show\n    go to x: (201) y: (-98)\nelse\n    if <(Level) = [4]> then\n        show\n        go to x: (183) y: (111)\n    else\n        if <(Level) = [5]> then\n            show\n            go to x: (138) y: (42)\n        else\n            if <(Level) = [6]> then\n                show\n                go to x: (-222) y: (99)\n            else\n                if <(Level) = [7]> then\n                    show\n                    go to x: (-12) y: (111)\n                else\n                    if <(Level) = [8]> then\n                        show\n                        go to x: (201) y: (-98)\n                    else\n                        if <(Level) = [9]> then\n                            hide\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start v]\nshow\n\n@GameSurf\n\nwhen flag clicked\nstart sound [Ocean Wave v]\nset size to (160) %\nhide\nwait (0.5) seconds\ngo to x: (415) y: (20)\nshow\nglide (0.8) secs to x: (8) y: (20)\nwait (1) seconds\nhide\nbroadcast (Beginning v)\n\nwhen [up arrow v] key pressed\nchange y by (1)\n\nwhen [down arrow v] key pressed\nchange y by (-1)\n\n@Play\n\nwhen I receive [beginning v]\ngo to x: (115) y: (-124)\nset size to (70) %\nshow\ngo to [front v] layer\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (100) %\n        switch costume to (costume2 v)\n    else\n        set size to (70) %\n        switch costume to (costume1 v)\n    end\nend\n\nwhen this sprite clicked\nstart sound [Hand Clap v]\nhide\nbroadcast (Start v)\n\nwhen flag clicked\nhide\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\nwhen I receive [beginning v]\nshow\ngo to [back v] layer\ngo to x: (0) y: (0)\n\nwhen I receive [start v]\nhide\n\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\n\n