Gravity | a platformer


@Stage\n\nwhen flag clicked\nswitch backdrop to (your turn v)\n\nwhen I receive [next level v]\nif <not <(costume [number v]) = [7]>> then\n    next costume\nend\n\nwhen I receive [intro finished v]\nswitch costume to (earth v)\nforever\n    play sound [TheFatRat - Monody \(Trimmed\) v] until done\nend\n\n@Platforms\n\nwhen flag clicked\nhide variable [jump height v]\nhide variable [speed \(if this is a negative number, the left and right key will reverse\) v]\nhide variable [gravity v]\nswitch costume to (earth v)\n\nwhen I receive [next level v]\nif <not <(costume [number v]) = [7]>> then\n    next costume\nend\nif <(costume [number v]) = [1]> then\n    set [gravity v] to [-0.5]\n    set [speed \(if this is a negative number, the left and right key will reverse\) v] to [1]\n    set [jump height v] to [10]\nend\nif <(costume [number v]) = [2]> then\n    set [gravity v] to [-0.8]\n    set [speed \(if this is a negative number, the left and right key will reverse\) v] to [0.9]\n    set [jump height v] to [9]\nend\nif <(costume [number v]) = [3]> then\n    set [gravity v] to [-0.45]\n    set [speed \(if this is a negative number, the left and right key will reverse\) v] to [1.1]\n    set [jump height v] to [10.5]\nend\nif <(costume [number v]) = [4]> then\n    set [gravity v] to [-0.9]\n    set [speed \(if this is a negative number, the left and right key will reverse\) v] to [0.65]\n    set [jump height v] to [7]\nend\nif <(costume [number v]) = [5]> then\n    set [gravity v] to [-0.45]\n    set [speed \(if this is a negative number, the left and right key will reverse\) v] to [1.3]\n    set [jump height v] to [14]\nend\nif <(costume [number v]) = [6]> then\n    set [gravity v] to [-0.01]\n    set [speed \(if this is a negative number, the left and right key will reverse\) v] to [1.5]\n    set [jump height v] to [5]\nend\nif <(costume [number v]) = [7]> then\n    set [gravity v] to [-0.5]\n    set [speed \(if this is a negative number, the left and right key will reverse\) v] to [1]\n    set [jump height v] to [10]\n    show variable [gravity v]\n    show variable [jump height v]\n    show variable [speed \(if this is a negative number, the left and right key will reverse\) v]\nend\n\nwhen flag clicked\nhide\nset [gravity v] to [-0.5]\nset [speed \(if this is a negative number, the left and right key will reverse\) v] to [1]\nset [jump height v] to [10]\n\nwhen I receive [intro finished v]\nshow\n\n@Player\n\nwhen flag clicked\nforever\n    if <touching (danger v)?> then\n        point in direction (90)\n        create clone of (_myself_ v)\n        go to x: (-204) y: (-60)\n        set [ghost v] effect to (0)\n        set [yvelocity v] to [0]\n        broadcast (XD v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#67c8ff)?> then\n        set [ghost v] effect to (50)\n        if <key (up arrow v) pressed?> then\n            set [y v] to [5]\n        else\n            if <key (down arrow v) pressed?> then\n                set [y v] to [-5]\n            else\n                set [y v] to [-1]\n            end\n        end\n    end\nend\n\nwhen I receive [next level v]\nwait (0.1) seconds\ngo to x: (-204) y: (-120)\n\nwhen flag clicked\nforever\n    if <touching color (#00ff55)?> then\n        set [y v] to [-15]\n    end\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    if <touching (bouncy v)?> then\n        set [y v] to [15]\n    end\nend\n\nwhen I start as a clone\nset [turn v] to (pick random (-3) to (5))\nset size to (pick random (35) to (50)) %\ngo [backward v] (50) layers\nshow\nif <(yvelocity) = [0]> then\n    set [yvelocity v] to [20]\nend\nrepeat (50)\n    change y by (yvelocity)\n    change [yvelocity v] by (-1)\n    turn right (turn) degrees\n    change [ghost v] effect by (2)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <not <touching color (#67c8ff)?>> then\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen [timer v] > (0.1)\nhide\n\nwhen flag clicked\nrepeat (10)\n    hide\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [235]> then\n        broadcast (Next level v)\n    end\nend\n\nwhen flag clicked\nforever\n    wait until <touching (flag v)?>\n    broadcast (Next level v)\n    wait until <not <touching (flag v)?>>\nend\n\nwhen I receive [next level v]\nrepeat (5)\n    go to x: (-204) y: (-60)\nend\n\nwhen I receive [intro finished v]\nwait (0.1) seconds\nshow\nset [ghost v] effect to (0)\npoint in direction (90)\nswitch costume to (player v)\ngo to [front v] layer\ngo [backward v] (1) layers\nshow\ngo to x: (-204) y: (-60)\nforever\n    change [y v] by (Gravity)\n    if <key (left arrow v) pressed?> then\n        switch costume to (player2 v)\n        change [x v] by ((Speed \(If this is a negative number, the left and right key will reverse\)) * (-1))\n    end\n    if <key (right arrow v) pressed?> then\n        switch costume to (player v)\n        change [x v] by (Speed \(If this is a negative number, the left and right key will reverse\))\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (platforms v)?> then\n        change y by (1)\n        if <touching (platforms v)?> then\n            change y by (1)\n            if <touching (platforms v)?> then\n                change y by (1)\n                if <touching (platforms v)?> then\n                    change y by (1)\n                    if <touching (platforms v)?> then\n                        change y by (1)\n                        if <touching (platforms v)?> then\n                            change y by (1)\n                            if <touching (platforms v)?> then\n                                change y by (-6)\n                                if <key (up arrow v) pressed?> then\n                                    set [y v] to (Jump Height)\n                                    change x by ((x) * (-1))\n                                    if <(x) > [0]> then\n                                        set [x v] to [-10]\n                                    else\n                                        set [x v] to [10]\n                                    end\n                                else\n                                    change x by ((x) * (-1))\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <touching (platforms v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-0.5)\n    if <<touching (platforms v)?> and <key (up arrow v) pressed?>> then\n        set [y v] to (Jump Height)\n    end\n    change y by (0.5)\n    if <key (down arrow v) pressed?> then\n        if <(Gravity) < [0.1]> then\n            set [y v] to ((Jump Height) * (-1))\n        end\n    end\nend\n\n@Items\n\nwhen flag clicked\nhide\ngo to [front v] layer\nswitch costume to (earth v)\n\nwhen I receive [next level v]\nif <not <(costume [number v]) = [7]>> then\n    next costume\nend\n\nwhen I receive [intro finished v]\nshow\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@Intro\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [clone v] to [1]\nset [intro: velocity v] to [0]\nswitch costume to (glow v)\nset size to (10) %\nhide\nstart sound [Teleport2 v]\nrepeat (3)\n    create clone of (_myself_ v)\n    next costume\n    wait (0.1) seconds\n    change [clone v] by (1)\nend\n\nwhen I start as a clone\nif <(clone) = [1]> then\n    show\n    repeat (70)\n        set [intro: velocity v] to ((((60) - (size)) * (0.1)) + ((Intro: velocity) * (0.8)))\n        change size by (Intro: velocity)\n    end\n    wait (1) seconds\n    repeat (13)\n        change size by ((((10) + (timer)) * (0.3)) * (-1))\n        change [ghost v] effect by (8)\n    end\n    delete this clone\nend\nif <(clone) = [2]> then\n    show\n    repeat (70)\n        set [intro: velocity v] to ((((60) - (size)) * (0.1)) + ((Intro: velocity) * (0.8)))\n        change size by (Intro: velocity)\n    end\n    wait (0.9) seconds\n    repeat (13)\n        change size by ((((10) + (timer)) * (0.3)) * (-1))\n        change [ghost v] effect by (8)\n    end\n    delete this clone\nend\nif <(clone) = [3]> then\n    show\n    repeat (70)\n        set [intro: velocity v] to ((((60) - (size)) * (0.1)) + ((Intro: velocity) * (0.8)))\n        change size by (Intro: velocity)\n    end\n    wait (0.8) seconds\n    repeat (13)\n        change size by ((((10) + (timer)) * (0.3)) * (-1))\n        change [ghost v] effect by (8)\n    end\n    wait (1) seconds\n    broadcast (Intro Finished v)\n    delete this clone\nend\n\n