Geometric - a platformer


@Stage\n\nwhen flag clicked\nwait (2) seconds\nbroadcast (circle v)\n\n@Player \n\ndefine Touch ground <something above>\nchange [falling v] by (1)\nrepeat until <not <touching (ground  v)?>>\n    if <something above> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling v] to [0]\n    end\n    set [yv v] to [0]\nend\n\nwhen I receive [start v]\nset [your score: v] to [0]\nshow\nset [ghost v] effect to (100)\nspawn player\nset [yv v] to [0]\nset [xv v] to [0]\nset size to (100) %\nswitch costume to (normal v)\nreset timer\nforever\n    death\n    if <touching (trampoline  v)?> then\n        set [yv v] to [15]\n    end\n    if <<(x position) > [239]> and <not <(level) = [16]>>> then\n        change [level v] by (1)\n        spawn player\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\n    change [xv v] by (<<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<(mouse x) > (x position)> and <mouse down?>>>> - <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<(mouse x) < (x position)> and <mouse down?>>>>)\n    set [xv v] to ((xv) * (0.88))\n    change x by (xv)\n    if <touching (ground  v)?> then\n        change x by ((0) - (xv))\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>>> then\n            if <(xv) > [0]> then\n                set [xv v] to [-8]\n            else\n                set [xv v] to [8]\n            end\n            set [yv v] to [12]\n        else\n            set [xv v] to [0]\n        end\n    end\n    change [yv v] by (-1)\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>>> then\n        if <(falling) < [4]> then\n            set [yv v] to [9]\n        end\n    end\n    change y by (yv)\n    Touch ground <(yv) > [0]>\nend\n\nwhen flag clicked\nreset timer\nclear graphic effects\nset [level v] to [1]\nhide\nforever\n    if <<(x position) > [239]> and <(level) = [16]>> then\n        set [results? v] to [yes]\n    end\nend\n\ndefine size change || size: (size) speed: (speed)\nchange size by (((size) - (size)) / (speed))\n\ndefine spawn player\nif <(level) = [1]> then\n    go to x: (-170) y: (-70)\nend\nif <(level) = [2]> then\n    go to x: (-170) y: (-70)\nend\nif <(level) = [3]> then\n    go to x: (-214) y: (46)\nend\nif <(level) = [4]> then\n    go to x: (-170) y: (-70)\nend\nif <(level) = [5]> then\n    go to x: (-219) y: (13)\nend\nif <(level) = [6]> then\n    go to x: (-219) y: (90)\nend\nif <(level) = [7]> then\n    go to x: (-219) y: (90)\nend\nif <(level) = [8]> then\n    go to x: (-170) y: (-70)\nend\nif <(level) = [9]> then\n    go to x: (-219) y: (-100)\nend\nif <(level) = [10]> then\n    go to x: (-219) y: (-100)\nend\nif <(level) = [11]> then\n    go to x: (-170) y: (-70)\nend\nif <(level) = [12]> then\n    go to x: (-219) y: (70)\nend\nif <(level) = [13]> then\n    go to x: (-170) y: (-70)\nend\nif <(level) = [14]> then\n    go to x: (-200) y: (-70)\nend\nif <(level) = [15]> then\n    go to x: (-170) y: (-70)\nend\nif <(level) = [16]> then\n    go to x: (-170) y: (-70)\nend\n\ndefine death\nif <key (r v) pressed?> then\n    repeat (50)\n        switch costume to (small v)\n        size change || size: [4500] speed: [7]\n        switch costume to (normal v)\n    end\n    spawn player\n    repeat (50)\n        size change || size: [100] speed: [7]\n    end\n    set [xv v] to [0]\n    set [yv v] to [0]\nend\nif <(y position) < [-176]> then\n    repeat (50)\n        switch costume to (small v)\n        size change || size: [4500] speed: [7]\n        switch costume to (normal v)\n    end\n    spawn player\n    repeat (50)\n        size change || size: [100] speed: [7]\n    end\n    set [xv v] to [0]\n    set [yv v] to [0]\nend\nif <touching (saw  v)?> then\n    repeat (50)\n        switch costume to (small v)\n        size change || size: [4500] speed: [7]\n        switch costume to (normal v)\n    end\n    spawn player\n    repeat (50)\n        size change || size: [100] speed: [7]\n    end\n    set [xv v] to [0]\n    set [yv v] to [0]\nend\nif <touching (spike  v)?> then\n    repeat (50)\n        switch costume to (small v)\n        size change || size: [4500] speed: [7]\n        switch costume to (normal v)\n    end\n    spawn player\n    repeat (50)\n        size change || size: [100] speed: [7]\n    end\n    set [xv v] to [0]\n    set [yv v] to [0]\nend\n\nwhen I receive [start v]\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [start v]\nforever\n    repeat until <<(x position) > [239]> and <(level) = [16]>>\n        set [your score: v] to ((round ((timer) * (10))) / (10))\n    end\n    stop [this script v]\nend\n\nif  then\n\nwhen flag clicked\nforever\n    if <(results?) = [yes]> then\n        if <(Your score:) < (☁ world record)> then\n            set [☁ world record v] to (Your score:)\n        end\n        wait (0) seconds\n        stop [other scripts in sprite v]\n    end\nend\n\nwhen flag clicked\nforever\n    if <<key (space v) pressed?> and <(username) = [lego__ninja]>> then\n        ask [reset highscore? Y/N] and wait\n    end\n    if <(answer) = [y]> then\n        set [☁ world record v] to [200]\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    if <<key (h v) pressed?> and <(username) = [lego__ninja]>> then\n        show variable [☁ world record v]\n        wait (5) seconds\n        hide variable [☁ world record v]\n    end\nend\n\nwhen flag clicked\nforever\n\nset [level v] to [5]\n\n@ground \n\nwhen flag clicked\ngo to [back v] layer\nforever\n    go to x: (0) y: (0)\n    switch costume to (level)\n    set [ghost v] effect to (20)\nend\n\n@circle \n\nwhen flag clicked\nhide\nwait (1) seconds\nshow\nset size to (8) %\nclear graphic effects\nrepeat (100)\n    switch costume to (small v)\n    size change || size: [1700] speed: [7]\n    switch costume to (costume1 v)\nend\n\ndefine size change || size: (size) speed: (speed)\nchange size by (((size) - (size)) / (speed))\n\nwhen I receive [start v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\ndefine smooth glide || x: (x) y: (y) speed: (speed)\nchange x by (((x) - (x position)) / (speed))\nchange y by (((y) - (y position)) / (speed))\n\n@question mark \n\nwhen flag clicked\nhide\nwait (1.5) seconds\nshow\nswitch costume to (big v)\npoint in direction (90)\ngo to x: (0) y: (200)\nswitch costume to (intruction v)\nrepeat (50)\n    smooth glide || x: [-187] y: [-137] speed: [6]\nend\n\ndefine smooth glide || x: (x) y: (y) speed: (speed)\nchange x by (((x) - (x position)) / (speed))\nchange y by (((y) - (y position)) / (speed))\n\nwhen flag clicked\nclear graphic effects\nforever\n    change [speed v] by (3)\n    point in direction ((([sin v] of (speed) ) * (6)) + (90))\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (7))\n        if <<mouse down?> and <([instructions? v] of [instructions  v]) = [no]>> then\n            broadcast (show intructions v)\n        end\n        set [brightness v] effect to (10)\n    else\n        change size by (((100) - (size)) / (7))\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [start v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nstop [other scripts in sprite v]\n\n@play button\n\nwhen flag clicked\nhide\nwait (1.5) seconds\nshow\nswitch costume to (big v)\ngo to x: (0) y: (200)\npoint in direction (90)\nswitch costume to (play v)\nrepeat (50)\n    smooth glide || x: [0] y: [-60] speed: [6]\nend\n\ndefine smooth glide || x: (x) y: (y) speed: (speed)\nchange x by (((x) - (x position)) / (speed))\nchange y by (((y) - (y position)) / (speed))\n\nwhen flag clicked\nclear graphic effects\nforever\n    change [speed v] by (3)\n    point in direction ((([sin v] of (speed) ) * (6)) + (90))\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (7))\n        set [brightness v] effect to (10)\n    else\n        change size by (((100) - (size)) / (7))\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [start v]\nrepeat (50)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen this sprite clicked\nbroadcast (start v)\n\n@sound \n\nwhen flag clicked\nhide\nwait (1.5) seconds\nshow\nswitch costume to (big v)\ngo to x: (0) y: (200)\npoint in direction (90)\nswitch costume to (sound on v)\nrepeat (50)\n    smooth glide || x: [187] y: [-130] speed: [6]\nend\n\ndefine smooth glide || x: (x) y: (y) speed: (speed)\nchange x by (((x) - (x position)) / (speed))\nchange y by (((y) - (y position)) / (speed))\n\nwhen flag clicked\nswitch costume to (sound on v)\nset volume to (100) %\nclear graphic effects\nforever\n    change [speed v] by (3)\n    point in direction ((([cos v] of (speed) ) * (6)) + (90))\n    if <touching (mouse-pointer v)?> then\n        change size by (((100) - (size)) / (7))\n        set [brightness v] effect to (10)\n    else\n        change size by (((80) - (size)) / (7))\n        set [brightness v] effect to (0)\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        next costume\n        if <(costume [number v]) = [3]> then\n            switch costume to (sound on v)\n        end\n        wait until <not <<mouse down?> and <touching (mouse-pointer v)?>>>\n    end\n    if <(costume [number v]) = [1]> then\n        set volume to (100) %\n    else\n        set volume to (0) %\n    end\nend\n\nwhen I receive [start v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nforever\n    play sound [Vexento - Cloud Nine v] until done\nend\n\n@thumbnail \n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to [front v] layer\n\n@word \n\nwhen flag clicked\nset [word movement? v] to [no]\nclear graphic effects\nhide\nswitch costume to (big v)\ngo to x: (0) y: (200)\nswitch costume to (costume1 v)\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((110) - (size)) / (7))\n        set [brightness v] effect to (10)\n    else\n        change size by (((100) - (size)) / (7))\n        set [brightness v] effect to (0)\n    end\n    if <(word movement?) = [yes]> then\n        set y to (([sin v] of ((timer) * (200)) ) * (7))\n    end\nend\n\nwhen I receive [circle v]\nshow\nrepeat (45)\n    smooth glide || x: [0] y: [-10] speed: [5]\nend\n\ndefine smooth glide || x: (x) y: (y) speed: (speed)\nchange x by (((x) - (x position)) / (speed))\nchange y by (((y) - (y position)) / (speed))\n\nwhen I receive [start v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [circle v]\n\nwhen flag clicked\nwait (3.1) seconds\nset [word movement? v] to [yes]\n\n@spike \n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@saw \n\nwhen flag clicked\nforever\n    go [backward v] (1) layers\n    switch costume to (level)\n    set y to (-130)\n    turn right (15) degrees\n    set x to (([sin v] of ((timer) * (200)) ) * (70))\nend\n\n@trampoline \n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@instructions \n\nwhen flag clicked\nswitch costume to (big v)\ngo to x: (0) y: (-400)\nswitch costume to (intructions v)\nset [instructions? v] to [no]\ngo to [front v] layer\nforever\n    if <<(y position) > [-1]> and <<<mouse down?> and <touching (mouse-pointer v)?>> or <key (space v) pressed?>>> then\n        repeat (50)\n            switch costume to (big v)\n            smooth glide || x: [0] y: [-350] speed: [7]\n            switch costume to (intructions v)\n        end\n        set [instructions? v] to [no]\n    end\nend\n\ndefine smooth glide || x: (x) y: (y) speed: (speed)\nchange x by (((x) - (x position)) / (speed))\nchange y by (((y) - (y position)) / (speed))\n\nwhen I receive [show intructions v]\nrepeat (50)\n    smooth glide || x: [0] y: [0] speed: [7]\nend\nset [instructions? v] to [yes]\n\n@results\n\nwhen flag clicked\nset [results? v] to [no]\nhide\ngo to x: (0) y: (400)\nforever\n    if <(results?) = [yes]> then\n        show\n        repeat (50)\n            switch costume to (big v)\n            smooth glide || x: [0] y: [0] speed: [6]\n            switch costume to (results v)\n        end\n    end\nend\n\ndefine smooth glide || x: (x) y: (y) speed: (speed)\nchange x by (((x) - (x position)) / (speed))\nchange y by (((y) - (y position)) / (speed))\n\n@score\n\nwhen flag clicked\nset [# v] to [1]\nset [results? v] to [no]\nhide\nforever\n    wait (0) seconds\n    if <(results?) = [yes]> then\n        go to x: (25) y: (45)\n        repeat (length of (Your score:))\n            create clone of (_myself_ v)\n            change x by (20)\n            change [# v] by (1)\n        end\n        stop [this script v]\n    end\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nswitch costume to (letter (#) of (Your score:))\n\n@highscore\n\nwhen flag clicked\nset [highscore # v] to [1]\nhide\nforever\n    wait (0) seconds\n    if <(results?) = [yes]> then\n        go to x: (25) y: (-35)\n        repeat (length of (☁ world record))\n            create clone of (_myself_ v)\n            change x by (20)\n            change [highscore # v] by (1)\n        end\n        stop [this script v]\n    end\nend\n\nwhen I start as a clone\ngo to [front v] layer\nshow\nswitch costume to (letter (highscore #) of (☁ world record))\n\n