Stones v1.3 (First Scrolling Platformer)

Instructions: In order to move, use WASD/Arrow Keys/Mobile Controls. Avoid  both spikes and lava or be sent to the last checkpoint you touched. You can wall jump. There is also jump pads (yellow) and checkpoints (green). You can also press the green button for a different costume.\n⭐Updates:\n⭐1 more level\n⭐Reworked some art\n⭐New sounds\n⭐Reduced lag

@Stage\n\ndefine Camera Shake Amount (amount) Falloffs (falloffs)\nset [my variable v] to (amount)\nrepeat until <(round (my variable)) < [0]>\n    set [camera shake x v] to ((my variable) * (pick random (-1) to (1)))\n    set [camera shake y v] to ((my variable) * (pick random (-1) to (1)))\n    set [my variable v] to ((my variable) * (falloffs))\nend\n\nwhen flag clicked\nCamera Shake Amount [50] Falloffs [.9]\n\nwhen I receive [hide intro v]\nstop all sounds\nforever\n    play sound [Amadeus - Imaginary v] until done\n    play sound [Amadeus - Lightspeed v] until done\nend\n\n@Player\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nTest dying\nBouce?\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((X) - (Scroll X)) y: ((Y) - (Scroll Y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nBouce?\nPosition\nTest dying\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Tick\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [sx v] by (-2)\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [sx v] by (2)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n    if <[4] > (in air)> then\n        set [sy v] to [15]\n    end\nend\nchange [sy v] by (-2)\nChange Player y by (sy)\nset [scroll x v] to (X)\nif <(Scroll X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((Y) - (Scroll Y)) / (10)))\nif <(Scroll Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(Y) < [-150]> then\n    set [exit v] to [die]\nend\nif <touching (bouncy v)?> then\n    start sound [Basketball Bounce v]\n    set [sy v] to [29]\nend\n\nwhen flag clicked\nset [check v] to [0]\nbroadcast (green flag v) and wait\n\nwhen I receive [green flag v]\nhide\ngo [backward v] (1) layers\n\nwhen I receive [playgame v]\nset [level v] to [1]\nforever\n    broadcast (reset v) and wait\n    broadcast (setup v) and wait\n    Game on\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (tick v)\n    end\n    if <(EXIT) = [win]> then\n        Win\n    else\n        Lose\n    end\nend\n\ndefine Game on\nif <(Check) = [0]> then\n    set [x v] to [0]\n    set [y v] to [0]\nend\nif <(Check) = [1]> then\n    set [x v] to [1170]\n    set [y v] to [161]\nend\nif <(Check) = [2]> then\n    set [x v] to [3414]\n    set [y v] to [68]\nend\nif <(Check) = [3]> then\n    set [x v] to [4604]\n    set [y v] to [122]\nend\nif <(Check) = [4]> then\n    set [x v] to [5922]\n    set [y v] to [30]\nend\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [scroll y v] to [0]\nset [scroll x v] to [0]\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Win\nglide (.3) secs to (portal v)\nrepeat (10)\n    turn right (36) degrees\n    change size by (-10)\n    change [ghost v] effect by (10)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\ndefine Lose\nset [exit v] to []\nrepeat (10)\n    change size by (-10)\n    change [ghost v] effect by (10)\nend\nhide\nwait (.5) seconds\nset [exit v] to []\n\ndefine Test dying\nif <<touching (spikes v)?> or <touching (lava v)?>> then\n    start sound [Crunch v]\n    set [exit v] to [die]\nend\n\nwhen I receive [start v]\nbroadcast (playgame v) and wait\n\ndefine Bouce?\n\nwhen flag clicked\nswitch costume to (1 v)\nbroadcast (playgame v)\npoint in direction (90)\n\nwhen I receive [next costume v]\nnext costume\n\n@Platforms\n\nwhen I receive [tick v]\nposition ((Platforms: x) - (Scroll X)) ((Platforms: y) - (Scroll Y))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nset [platforms: x v] to [0]\nset [platforms: y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\nend\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [platforms: x v] by (x)\nchange [platforms: y v] by (y)\nnext costume\n\nwhen flag clicked\ngo to [back v] layer\nhide\n\nwhen I receive [hide intro v]\nshow\n\n@Lava\n\nwhen I receive [tick v]\nposition ((danger: x) - (Scroll X)) ((danger: y) - (Scroll Y))\nset [danger: y v] to (([sin v] of ((timer) * (100)) ) * (10))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [green flag v]\nhide\nset [ghost v] effect to (0)\ngo to [back v] layer\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nset [danger: x v] to [0]\nset [danger: y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\nend\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [danger: x v] by (x)\nchange [danger: y v] by (y)\nnext costume\n\nwhen I start as a clone\nforever\n    go to [back v] layer\nend\n\n@Spikes\n\nwhen I receive [tick v]\nposition ((danger2: x) - (Scroll X)) ((danger2: y) - (Scroll Y))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    go to [back v] layer\n    show\nelse\n    go to [back v] layer\n    hide\nend\n\nwhen I receive [green flag v]\nhide\nset [ghost v] effect to (0)\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nset [danger2: x v] to [0]\nset [danger2: y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\nend\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [danger2: x v] by (x)\nchange [danger2: y v] by (y)\nnext costume\n\nwhen flag clicked\n\n@Bouncy\n\nwhen I receive [tick v]\nposition ((danger2: x) - (Scroll X)) ((danger2: y) - (Scroll Y))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nset [danger2: x v] to [0]\nset [danger2: y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\nend\n\nClone at x: [-360] y: [360]\nClone at x: [360] y: [200]\nClone at x: [360] y: [0]\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [danger2: x v] by (x)\nchange [danger2: y v] by (y)\nnext costume\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\nwhen I start as a clone\nset [ghost v] effect to (0)\n\nwhen I start as a clone\nforever\n    go to [back v] layer\nend\n\n@Intro2\n\nwhen flag clicked\ngo [forward v] (333) layers\nshow\ngo to [front v] layer\nclear graphic effects\nshow\nstart sound [Song v]\ngo to [front v] layer\nforever\n    go to x: (0) y: (0)\n    go to x: (((x position) + (Camera Shake X)) + (pick random (-1) to (2))) y: (((y position) + (Camera Shake Y)) + (pick random (-1) to (2)))\nend\n\nwhen flag clicked\nwait (2.5) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (1) seconds\nbroadcast (Hide Intro v) and wait\nhide\n\nwhen flag clicked\n\nwhen I receive [hide intro v]\nhide\n\n@Background\n\nwhen flag clicked\nshow\n\nwhen I receive [hide intro v]\nhide\n\ngo to [front v] layer\ngo to x: (0) y: (0)\n\n@250119code2\n\nwhen flag clicked\ngo to [front v] layer\ngo to [front v] layer\nshow\nset [ghost v] effect to (100)\nwait (.8) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (.8) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [hide intro v]\nhide\n\n@Text\n\nwhen I receive [tick v]\nposition ((danger2: x) - (Scroll X)) ((danger2: y) - (Scroll Y))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    go to [back v] layer\n    show\nelse\n    go to [back v] layer\n    hide\nend\n\nwhen I receive [green flag v]\nhide\nset [ghost v] effect to (0)\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nset [danger2: x v] to [0]\nset [danger2: y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\nend\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [danger2: x v] by (x)\nchange [danger2: y v] by (y)\nnext costume\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        set [ghost v] effect to (60)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen flag clicked\nhide\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\n\n@Checkpoints\n\nwhen I receive [tick v]\nposition ((danger2: x) - (Scroll X)) ((danger2: y) - (Scroll Y))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    go to [back v] layer\n    show\nelse\n    go to [back v] layer\n    hide\nend\n\nwhen I receive [green flag v]\nhide\nset [ghost v] effect to (0)\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nset [danger2: x v] to [0]\nset [danger2: y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\n    Clone at x: [482] y: [0]\nend\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [danger2: x v] by (x)\nchange [danger2: y v] by (y)\nnext costume\n\nwhen I start as a clone\nwait until <<touching (player v)?> and <(costume [number v]) = [3]>>\nplay sound [Ding - Sound Effect \[HD\] v] until done\nset [check v] to [1]\n\nwhen I start as a clone\nwait until <<touching (player v)?> and <(costume [number v]) = [8]>>\nplay sound [Ding - Sound Effect \[HD\] v] until done\nset [check v] to [2]\n\nwhen I start as a clone\nwait until <<touching (player v)?> and <(costume [number v]) = [10]>>\nplay sound [Ding - Sound Effect \[HD\] v] until done\nset [check v] to [3]\n\nwhen I start as a clone\nwait until <<touching (player v)?> and <(costume [number v]) = [14]>>\nplay sound [Ding - Sound Effect \[HD\] v] until done\nset [check v] to [4]\n\n@Button\n\nwhen flag clicked\nhide\n\nwhen I receive [hide intro v]\nshow\ngo to x: (196) y: (134)\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (120) %\n        if <mouse down?> then\n            broadcast (Next Costume v)\n            wait (1) seconds\n        end\n    else\n        set size to (100) %\n    end\nend\n\ndefine Hello\n\nHello\n\n