Gravity || Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\nwait (1) seconds\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [message2 v]\nswitch backdrop to (backdrop2 v)\n\n@Player\n\ndefine Physics (xv) (jumpheight)\nif <key (right arrow v) pressed?> then\n    switch costume to (costume1 v)\n    change [xmovement v] by (xv)\nelse\n    if <key (left arrow v) pressed?> then\n        switch costume to (costume2 v)\n        change [xmovement v] by (join [-] (xv))\n    end\nend\nset [xmovement v] to ((Xmovement) * (0.9))\nchange x by (Xmovement)\nchange [yv v] by (-1.2)\nif <touching (levels v)?> then\n    if <(Grav) = [1]> then\n        change y by (1)\n    else\n        if <(Grav) = [2]> then\n            change y by (-0.4)\n        end\n    end\nend\nif <touching (levels v)?> then\n    change x by ((Xmovement) * (-1))\nend\nif <(Grav) = [1]> then\n    change y by (Yv)\nelse\n    if <(Grav) = [2]> then\n        change y by ((0) - (Yv))\n    end\nend\nif <touching (levels v)?> then\n    if <(Grav) = [1]> then\n        change y by ((Yv) - ((Yv) * (2)))\n        set [yv v] to [0]\n    else\n        if <(Grav) = [2]> then\n            change y by ((Yv) - ((Yv) * (-0.5)))\n            set [yv v] to [0]\n        end\n    end\nend\nif <(Grav) = [1]> then\n    change y by (-1)\nelse\n    if <(Grav) = [2]> then\n        change y by (1)\n    end\nend\nif <(x position) > [230]> then\n    change [level v] by (1)\n    switch costume to (costume1 v)\n    set [yv v] to [0]\n    set [xmovement v] to [0]\n    set [grav v] to [1]\n    go to [front v] layer\n    go to x: (-197) y: (-72)\nend\nif <<<touching (hazards v)?> or <(y position) > [177.5]>> or <(y position) < [-177.5]>> then\n    switch costume to (costume1 v)\n    broadcast (transition v)\n    set [yv v] to [0]\n    set [xmovement v] to [0]\n    set [grav v] to [1]\n    go to [front v] layer\n    go to x: (-197) y: (-72)\nend\nif <touching (material things v)?> then\n    if <(level) = [9]> then\n        change y by (-10)\n        change [grav v] by (1)\n    else\n        change y by (10)\n        change [grav v] by (1)\n    end\nend\nif <key (r v) pressed?> then\n    set [xmovement v] to [0]\n    set [yv v] to [0]\n    set [grav v] to [1]\n    go to x: (-197) y: (-72)\n    wait until <not <key (r v) pressed?>>\nend\nif <key (s v) pressed?> then\n    set [xmovement v] to [0]\n    set [yv v] to [0]\n    set [grav v] to [1]\n    change [level v] by (1)\n    go to x: (-197) y: (-72)\n    wait until <not <key (s v) pressed?>>\nend\n\nwhen flag clicked\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    if <(Grav) = [3]> then\n        set [grav v] to [1]\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (down arrow v) pressed?> then\n        change [yv v] by (4)\n        wait (0.02) seconds\n        change [grav v] by (1)\n        set [yv v] to [0]\n        wait until <not <key (down arrow v) pressed?>>\n    end\nend\n\nwhen I receive [message1 v]\nshow\ngo to x: (-197) y: (-72)\nswitch costume to (costume1 v)\nset [yv v] to [0]\nset [level v] to [1]\nset [xmovement v] to [0]\nset [grav v] to [1]\ngo to [front v] layer\nforever\n    Physics [0.8] [15]\nend\n\nwhen I receive [message2 v]\nforever\n    play sound [Upbeat and Happy Background Music For YouTube Videos and Commercials v] until done\nend\n\nif <(Grav) = [1]> then\n    set [yv v] to [14.5]\nelse\n    if <(Grav) = [2]> then\n        set [yv v] to [-14.5]\n    end\nend\nif <(Xmovement) > [0]> then\n    set [xmovement v] to [-7]\nelse\n    set [xmovement v] to [7]\nend\n\n@Levels\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [level v] to [1]\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [message1 v]\nshow\nforever\n    switch costume to (level)\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to [back v] layer\nshow\nset [x v] to [0]\nset size to (pick random (10) to (100)) %\ngo to x: (-250) y: (pick random (-180) to (180))\nrepeat until <(x position) > [230]>\n    change [x v] by (pick random (0.4) to (0.9))\n    change x by (X)\nend\ndelete this clone\n\nwhen I receive [message2 v]\nforever\n    wait (pick random (0.45) to (1)) seconds\n    create clone of (_myself_ v)\nend\n\n@Intro\n\nwhen flag clicked\nplay sound [Tom Zanetti - More & More Ft3 v] until done\n\nwhen flag clicked\nhide\nset [particles? v] to [false]\ngo to x: (0) y: (0)\nswitch costume to (costume2 v)\nrepeat (12)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\npoint in direction (90)\nif <(costume [number v]) = [1]> then\n    hide\n    set size to (110) %\n    wait (0.1) seconds\n    go to x: (0) y: (-340)\n    show\n    repeat until <(round (y position)) = [89]>\n        change y by (((89) - (y position)) / (5))\n    end\n    wait (0.08) seconds\n    delete this clone\nelse\n    if <(costume [number v]) = [2]> then\n        hide\n        set size to (110) %\n        go to [front v] layer\n        go to x: (0) y: (-340)\n        wait (0.15) seconds\n        show\n        repeat until <(round (y position)) = [89]>\n            change y by (((89) - (y position)) / (5))\n        end\n        wait (0.08) seconds\n        delete this clone\n    else\n        if <(costume [number v]) = [3]> then\n            hide\n            set size to (110) %\n            go to [front v] layer\n            go to x: (0) y: (-340)\n            wait (0.2) seconds\n            show\n            repeat until <(round (y position)) = [89]>\n                change y by (((89) - (y position)) / (5))\n            end\n            wait (0.08) seconds\n            delete this clone\n        else\n            if <(costume [number v]) = [4]> then\n                hide\n                set size to (110) %\n                go to [front v] layer\n                go to x: (0) y: (-340)\n                wait (0.25) seconds\n                show\n                repeat until <(round (y position)) = [89]>\n                    change y by (((89) - (y position)) / (5))\n                end\n                wait (0.08) seconds\n                delete this clone\n            else\n                if <(costume [number v]) = [5]> then\n                    hide\n                    hide\n                    set size to (100) %\n                    go to [front v] layer\n                    go to x: (0) y: (360)\n                    wait (0.35) seconds\n                    show\n                    repeat until <(round (y position)) = [0]>\n                        change y by (((0) - (y position)) / (5))\n                    end\n                    wait (0.2) seconds\n                    repeat until <(round (y position)) = [345]>\n                        change y by (((345) - (y position)) / (2.5))\n                    end\n                    hide\n                    hide\n                    set [ghost v] effect to (100)\n                    hide\n                    hide\n                    delete this clone\n                else\n                    if <(costume [number v]) = [6]> then\n                        hide\n                        set size to (100) %\n                        go to [front v] layer\n                        go to x: (0) y: (360)\n                        wait (0.55) seconds\n                        show\n                        repeat until <(round (y position)) = [0]>\n                            change y by (((0) - (y position)) / (5))\n                        end\n                        wait (0.2) seconds\n                        repeat until <(round (y position)) = [345]>\n                            change y by (((345) - (y position)) / (2.5))\n                        end\n                        set [ghost v] effect to (100)\n                        hide\n                        hide\n                        hide\n                        delete this clone\n                    else\n                        if <(costume [number v]) = [7]> then\n                            hide\n                            set size to (100) %\n                            go to [front v] layer\n                            go to x: (0) y: (360)\n                            wait (0.75) seconds\n                            show\n                            repeat until <(round (y position)) = [0]>\n                                change y by (((0) - (y position)) / (5))\n                            end\n                            wait (0.2) seconds\n                            repeat until <(round (y position)) = [345]>\n                                change y by (((345) - (y position)) / (2.5))\n                            end\n                            hide\n                            set [ghost v] effect to (100)\n                            hide\n                            hide\n                            delete this clone\n                        else\n                            if <(costume [number v]) = [8]> then\n                                point in direction (0)\n                                set [ghost v] effect to (0)\n                                hide\n                                wait (3.4) seconds\n                                show\n                                set size to (0) %\n                                go to [front v] layer\n                                repeat (20)\n                                    set [size v] to (((Size) * (0.5)) + (((80) - (size)) / (1)))\n                                    change size by (Size)\n                                end\n                                go to x: (0.5) y: (0)\n                                repeat until <(x position) > [284]>\n                                    change x by ((x position) / (4))\n                                end\n                                go to x: (-240) y: (0)\n                                repeat until <(x position) > [-0.5]>\n                                    change x by (((x position) / (4)) * (-1))\n                                end\n                                wait (0.1) seconds\n                                repeat (30)\n                                    change y by (((5) - ((y position) * (0.2))) * (-0.85))\n                                    turn right (8) degrees\n                                    change [ghost v] effect by (6)\n                                end\n                                delete this clone\n                            else\n                                if <(costume [number v]) = [9]> then\n                                    hide\n                                    set size to (55) %\n                                    set [ghost v] effect to (30)\n                                    wait (3.45) seconds\n                                    show\n                                    repeat (60)\n                                        change size by (5)\n                                        change [ghost v] effect by (5)\n                                    end\n                                    delete this clone\n                                else\n                                    if <(costume [number v]) = [10]> then\n                                        hide\n                                        go to x: (0) y: (0)\n                                        wait (6) seconds\n                                        show\n                                        set size to (0) %\n                                        repeat until <(round (size)) = [110]>\n                                            change size by (((110) - (size)) / (5))\n                                        end\n                                        wait (2) seconds\n                                        delete this clone\n                                    else\n                                        if <(costume [number v]) = [11]> then\n                                            hide\n                                            go to x: (-464) y: (0)\n                                            wait (7) seconds\n                                            show\n                                            repeat until <(round (x position)) = [0]>\n                                                change x by (((0) - (x position)) / (5))\n                                            end\n                                            wait (2) seconds\n                                            delete this clone\n                                        else\n                                            if <(costume [number v]) = [12]> then\n                                                hide\n                                                go to x: (464) y: (0)\n                                                wait (8) seconds\n                                                show\n                                                repeat until <(round (x position)) = [0]>\n                                                    change x by (((0) - (x position)) / (5))\n                                                end\n                                                wait (1) seconds\n                                                broadcast (message2 v)\n                                                repeat (10)\n                                                    change [ghost v] effect by (10)\n                                                end\n                                                delete this clone\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndelete this clone\n\nwhen I start as a clone\nif <(Particles?) = [true]> then\n    hide\n    if <(pick random (1) to (2)) = [1]> then\n        switch costume to (particle 1 v)\n    else\n        switch costume to (particle 2 v)\n    end\n    set size to (pick random (30) to (150)) %\n    set [ghost v] effect to (pick random (0) to (50))\n    set [brightness v] effect to (pick random (-50) to (100))\n    go to x: (0) y: (0)\n    point in direction (pick random (-180) to (180))\n    set [v v] to (pick random (10) to (15))\n    set [i v] to (pick random (2) to (7))\n    go to [back v] layer\n    show\n    repeat until <(y position) < [-170]>\n        move (v) steps\n        change y by (i)\n        set [v v] to ((v) * (0.95))\n        change [i v] by (-0.3)\n    end\n    delete this clone\nend\n\nwhen flag clicked\nset [ghost v] effect to (0)\nwait (3.2) seconds\nset [particles? v] to [true]\nrepeat (30)\n    create clone of (_myself_ v)\nend\n\n\n\nwhen I start as a clone\nif <(costume [number v]) = [8]> then\n    wait (3.4) seconds\n    repeat until <(round (direction)) = [90]>\n        turn right (((90) - (direction)) / (3.5)) degrees\n    end\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [8]> then\n    set [brightness v] effect to (0)\n    wait (3.4) seconds\n    set [brightness v] effect to (100)\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [9]> then\n    set [brightness v] effect to (0)\n    wait (3.5) seconds\n    set [brightness v] effect to (100)\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\nend\n\n@Play Button\n\nwhen flag clicked\nset [hover v] to [0]\nforever\n    set [hover v] to (((hover) + (5)) mod (360))\n    change y by (([sin v] of (hover) ) / (2))\n    point in direction ((90) + (([sin v] of ((timer) * (95)) ) * (10)))\nend\n\nwhen flag clicked\ngo to x: (0) y: (-55)\nset [ghost v] effect to (0)\nhide\n\nwhen I receive [message2 v]\nset [ghost v] effect to (0)\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        repeat until <(size) = [128]>\n            change size by (((128) - (size)) / (7))\n        end\n    else\n        repeat until <(size) = [100]>\n            change size by (((100) - (size)) / (7))\n        end\n    end\nend\n\nwhen this sprite clicked\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nset size to (1) %\ngo to x: (800) y: (800)\nbroadcast (message1 v)\n\n@title\n\nwhen flag clicked\nset [ghost v] effect to (0)\ngo to x: (0) y: (56)\nhide\n\nwhen I receive [message2 v]\nshow\nforever\n    set [hover v] to (((hover) + (5)) mod (360))\n    change y by (([sin v] of (hover) ) / (2))\n    point in direction ((90) + (([sin v] of ((timer) * (95)) ) * (-5)))\nend\n\nwhen I receive [message1 v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\n@Writing\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [message1 v]\nshow\nforever\n    switch costume to (level)\nend\n\n@Hazards\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [message1 v]\nshow\nforever\n    switch costume to (level)\nend\n\n@material things\n\nwhen I receive [message1 v]\nshow\nforever\n    switch costume to (level)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\n@tb\n\nwhen flag clicked\nhide\n\n
|| Gravity\n_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~_~\nIn this game, you can control gravity! use the arrow keys to move around, and hit the down arrow to change gravity. Be wary of gravity-changing material; it can change your gravity where you want it to least. make it to the end!\n\n\n