Adventure - A Platformer 

Instructions: Arrow keys or WASD to move.\nR to reset if you lag out.

@Stage\n\nwhen flag clicked\nforever\n    play sound [DJVI - Bouncing v] until done\nend\n\n@Ground\n\nwhen flag clicked\nhide\n\nwhen I receive [gamestart v]\nshow\nforever\n    switch costume to (lvl)\nend\n\n@Portal\n\nwhen flag clicked\nset [sine v] to [0]\nset [lvl v] to [1]\nhide\n\nwhen I receive [gamestart v]\nset [ghost v] effect to (30)\nshow\ncreate clone of (_myself_ v)\nforever\n    change [sine v] by (7.5)\n    if <(lvl) = [1]> then\n        go to x: (208) y: ((([sin v] of (Sine) ) * (3)) + (95))\n    else\n        if <(lvl) = [2]> then\n            go to x: (-132) y: ((([sin v] of (Sine) ) * (3)) + (95))\n        else\n            if <(lvl) = [3]> then\n                go to x: (-190) y: ((([sin v] of (Sine) ) * (3)) + (110))\n            else\n                if <(lvl) = [4]> then\n                    go to x: (-195) y: ((([sin v] of (Sine) ) * (3)) + (140))\n                else\n                    if <(lvl) = [5]> then\n                        go to x: (90) y: ((([sin v] of (Sine) ) * (3)) + (-40))\n                    else\n                        if <(lvl) = [6]> then\n                            go to x: (180) y: ((([sin v] of (Sine) ) * (3)) + (130))\n                        else\n                            hide\n                        end\n                    end\n                end\n            end\n        end\n    end\n    turn left (5) degrees\nend\n\nwhen I start as a clone\nset [ghost v] effect to (30)\nshow\nforever\n    if <(lvl) = [1]> then\n        go to x: (208) y: ((([sin v] of (Sine) ) * (3)) + (95))\n    else\n        if <(lvl) = [2]> then\n            go to x: (-132) y: ((([sin v] of (Sine) ) * (3)) + (95))\n        else\n            if <(lvl) = [3]> then\n                go to x: (-190) y: ((([sin v] of (Sine) ) * (3)) + (110))\n            else\n                if <(lvl) = [4]> then\n                    go to x: (-195) y: ((([sin v] of (Sine) ) * (3)) + (140))\n                else\n                    if <(lvl) = [5]> then\n                        go to x: (90) y: ((([sin v] of (Sine) ) * (3)) + (-40))\n                    else\n                        if <(lvl) = [6]> then\n                            go to x: (180) y: ((([sin v] of (Sine) ) * (3)) + (130))\n                        else\n                            delete this clone\n                        end\n                    end\n                end\n            end\n        end\n    end\n    turn left (-5) degrees\nend\n\n@Spikes\n\nwhen I receive [gamestart v]\nshow\nforever\n    switch costume to (lvl)\nend\n\nwhen flag clicked\nhide\n\n@Player\n\nwhen I receive [gamestart v]\nshow\ngo to x: (-200) y: (-20)\nset [p1yvel v] to [0]\nset [p1yvel v] to [0]\nforever\n    if <not <(Trans.) = [1]>> then\n        show\n        if <not <touching (ground v)?>> then\n            change [p1falling v] by (1)\n            change y by (P1Yvel)\n            change [p1yvel v] by (-1.2)\n        end\n        LevelYPos <[0] < (P1Yvel)>\n        if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n            change [p1xvel v] by (-1.5)\n        end\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            change [p1xvel v] by (1.5)\n        end\n        set [p1xvel v] to ((P1Xvel) * (0.85))\n        change x by (P1Xvel)\n        if <<[4] > (P1Falling)> and <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n            set [p1yvel v] to [11]\n        end\n        AdjustXPos\n    else\n        hide\n        go to x: (-200) y: (-20)\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine LevelYPos <up?>\nrepeat until <not <touching (ground v)?>>\n    set [p1yvel v] to [0]\n    if <up?> then\n        change y by (-1)\n    else\n        set [p1falling v] to [0]\n        change y by (1)\n    end\nend\n\ndefine AdjustXPos\nrepeat until <not <touching (ground v)?>>\n    change x by ((P1Xvel) * (-1))\nend\n\nwhen flag clicked\nforever\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        switch costume to (costume3 v)\n    else\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            switch costume to (costume2 v)\n        else\n            switch costume to (costume1 v)\n        end\n    end\nend\n\nwhen I receive [gamestart v]\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nswitch costume to (costume4 v)\nrepeat (16)\n    change size by (-7)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [gamestart v]\nforever\n    if <touching (portal v)?> then\n        broadcast (Transition v)\n        wait until <(Trans.) = [0]>\n        set [p1falling v] to [0]\n        set [p1yvel v] to [0]\n        set [p1yvel v] to [0]\n        change [lvl v] by (1)\n    end\n    if <touching (spikes v)?> then\n        set [p1falling v] to [0]\n        set [p1yvel v] to [0]\n        set [p1yvel v] to [0]\n        go to x: (-200) y: (-20)\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        go to x: (-200) y: (-20)\n        set [p1falling v] to [0]\n        set [p1yvel v] to [0]\n        set [p1yvel v] to [0]\n        wait until <not <key (r v) pressed?>>\n    end\nend\n\n@Button\n\nwhen flag clicked\nshow\nreset timer\nset size to (8) %\nforever\n    point in direction ((([sin v] of ((timer) * (300)) ) * (2)) + (90))\n    change size by ((((([sin v] of ((timer) * (300)) ) * (3.8)) + (size)) - (size)) / (3))\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set [size v] to [130]\n    else\n        set [size v] to [100]\n    end\nend\n\nwhen flag clicked\nwait until <<touching (mouse-pointer v)?> and <mouse down?>>\nstart sound [Click \(1\) v]\nbroadcast (start v)\n\nwhen I receive [start v]\nwait (0.6) seconds\nhide\n\n@Button2\n\nwhen flag clicked\nreset timer\nset size to (8) %\nforever\n    go to [back v] layer\n    go to (button v)\n    point in direction ((([sin v] of ((timer) * (300)) ) * (3.2)) + (90))\n    change size by ((((([sin v] of ((timer) * (300)) ) * (5)) + (size)) - (size)) / (3))\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set [size v] to [130]\n    else\n        set [size v] to [100]\n    end\nend\n\nwhen flag clicked\nwait until <<touching (mouse-pointer v)?> and <mouse down?>>\nstart sound [Click \(1\) v]\nbroadcast (start v)\n\n@Logo\n\nwhen flag clicked\nshow\nreset timer\nset size to (8) %\nforever\n    point in direction ((([sin v] of ((timer) * (150)) ) * (1.5)) + (90))\n    change size by ((((([sin v] of ((timer) * (300)) ) * (1.5)) + (size2)) - (size)) / (3))\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set [size2 v] to [190]\n    else\n        set [size2 v] to [160]\n    end\nend\n\nwhen I receive [start v]\nwait (0.4) seconds\nhide\n\n@Logo2\n\nwhen flag clicked\nshow\nreset timer\nset size to (100) %\nforever\n    point in direction ((([sin v] of ((timer) * (150)) ) * (2)) + (90))\nend\n\nwhen I receive [start v]\nwait (0.7) seconds\nhide\n\n@Logo3\n\nwhen flag clicked\nreset timer\nset size to (8) %\nforever\n    go to [back v] layer\n    go to (logo v)\n    point in direction ((([sin v] of ((timer) * (150)) ) * (1.5)) + (90))\n    change size by ((((([sin v] of ((timer) * (300)) ) * (1.5)) + (size2)) - (size)) / (3))\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set [size2 v] to [190]\n    else\n        set [size2 v] to [160]\n    end\nend\n\n@BackgroundFX\n\nwhen flag clicked\nhide\ngo to [back v] layer\nforever\n    go to x: (pick random (-240) to (240)) y: (-180)\n    set size to (pick random (70) to (130)) %\n    point in direction (pick random (-30) to (30))\n    create clone of (_myself_ v)\n    wait (0.05) seconds\nend\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (pick random (60) to (80))\nrepeat until <[175] < (y position)>\n    move (pick random (3) to (5)) steps\nend\ndelete this clone\n\n@Start\n\nwhen flag clicked\ngo to x: (0) y: (345)\nhide\n\nwhen I receive [start v]\nset [m v] to [0]\nset [s v] to [0]\nshow\nrepeat until <(y position) < [-330]>\n    change [s v] by (-2)\n    change y by (S)\nend\nhide\nbroadcast (gamestart v)\n\n@Sun\n\nwhen flag clicked\nhide\n\nwhen I receive [gamestart v]\nshow\nforever\nend\n\n@Glow\n\nwhen flag clicked\nreset timer\nhide\n\nwhen I receive [gamestart v]\nshow\nforever\n    go to (sun v)\n    set size to ((([sin v] of ((timer) * (150)) ) * (2)) + (100)) %\nend\n\n@Detector\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nshow\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\nend\n\n@Trans\n\nwhen I receive [transition v]\nswitch costume to (dark gray v)\ncreate clone of (_myself_ v)\nswitch costume to (gray v)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nset [color v] effect to ((1) / (0))\nif <(costume [number v]) = [1]> then\n    clear graphic effects\n    set [trans. v] to [1]\n    go to [front v] layer\n    point in direction (90)\n    show\n    set x to (0)\n    set y to (400)\n    go to [front v] layer\n    repeat (30)\n        change y by (((0) - (y position)) / (4))\n    end\n    go to [front v] layer\n    repeat (30)\n        turn right (((180) - (direction)) / (4)) degrees\n    end\n    set [trans. v] to [0]\n    repeat (20)\n        change x by (((400) - (x position)) * (0.1))\n        change [ghost v] effect by (8)\n        if <(x position) > [225]> then\n            show\n        end\n    end\n    delete this clone\nend\nif <(costume [number v]) = [2]> then\n    clear graphic effects\n    go to [front v] layer\n    point in direction (90)\n    show\n    set x to (0)\n    set y to (-400)\n    go to [front v] layer\n    repeat (30)\n        change y by (((0) - (y position)) / (4))\n    end\n    go to [front v] layer\n    repeat (30)\n        turn right (((180) - (direction)) / (4)) degrees\n    end\n    repeat (20)\n        change x by (((-400) - (x position)) * (0.1))\n        change [ghost v] effect by (8)\n        if <(x position) < [-225]> then\n            show\n        end\n    end\n    delete this clone\nend\n\nwhen flag clicked\nset [trans. v] to [0]\n\n@Thanks\n\nwhen flag clicked\nhide\nset [sine v] to [0]\npoint in direction (90)\n\nwhen I receive [gamestart v]\nforever\n    if <(lvl) = [7]> then\n        show\n        change [sine v] by (6.5)\n        point in direction ((([sin v] of (sine) ) * (6)) + (90))\n        set size to ((([sin v] of ((sine) * (2)) ) * (7)) + (130)) %\n    end\nend\n\n@Things\n\nwhen I start as a clone\nset [yvelocity v] to [0]\nif <(yvelocity) = [0]> then\n    set [yvelocity v] to [25]\nend\nrepeat (50)\n    change y by (yvelocity)\n    change [yvelocity v] by (-1)\n    turn right (turn) degrees\nend\ndelete this clone\n\nwhen I start as a clone\nset [turn v] to (pick random (-3) to (5))\ngo to x: (pick random (-235) to (235)) y: (-195)\nset size to (pick random (50) to (60)) %\ngo [backward v] (50) layers\nshow\n\nwhen flag clicked\nhide\n\nwhen I receive [gamestart v]\nforever\n    if <(lvl) = [7]> then\n        create clone of (_myself_ v)\n        wait (0.1) seconds\n        next costume\n    end\nend\n\n