Star Valley - A Scrolling Platformer
@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (Scroll X)) (join [, ] ((mouse y) + (Scroll Y))))\n\nwhen I receive [save v]\nSetup List\nhide list [saving progress... v]\nDetermine Save Code\nask [Enter your code to continue:] and wait\nrepeat until <(answer) = (__save code)>\n    ask [That is not your code, please TRIPLE CLICK and press CTRL + C or CMD + C on your code to copy!] and wait\nend\nshow list [saving progress... v]\nset [$button already pressed bugfix v] to [0]\n\nwhen I receive [setup project v]\nshow list [saving progress... v]\n\ndefine Setup List\ndelete all of [saving progress... v]\nadd [Here is your save code:] to [saving progress... v]\nadd [\[Loading...\]] to [saving progress... v]\nadd [] to [saving progress... v]\nadd [Triple click and press Ctrl + C on Windows or Cmd + C on Mac to copy it!] to [saving progress... v]\nadd [Create a .txt file and store the code by pasting it into the file! \(Ctrl +V or Cmd + V\)] to [saving progress... v]\n\ndefine Determine Save Code\nset [__save code v] to []\nset [e v] to [1]\nrepeat (length of [locked levels v])\n    set [__save code v] to (join (__save code) (letter (7) of (item (e) of [locked levels v])))\n    change [e v] by (1)\nend\nnew\nset [__save code v] to (join (__save code) (Coins))\nnew\nset [e v] to [0]\nrepeat (length of [coin status v])\n    change [e v] by (1)\n    set [q v] to [1]\n    repeat (length of (item (e) of [coin status v]))\n        set [__save code v] to (join (__save code) (letter (q) of (item (e) of [coin status v])))\n        change [q v] by (1)\n    end\n    new2\nend\nnew\nset [__save code v] to (join (__save code) (_Total Enemies Killed))\nnew\nset [__save code v] to (join (__save code) (Selected Color))\nnew\nreplace item (2) of [saving progress... v] with (__save code)\n\ndefine new\nset [__save code v] to (join (__save code) [:])\n\ndefine new2\nset [__save code v] to (join (__save code) [;])\n\ndefine Load (code)\ndelete all of [locked levels v]\ndelete all of [coin status v]\nset [e v] to [1]\nrepeat until <(letter (e) of (code)) = [:]>\n    add (join [Level ] (letter (e) of (code))) to [locked levels v]\n    change [e v] by (1)\nend\nchange [e v] by (1)\nset [coins v] to []\nrepeat until <(letter (e) of (code)) = [:]>\n    set [coins v] to (join (Coins) (letter (e) of (code)))\n    change [e v] by (1)\nend\nchange [e v] by (1)\nset [q v] to [1]\nrepeat until <(letter (e) of (code)) = [:]>\n    add [] to [coin status v]\n    repeat until <(letter (e) of (code)) = [;]>\n        replace item (q) of [coin status v] with (join (item (q) of [coin status v]) (letter (e) of (code)))\n        change [e v] by (1)\n    end\n    change [e v] by (1)\n    change [q v] by (1)\nend\nchange [e v] by (1)\nset [_total enemies killed v] to []\nrepeat until <(letter (e) of (code)) = [:]>\n    set [_total enemies killed v] to (join (_Total Enemies Killed) (letter (e) of (code)))\n    change [e v] by (1)\nend\nchange [e v] by (1)\nset [selected color v] to []\nrepeat until <(letter (e) of (code)) = [:]>\n    set [selected color v] to (join (Selected Color) (letter (e) of (code)))\n    change [e v] by (1)\nend\n\nwhen I receive [load v]\nask [Enter Save Code:] and wait\nrepeat until <not <(answer) = []>>\n    ask [Invalid Code Please Enter Your Save Code:] and wait\nend\nLoad (answer)\nset [$button already pressed bugfix v] to [0]\n___Set Coins\nbroadcast (finished loading v)\n\ndefine ___Set Coins\nset [stage: o v] to [1]\nset [stage: j v] to [1]\nset [stage: 1s v] to [0]\nrepeat (length of [coin status v])\n    repeat (length of (item (Stage: j) of [coin status v]))\n        if <(letter (Stage: o) of (item (Stage: j) of [coin status v])) = [1]> then\n            change [stage: 1s v] by (1)\n        end\n        change [stage: o v] by (1)\n    end\n    change [stage: j v] by (1)\n    set [stage: o v] to [1]\nend\nset [coins v] to (Stage: 1s)\n\n@Nothing\n\n@Game\n\nwhen flag clicked\nbroadcast (Setup Starter Variables v) and wait\nbroadcast (Setup Project v) and wait\nbroadcast (Menu v) and wait\n\nwhen I receive [setup starter variables v]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [screen height v] to [360]\nset [screen width v] to [480]\nset [selected color v] to [Black]\nset [coins v] to [0]\nset [enemies killed v] to [0]\nset [enemy movespeed v] to [3]\nset [_total enemies killed v] to [0]\nset [trap speed v] to [3]\nset [$button already pressed bugfix v] to [0]\ndelete all of [locked levels v]\ndelete all of [mouse hovering? v]\ndelete all of [coin status v]\ndelete all of [coins needed v]\ndelete all of [total enemies v]\ndelete all of [settings data v]\nset [i v] to [2]\nrepeat (7)\n    add (join [Level ] (i)) to [locked levels v]\n    change [i v] by (1)\nend\nrepeat (22)\n    add [false] to [mouse hovering? v]\nend\nadd [75] to [settings data v]\nadd [100] to [settings data v]\nadd [25] to [settings data v]\nadd [50] to [settings data v]\nadd [0000] to [coin status v]\nadd [0000] to [coin status v]\nadd [0000] to [coin status v]\nadd [00] to [coin status v]\nadd [00] to [coin status v]\nadd [000] to [coin status v]\nadd [0] to [coin status v]\nadd [] to [coin status v]\nadd [3] to [total enemies v]\nadd [1] to [total enemies v]\nadd [2] to [total enemies v]\nadd [1] to [total enemies v]\nadd [1] to [total enemies v]\nadd [1] to [total enemies v]\nadd [1] to [total enemies v]\nadd [0] to [total enemies v]\nadd [4] to [coins needed v]\nadd [4] to [coins needed v]\nadd [4] to [coins needed v]\nadd [2] to [coins needed v]\nadd [2] to [coins needed v]\nadd [3] to [coins needed v]\nadd [1] to [coins needed v]\nadd [0] to [coins needed v]\n\nwhen I receive [menu - complete v]\nbroadcast (Setup Game v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [setup game v]\nset [coins collected v] to [0]\nset [enemies killed v] to [0]\n\nwhen I receive [_next level v]\nchange [_total enemies killed v] by (Enemies Killed)\n___Set Coins\n\ndefine __Find Total coins\nset [i v] to [1]\nset [1s v] to [0]\nrepeat (length of (item (Level) of [coin status v]))\n    if <(letter (i) of (item (Level) of [coin status v])) = [1]> then\n        change [1s v] by (1)\n    end\n    change [i v] by (1)\nend\nset [coins collected v] to (1s)\n\nwhen I receive [setup game v]\n__Find Total coins\n\ndefine ___Set Coins\nset [o v] to [1]\nset [j v] to [1]\nset [1s v] to [0]\nrepeat (length of [coin status v])\n    repeat (length of (item (j) of [coin status v]))\n        if <(letter (o) of (item (j) of [coin status v])) = [1]> then\n            change [1s v] by (1)\n        end\n        change [o v] by (1)\n    end\n    change [j v] by (1)\n    set [o v] to [1]\nend\nset [coins v] to (1s)\n\nwhen I receive [setup project v]\n___Set Coins\n\n@Menu\n\nwhen I receive [setup project v]\nhide\n\nwhen I receive [menu v]\nCreate Menu Item, ID: [Play] X: [-100] Y: [50] i: [1] menu req [null]\nCreate Menu Item, ID: [Character Customization] X: [0] Y: [50] i: [2] menu req [null]\nCreate Menu Item, ID: [Settings] X: [100] Y: [50] i: [3] menu req [null]\nCreate Menu Item, ID: [Save] X: [-50] Y: [-100] i: [21] menu req [null]\nCreate Menu Item, ID: [Load] X: [50] Y: [-100] i: [22] menu req [null]\n\ndefine Create Menu Item, ID: (id) X: (x) Y: (y) i: (iid) menu req (req)\nset [___req v] to (req)\nset [menu id v] to (id)\nset [menu i v] to (iid)\nset [end x v] to (x)\nset [end y v] to (y)\nswitch costume to (menu ID)\ncreate clone of (_myself_ v)\nset [menu id v] to [Sprite]\n\nwhen I start as a clone\ngo to x: (end X) y: ((end Y) - (((SCREEN HEIGHT) / (2)) - ((0) - (end Y))))\npoint in direction (0)\nset size to (75) %\nif <(___req) = [null]> then\n    set [___req v] to [0]\nend\nif <<not <[locked levels v] contains (menu ID)?>> and <((Coins) + (1)) > (___req)>> then\n    set [locked? v] to [false]\nelse\n    set [locked? v] to [true]\n    switch costume to (join [Locked ] (letter (7) of (menu ID)))\nend\nDetect if Selected\nshow\nSmooth Move and Rotate, Speed [3] Times [30] Turn [360] * [n]\npoint in direction (0)\nforever\n    set volume to (item (2) of [settings data v]) %\n    if <<touching (mouse-pointer v)?> and <(locked?) = [false]>> then\n        replace item (menu i) of [mouse hovering? v] with [true]\n        Smooth Grow/Shrink, Speed [5] End Size [90] Times [5] * [n]\n    else\n        replace item (menu i) of [mouse hovering? v] with [false]\n        Smooth Grow/Shrink, Speed [5] End Size [75] Times [5] * [n]\n    end\n    Detect if Selected\n    if <<<touching (mouse-pointer v)?> and <mouse down?>> and <($Button Already Pressed BugFix) = [0]>> then\n        set [$button already pressed bugfix v] to [1]\n        if <<not <[locked levels v] contains (menu ID)?>> and <((Coins) + (1)) > (___req)>> then\n            Smooth Grow/Shrink, Speed [2] End Size [60] Times [5] * [y]\n            start sound [Tap v]\n            wait until <not <mouse down?>>\n            set [just clicked? v] to [true]\n            if <[colors v] contains (menu ID)?> then\n                broadcast (Change Selected Color v) and wait\n            else\n                if < (menu ID) contains [Level ]?> then\n                    set [level v] to (letter (7) of (menu ID))\n                    broadcast (Menu - Complete v) and wait\n                else\n                    broadcast (menu ID) and wait\n                end\n            end\n        else\n            wait until <not <mouse down?>>\n            start sound [Locked v]\n            set [$button already pressed bugfix v] to [0]\n            set [___message v] to (letter (8) of (costume [name v]))\n            broadcast (_null message v)\n        end\n    end\nend\n\ndefine Smooth Move and Rotate, Speed (speed) Times (time) Turn (turn) * (y/n)\nset [degrees turned v] to [0]\nrepeat (time)\n    change y by (((end Y) - (y position)) / (speed))\n    change x by (((end X) - (x position)) / (speed))\n    turn right (((turn) - (degrees turned)) / (speed)) degrees\n    change [degrees turned v] by (((turn) - (degrees turned)) / (speed))\n    if <(y/n) = [y]> then\n        change size by (((75) - (size)) / (speed))\n    end\nend\n\ndefine Smooth Grow/Shrink, Speed (speed) End Size (size) Times (times) * (y/n)\nrepeat (times)\n    change size by (((size) - (size)) / (speed))\n    if <<mouse down?> and <(y/n) = [n]>> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [play v]\nset [$button already pressed bugfix v] to [0]\nif <(menu ID) = [Play]> then\n    Play Button, Smooth Move & Rotate\nelse\n    replace item (menu i) of [mouse hovering? v] with [false]\n    delete this clone\nend\nset [just clicked? v] to [false]\n\nwhen I receive [back v]\nset [$button already pressed bugfix v] to [0]\nif <(menu ID) = [Back]> then\n    replace item (menu i) of [mouse hovering? v] with [false]\n    set [end x v] to [-100]\n    set [end y v] to [50]\n    set [menu id v] to [Play]\n    set [menu i v] to [1]\n    Smooth Move and Rotate, Speed [3] Times [30] Turn [180] * [y]\nelse\n    replace item (menu i) of [mouse hovering? v] with [false]\n    delete this clone\nend\n\nwhen I receive [play v]\nset [$button already pressed bugfix v] to [0]\nif <(menu ID) = [Sprite]> then\n    Create Menu Item, ID: [Level 1] X: [-150] Y: [25] i: [4] menu req [null]\n    Create Menu Item, ID: [Level 2] X: [-50] Y: [25] i: [5] menu req [4]\n    Create Menu Item, ID: [Level 3] X: [50] Y: [25] i: [6] menu req [7]\n    Create Menu Item, ID: [Level 4] X: [150] Y: [25] i: [7] menu req [10]\n    Create Menu Item, ID: [Level 5] X: [-150] Y: [-75] i: [8] menu req [12]\n    Create Menu Item, ID: [Level 6] X: [-50] Y: [-75] i: [9] menu req [14]\n    Create Menu Item, ID: [Level 7] X: [50] Y: [-75] i: [10] menu req [17]\n    Create Menu Item, ID: [Level 8] X: [150] Y: [-75] i: [11] menu req [null]\nend\n\nwhen I receive [back v]\nset [$button already pressed bugfix v] to [0]\nif <(menu ID) = [Sprite]> then\n    Create Menu Item, ID: [Character Customization] X: [0] Y: [50] i: [2] menu req [null]\n    Create Menu Item, ID: [Settings] X: [100] Y: [50] i: [3] menu req [null]\n    Create Menu Item, ID: [Save] X: [-50] Y: [-100] i: [21] menu req [null]\n    Create Menu Item, ID: [Load] X: [50] Y: [-100] i: [22] menu req [null]\nend\n\ndefine Play Button, Smooth Move & Rotate\nreplace item (menu i) of [mouse hovering? v] with [false]\nset [end x v] to [-190]\nset [end y v] to [130]\nset [menu id v] to [Back]\nset [menu i v] to [20]\nSmooth Move and Rotate, Speed [3] Times [30] Turn [180] * [y]\n\nwhen I receive [character customization v]\nset [$button already pressed bugfix v] to [0]\nif <(menu ID) = [Play]> then\n    Play Button, Smooth Move & Rotate\nelse\n    replace item (menu i) of [mouse hovering? v] with [false]\n    delete this clone\nend\nset [just clicked? v] to [false]\n\nwhen I receive [character customization v]\nset [$button already pressed bugfix v] to [0]\nif <(menu ID) = [Sprite]> then\n    Create Menu Item, ID: [Black] X: [-150] Y: [25] i: [12] menu req [null]\n    Create Menu Item, ID: [Red] X: [-50] Y: [25] i: [13] menu req [null]\n    Create Menu Item, ID: [Orange] X: [50] Y: [25] i: [14] menu req [null]\n    Create Menu Item, ID: [Yellow] X: [150] Y: [25] i: [15] menu req [null]\n    Create Menu Item, ID: [Green] X: [-150] Y: [-75] i: [16] menu req [null]\n    Create Menu Item, ID: [Blue] X: [-50] Y: [-75] i: [17] menu req [null]\n    Create Menu Item, ID: [Purple] X: [50] Y: [-75] i: [18] menu req [null]\n    Create Menu Item, ID: [Pink] X: [150] Y: [-75] i: [19] menu req [null]\nend\n\nwhen I receive [change selected color v]\nset [$button already pressed bugfix v] to [0]\nif <(just clicked?) = [true]> then\n    set [selected color v] to (menu ID)\nend\nset [just clicked? v] to [false]\n\ndefine Detect if Selected\nif <[colors v] contains (menu ID)?> then\n    if <(Selected Color) = (menu ID)> then\n        switch costume to (join (menu ID) [ Selected])\n    else\n        switch costume to (menu ID)\n    end\nend\n\nwhen I receive [menu - complete v]\nset [$button already pressed bugfix v] to [0]\nreplace item (menu i) of [mouse hovering? v] with [false]\ndelete this clone\n\nwhen I receive [settings v]\nset [$button already pressed bugfix v] to [0]\nif <(menu ID) = [Play]> then\n    Play Button, Smooth Move & Rotate\nelse\n    replace item (menu i) of [mouse hovering? v] with [false]\n    delete this clone\nend\nset [just clicked? v] to [false]\n\nset [___message v] to [req update]\nbroadcast (_null message v)\nset [$button already pressed bugfix v] to [0]\n\nwhen I receive [setup project v]\ndelete all of [colors v]\nadd [Black] to [colors v]\nadd [Red] to [colors v]\nadd [Orange] to [colors v]\nadd [Yellow] to [colors v]\nadd [Green] to [colors v]\nadd [Blue] to [colors v]\nadd [Purple] to [colors v]\nadd [Pink] to [colors v]\ngo to [front v] layer\n\nwhen I start as a clone\n\nforever\n    if <<(menu ID) = [Play]> or <(menu ID) = [Back]>> then\n        if <(direction) = [156]> then\n            point in direction (0)\n        end\n        if <(direction) = [-24.00]> then\n            say [Hello!]\n            point in direction (0)\n        end\n    end\nend\n\n@Player\n\nwhen I receive [setup project v]\nhide\n\nwhen I receive [setup game v]\nclear graphic effects\nswitch costume to (Selected Color)\nset [_animation in progress? v] to [false]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [delta x v] to [0]\nset [delta y v] to [0]\nset [x v] to [0]\nset [y v] to [-20]\nset [coins collected v] to [0]\npoint in direction (0)\ngo to x: ((x) - (Scroll X)) y: ((y) - (SCREEN WIDTH))\n\nwhen I receive [play game v]\nbroadcast (Tick v) and wait\nshow\nforever\n    change [counter v] by (1)\n    if <(_animation in progress?) = [false]> then\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            change [delta x v] by (1)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            change [delta x v] by (-1)\n        end\n        set [delta x v] to ((delta x) * (0.88))\n        change x by (delta x)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change y by (-4)\n                            change x by ((0) - (delta x))\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                set [delta y v] to [16]\n                                if <([abs v] of (delta x) ) = (delta x)> then\n                                    set [delta x v] to [-10]\n                                else\n                                    set [delta x v] to [10]\n                                end\n                            else\n                                set [delta x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [delta y v] by (-1)\n        change y by (delta y)\n        if <touching (level v)?> then\n            change y by ((0) - (delta y))\n            set [delta y v] to [0]\n        end\n        change y by (-1)\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <touching (level v)?>> then\n            set [delta y v] to [14]\n        end\n        change y by (1)\n        if <touching (danger v)?> then\n            Die\n            stop [this script v]\n        end\n        if <touching (coins v)?> then\n            broadcast (Collect v)\n        end\n        if <touching (enemies v)?> then\n            if <(delta y) < [-3]> then\n                broadcast (killed enemy v)\n                set [delta y v] to [5]\n            else\n                Die\n                stop [this script v]\n            end\n        end\n        if <touching (moving traps v)?> then\n            Die\n            stop [this script v]\n        end\n        if <(x position) > [239]> then\n            broadcast (_next level v)\n            hide\n            Update locked lists\n            stop [this script v]\n        end\n        if <(y position) > [187]> then\n            hide\n        else\n            show\n        end\n    end\n    set size to (100) %\n    Re-Position\n    set size to (50) %\n    broadcast (Tick v)\n    if <(timer) > [1]> then\n        set [fps v] to (counter)\n        set [counter v] to [0]\n        reset timer\n    end\nend\n\ndefine Set Costume\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n    switch costume to (join (Selected Color) [ Right Up])\nelse\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        switch costume to (join (Selected Color) [ Left Up])\n    else\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <(delta y) < [0]>> then\n            switch costume to (join (Selected Color) [ Left Down])\n        else\n            if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <(delta y) < [0]>> then\n                switch costume to (join (Selected Color) [ Right Down])\n            else\n                if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                    switch costume to (join (Selected Color) [ Right])\n                else\n                    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                        switch costume to (join (Selected Color) [ Left])\n                    else\n                        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                            switch costume to (join (Selected Color) [ Up])\n                        else\n                            if <(delta y) < [0]> then\n                                switch costume to (join (Selected Color) [ Down])\n                            else\n                                switch costume to (join (Selected Color) [ Idle])\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Re-Position\nchange [x v] by (delta x)\nchange [y v] by (delta y)\nset [scroll x v] to (x)\nif <(x) < (item (Level) of [_level start scroll v])> then\n    set [scroll x v] to (item (Level) of [_level start scroll v])\nelse\n    if <(x) > (item (Level) of [_level end scroll v])> then\n        set [scroll x v] to (item (Level) of [_level end scroll v])\n    else\n        set x to (0)\n    end\nend\nset y to (y)\n\ndefine Die\nset [_animation in progress? v] to [true]\nbroadcast (Player Dies v)\nset [delta y v] to [10]\npoint in direction (pick random (-70) to (50))\nshow\ngo to [front v] layer\nrepeat until <(y position) < [-179]>\n    change [delta y v] by (-1)\n    turn right (3) degrees\n    change x by (5)\n    change y by (delta y)\n    broadcast (Tick v)\nend\nhide\nset [_animation in progress? v] to [false]\n\nwhen I receive [play game v]\nforever\n    Set Costume\n    wait (0.3) seconds\nend\n\ndefine Update locked lists\nif <(letter (7) of (item (1) of [locked levels v])) = ((Level) + (1))> then\n    delete (1) of [locked levels v]\nend\n\nwhen I receive [bounce v]\nset [delta y v] to [20]\n\nwhen I receive [boost v]\nchange [delta x v] by (Boost X)\nchange [delta y v] by (Boost Y)\n\nwhen I receive [teleport v]\nSet teleportation variables\ngo to [front v] layer\nset [_animation in progress? v] to [true]\nset [delta x v] to [0]\nset [delta y v] to [0]\nrepeat ([ceiling v] of (([abs v] of ((item (3) of [settings data v]) - (101)) ) / (2.2)) )\n    change [ghost v] effect by (5)\n    change [x v] by (((start tx) - (x)) / ([ceiling v] of (([abs v] of ((item (3) of [settings data v]) - (101)) ) / (7.5)) ))\n    change [y v] by (((start ty) - (y)) / ([ceiling v] of (([abs v] of ((item (3) of [settings data v]) - (101)) ) / (7.5)) ))\nend\nhide\nrepeat ([ceiling v] of (([abs v] of ((item (3) of [settings data v]) - (101)) ) / (2.2)) )\n    change [x v] by (((end tx) - (x)) / ([ceiling v] of (([abs v] of ((item (3) of [settings data v]) - (101)) ) / (15)) ))\n    change [y v] by (((end ty) - (y)) / ([ceiling v] of (([abs v] of ((item (3) of [settings data v]) - (101)) ) / (15)) ))\nend\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nset [delta x v] to [0]\nset [delta y v] to [0]\nset [_animation in progress? v] to [false]\nbroadcast (done teleporting v)\n\ndefine Set teleportation variables\nset [end tx v] to (End TX)\nset [end ty v] to (End TY)\nset [start ty v] to (Start TY)\nset [start tx v] to (Start TX)\n\n@Level\n\nwhen I receive [setup project v]\ngo to [front v] layer\nhide\n\nwhen I receive [setup game v]\nclear graphic effects\nrepeat (1)\n    delete this clone\nend\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1 1 v)\n    Create Ground at X: [0] Y: [0]\n    Create Ground at X: [1] Y: [0]\n    Create Ground at X: [2] Y: [0]\n    Create Ground at X: [3] Y: [0]\n    Create Ground at X: [4] Y: [0]\n    Create Ground at X: [5] Y: [0]\n    Create Ground at X: [6] Y: [0]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2 1 v)\n        Create Ground at X: [0] Y: [0]\n        Create Ground at X: [-1] Y: [0]\n        Create Ground at X: [1] Y: [0]\n        Create Ground at X: [2] Y: [0]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3 1 v)\n            Create Ground at X: [0] Y: [0]\n            Create Ground at X: [1] Y: [0]\n            Create Ground at X: [2] Y: [0]\n            Create Ground at X: [3] Y: [0]\n        else\n            if <(Level) = [4]> then\n                switch costume to (level 4 1 v)\n                Create Ground at X: [0] Y: [0]\n                Create Ground at X: [-1] Y: [0]\n                Create Ground at X: [1] Y: [0]\n            else\n                if <(Level) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Create Ground at X: [0] Y: [0]\n                    Create Ground at X: [1] Y: [0]\n                    Create Ground at X: [2] Y: [0]\n                    Create Ground at X: [3] Y: [0]\n                else\n                    if <(Level) = [6]> then\n                        switch costume to (level 6 1 v)\n                        Create Ground at X: [0] Y: [0]\n                        Create Ground at X: [1] Y: [0]\n                        Create Ground at X: [2] Y: [0]\n                    else\n                        if <(Level) = [7]> then\n                            switch costume to (level 7 1 v)\n                            Create Ground at X: [0] Y: [0]\n                            Create Ground at X: [1] Y: [0]\n                            Create Ground at X: [2] Y: [0]\n                            Create Ground at X: [3] Y: [0]\n                        else\n                            if <(Level) = [8]> then\n                                switch costume to (level 8 1 v)\n                                Create Ground at X: [0] Y: [0]\n                                Create Ground at X: [-1] Y: [0]\n                                Create Ground at X: [1] Y: [0]\n                                Create Ground at X: [-2] Y: [0]\n                                Create Ground at X: [2] Y: [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Create Ground at X: (x) Y: (y)\nset [x v] to ((x) * (480))\nset [y v] to ((y) * (360))\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I receive [tick v]\nset size to (200) %\ngo to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\nset size to (100) %\n\nwhen I start as a clone\nshow\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\n@Counters\n\nwhen I receive [setup project v]\nhide\n\nwhen I receive [tick v]\nclear graphic effects\nRender Screen Counters\n\ndefine Render Screen Counters\nrepeat (1)\n    delete this clone\nend\nRender, Number (Coins Collected) at X: [-183] Y: [155] Size: [25] listMAX: (item (Level) of [coins needed v])\nRender, Number (Enemies Killed) at X: [-183] Y: [105] Size: [25] listMAX: (item (Level) of [total enemies v])\n\ndefine Render, Number (var) at X: (x) Y: (y) Size: (size) listMAX: (list)\nset [i v] to [1]\ngo to x: (x) y: (y)\nset size to (size) %\nrepeat ((length of (var)) + ((1) + (length of (list))))\n    switch costume to (letter (i) of (join (var) (join [/] (list))))\n    create clone of (_myself_ v)\n    change x by ((size) / (1.5))\n    change [i v] by (1)\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\n@Menu Helper GUI\n\nwhen I receive [setup project v]\nhide\nset [ghost v] effect to (0)\ngo to x: (-175) y: (-165)\ngo to [front v] layer\n\nwhen I receive [menu v]\nforever\n    hide\n    Detect for hover\nend\n\ndefine Detect for hover\nset [i v] to [1]\nrepeat (length of [mouse hovering? v])\n    if <(item (i) of [mouse hovering? v]) = [true]> then\n        switch costume to (i)\n        show\n        stop [this script v]\n    end\n    change [i v] by (1)\nend\n\n@Coins\n\nwhen I receive [setup project v]\ngo to [front v] layer\nhide\n\nwhen I receive [setup game v]\nCreate Coins\n\ndefine Create Coins\nset [coin id v] to [0]\nCreate Clone, X: [-210] Y: [-45] Level: [1]\nCreate Clone, X: [1510] Y: [130] Level: [1]\nCreate Clone, X: [1560] Y: [130] Level: [1]\nCreate Clone, X: [1610] Y: [130] Level: [1]\nCreate Clone, X: [-520] Y: [150] Level: [2]\nCreate Clone, X: [-470] Y: [150] Level: [2]\nCreate Clone, X: [750] Y: [-40] Level: [2]\nCreate Clone, X: [1000] Y: [100] Level: [2]\nCreate Clone, X: [680] Y: [120] Level: [3]\nCreate Clone, X: [1165] Y: [-65] Level: [3]\nCreate Clone, X: [1165] Y: [-20] Level: [3]\nCreate Clone, X: [312] Y: [142] Level: [3]\nCreate Clone, X: [-96] Y: [-74] Level: [4]\nCreate Clone, X: [-680] Y: [-74] Level: [4]\nCreate Clone, X: [240] Y: [77] Level: [5]\nCreate Clone, X: [1173] Y: [142] Level: [5]\nCreate Clone, X: [347] Y: [-50] Level: [6]\nCreate Clone, X: [519] Y: [161] Level: [6]\nCreate Clone, X: [845] Y: [115] Level: [6]\nCreate Clone, X: [847] Y: [152] Level: [7]\n\ndefine Create Clone, X: (x) Y: (y) Level: (level)\nif <(Level) = (level)> then\n    change [coin id v] by (1)\n    if <(letter (coin id) of (item (Level) of [coin status v])) = [0]> then\n        set [x v] to (x)\n        set [collected? v] to [false]\n        set [y v] to (y)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nshow\n\nwhen I receive [tick v]\nif <(collected?) = [false]> then\n    set size to (200) %\n    go to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\n    set size to (50) %\nend\n\nwhen I receive [collect v]\n_Detect\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [player dies v]\nrepeat until <(item (Level) of [coin status v]) = (____Prev coin status)>\n    replace item (Level) of [coin status v] with (____Prev coin status)\nend\n\ndefine _Detect\nif <touching (player v)?> then\n    _set list\n    set [_dead x v] to (x position)\n    set [_dead y v] to (y position)\n    broadcast (_collect coin v)\n    delete this clone\nend\n\ndefine _set list\nset [collected? v] to [true]\nset [i v] to [1]\nset [level coin v] to []\nrepeat ((coin id) - (1))\n    set [level coin v] to (join (level coin) (letter (i) of (item (Level) of [coin status v])))\n    change [i v] by (1)\nend\nset [level coin v] to (join (level coin) [1])\nchange [i v] by (1)\nrepeat ((length of (item (Level) of [coin status v])) - (coin id))\n    set [level coin v] to (join (level coin) (letter (i) of (item (Level) of [coin status v])))\n    change [i v] by (1)\nend\nreplace item (Level) of [coin status v] with (level coin)\n\nwhen I receive [setup game v]\nset [coin id v] to [0]\n\nwhen I receive [setup game v]\nwait (0.1) seconds\nset [____prev coin status v] to (item (Level) of [coin status v])\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\nwhen I receive [restart v]\nwait (0.1) seconds\nset [____prev coin status v] to (item (Level) of [coin status v])\n\n@Game Icons\n\nwhen I receive [setup project v]\nclear graphic effects\nhide\n\nwhen I receive [setup game v]\nCreate Icon at, [-215] [157] size [50] id [Coin Icon]\nCreate Icon at, [-215] [107] size [50] id [Enemy Icon]\n\ndefine Create Icon at, (x) (y) size (size) id (id)\ngo to x: (x) y: (y)\nset size to (size) %\nswitch costume to (id)\nset [clone id v] to (id)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [front v] layer\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\n@Danger\n\nwhen I receive [setup project v]\ngo to [front v] layer\nhide\n\nwhen I receive [setup game v]\nclear graphic effects\nrepeat (1)\n    delete this clone\nend\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1 1 v)\n    Create Danger at X: [0] Y: [0]\n    Create Danger at X: [1] Y: [0]\n    Create Danger at X: [2] Y: [0]\n    Create Danger at X: [3] Y: [0]\n    Create Danger at X: [4] Y: [0]\n    Create Danger at X: [5] Y: [0]\n    Create Danger at X: [6 ] Y: [0]\nelse\n    if <(Level) = [2]> then\n        switch costume to (level 2 1 v)\n        Create Danger at X: [0] Y: [0]\n        Create Danger at X: [1] Y: [0]\n        Create Danger at X: [-1] Y: [0]\n        Create Danger at X: [2] Y: [0]\n    else\n        if <(Level) = [3]> then\n            switch costume to (level 3 1 v)\n            Create Danger at X: [0] Y: [0]\n            Create Danger at X: [1] Y: [0]\n        else\n            if <(Level) = [5]> then\n                switch costume to (level 5 1 v)\n                Create Danger at X: [0] Y: [0]\n                Create Danger at X: [1] Y: [0]\n                Create Danger at X: [2] Y: [0]\n                Create Danger at X: [3] Y: [0]\n            end\n        end\n    end\nend\n\ndefine Create Danger at X: (x) Y: (y)\nset [x v] to ((x) * (480))\nset [y v] to ((y) * (360))\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I receive [tick v]\nset size to (200) %\ngo to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\nset size to (100) %\n\nwhen I start as a clone\nshow\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\n@Enemies\n\nwhen I receive [setup project v]\nset size to (50) %\npoint in direction (90)\nhide\n\nwhen I receive [setup game v]\nclear graphic effects\nCreate enemy at [762] [-51] to [400] on level [1]\nCreate enemy at [1225] [-80] to [175] on level [1]\nCreate enemy at [1500] [-80] to [175] on level [1]\nCreate enemy at [-285] [-52] to [-300] on level [2]\nCreate enemy at [800] [-80] to [300] on level [3]\nCreate enemy at [400] [-50] to [150] on level [3]\nCreate enemy at [170] [-80] to [150] on level [4]\nCreate enemy at [765] [-80] to [245] on level [5]\nCreate enemy at [645] [-59] to [200] on level [6]\nCreate enemy at [1236] [-59] to [200] on level [6]\nCreate enemy at [1236] [-59] to [300] on level [7]\n\ndefine Create enemy at (x) (y) to (x2) on level (level)\nif <(Level) = (level)> then\n    set [id v] to [clone]\n    set [status v] to [alive]\n    set [x v] to (x)\n    set [y v] to (y)\n    set [start x v] to (x)\n    set [end x v] to ((x) + (x2))\n    set [left/right v] to [0]\n    if <not <(x2) = [0]>> then\n        set [left/right v] to [1]\n    end\n    create clone of (_myself_ v)\n    set [id v] to [sprite]\nend\n\nwhen I start as a clone\nshow\n\nwhen I receive [tick v]\nif <(status) = [alive]> then\n    set size to (200) %\n    go to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\n    set size to (50) %\n    if <(_animation) = [false]> then\n        Tick\n    end\nend\n\ndefine Tick\nset [old x v] to (x)\nchange [x v] by ((((end x) - (start x)) / ([abs v] of ((end x) - (start x)) )) * (Enemy Movespeed))\nif <(old x) > (x)> then\n    set [left/right v] to [-1]\n    switch costume to (enemy left v)\nelse\n    set [left/right v] to [1]\n    switch costume to (enemy right v)\nend\nif <<<<(x) > (end x)> or <(x) = (end x)>> and <(left/right) = [1]>> or <<<(x) < (end x)> or <(x) = (end x)>> and <(left/right) = [-1]>>> then\n    set [old end x v] to (end x)\n    set [end x v] to (start x)\n    set [start x v] to (old end x)\nend\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [killed enemy v]\nif <<(distance to [player v]) < [75]> and <<(status) = [alive]> and <(id) = [clone]>>> then\n    set [edead x v] to (x)\n    set [edead y v] to (y)\n    broadcast (dead enemy v)\n    delete this clone\nend\n\nwhen I receive [teleport enemies v]\nif <touching (portals v)?> then\n    Set teleportation variables\n    go to [front v] layer\n    set [_animation v] to [true]\n    repeat (20)\n        change [ghost v] effect by (5)\n        change [x v] by (((start tx) - (x)) / (10))\n        change [y v] by (((start ty) - (y)) / (10))\n    end\n    repeat (20)\n        change [x v] by (((end tx) - (x)) / (5))\n        change [y v] by (((end ty) - (y)) / (5))\n    end\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    set [_animation v] to [false]\n    broadcast (done teleporting v)\nend\n\ndefine Set teleportation variables\nset [end tx v] to (End TX)\nset [end ty v] to (End TY)\nset [start ty v] to (Start TY)\nset [start tx v] to (Start TX)\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\n@Dead Enemy\n\nwhen I receive [dead enemy v]\ncreate clone of (_myself_ v)\n\nwhen I receive [setup project v]\nhide\ngo to [front v] layer\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I start as a clone\nclear graphic effects\nset [x v] to (EDead X)\nset [y v] to (EDead Y)\nset [delta y v] to [10]\nchange [enemies killed v] by (1)\npoint in direction (pick random (-70) to (50))\ngo to x: (0) y: (0)\nshow\nrepeat until <(y position) < [-179]>\n    change [delta y v] by (-1)\n    turn right (3) degrees\n    change [y v] by (delta y)\n    change [x v] by (5)\n    set size to (200) %\n    go to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\n    set size to (50) %\n    go to [front v] layer\nend\ndelete this clone\n\n@Death Screen\n\nwhen I receive [setup project v]\nhide\n\nwhen I receive [player dies v]\nswitch costume to (game over v)\nshow\nset size to (200) %\ngo to x: (0) y: (300)\nset size to (100) %\nrepeat (50)\n    change y by (((0) - (y position)) / (4))\n    go to [front v] layer\nend\n\nwhen I receive [delete everything v]\nhide\n\nwhen I receive [_next level v]\nswitch costume to (level complete v)\nshow\nset size to (200) %\ngo to x: (0) y: (300)\nset size to (100) %\nrepeat (50)\n    change y by (((0) - (y position)) / (4))\n    go to [front v] layer\nend\n\n@Death Icons\n\nwhen I receive [setup project v]\nhide\n\nwhen I receive [player dies v]\nCreate Clones\n\ndefine Create Clones\nswitch costume to (coin icon v)\nset size to (200) %\ngo to x: (-150) y: (445)\nset size to (50) %\ncreate clone of (_myself_ v)\nswitch costume to (enemy icon v)\ngo to x: (50) y: (445)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nrepeat (50)\n    change y by (((50) - (y position)) / (4))\n    go to [front v] layer\nend\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nCreate Clones\n\n@Death Counters\n\nwhen I receive [setup project v]\nhide\n\ndefine Render, Number (var) at X: (x) Y: (y) Size: (size) listMAX: (list)\nset [i v] to [1]\ngo to x: (x) y: (y)\nset size to (size) %\nrepeat ((length of (var)) + ((1) + (length of (list))))\n    switch costume to (letter (i) of (join (var) (join [/] (list))))\n    create clone of (_myself_ v)\n    change x by ((size) / (1.5))\n    change [i v] by (1)\nend\n\nwhen I start as a clone\nshow\nrepeat (50)\n    change y by (((50) - (y position)) / (4))\n    go to [front v] layer\nend\n\nwhen I receive [player dies v]\nRender, Number (Coins Collected) at X: [-115] Y: [345] Size: [25] listMAX: (item (Level) of [coins needed v])\nRender, Number (Enemies Killed) at X: [85] Y: [345] Size: [25] listMAX: (item (Level) of [total enemies v])\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nRender, Number (Coins Collected) at X: [-115] Y: [345] Size: [25] listMAX: (item (Level) of [coins needed v])\nRender, Number (Enemies Killed) at X: [85] Y: [345] Size: [25] listMAX: (item (Level) of [total enemies v])\n\n@BG Parallax\n\nwhen I receive [setup project v]\nclear graphic effects\nhide\nCreate Parallax\n\ndefine Create Parallax\nset [i v] to [1]\nrepeat (5)\n    create clone of (_myself_ v)\n    change [i v] by (1)\nend\n\nwhen I start as a clone\nswitch costume to (i)\nif <(costume [name v]) = [Moon]> then\n    set [ghost v] effect to (90)\nend\ngo to [back v] layer\ngo [forward v] ([abs v] of ((i) - (6)) ) layers\nshow\nforever\n    if <(costume [name v]) = [Black Background]> then\n        go to x: (0) y: (0)\n    else\n        go to x: ((mouse x) / ((i) * (15))) y: ((mouse y) / ((i) * (15)))\n    end\nend\n\n@_Buttons\n\nwhen I start as a clone\nwait (0.0001) seconds\nif <<(Coins) < (item ((Level) + (1)) of [level reqs v])> and <(costume [name v]) = [Next]>> then\n    switch costume to (join [Locked ] ((Level) + (1)))\nend\nshow\nrepeat (50)\n    change y by (((-25) - (y position)) / (4))\n    go to [front v] layer\nend\nforever\n    if <<touching (mouse-pointer v)?> and <not < (costume [name v]) contains [Locked]?>>> then\n        Smooth Grow/Shrink, Speed [4] End Size [90] Times [5] * [n]\n    else\n        Smooth Grow/Shrink, Speed [4] End Size [75] Times [5] * [n]\n    end\n    if <<<<touching (mouse-pointer v)?> and <mouse down?>> and <($Button Already Pressed BugFix) = [0]>> and <not < (costume [name v]) contains [Locked]?>>> then\n        set [$button already pressed bugfix v] to [1]\n        Smooth Grow/Shrink, Speed [2] End Size [60] Times [5] * [y]\n        wait until <not <mouse down?>>\n        broadcast (costume [name v])\n        set [$button already pressed bugfix v] to [0]\n    end\nend\n\ndefine Create Clones For Death\nswitch costume to (restart v)\nset size to (200) %\ngo to x: (-50) y: (420)\nset size to (75) %\ncreate clone of (_myself_ v)\nswitch costume to (home v)\ngo to x: (50) y: (420)\ncreate clone of (_myself_ v)\n\nwhen I receive [player dies v]\nCreate Clones For Death\n\nwhen I receive [setup project v]\npoint in direction (0)\nhide\n\ndefine Smooth Grow/Shrink, Speed (speed) End Size (size) Times (times) * (y/n)\nrepeat (times)\n    change size by (((size) - (size)) / (speed))\n    if <<mouse down?> and <(y/n) = [n]>> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [delete everything v]\ndelete this clone\n\ndefine Create Clones for next level\nswitch costume to (restart v)\nset size to (200) %\ngo to x: (-100) y: (420)\nset size to (75) %\ncreate clone of (_myself_ v)\nswitch costume to (home v)\ngo to x: (0) y: (420)\ncreate clone of (_myself_ v)\nswitch costume to (next v)\ngo to x: (100) y: (420)\ncreate clone of (_myself_ v)\n\nwhen I receive [_next level v]\nCreate Clones for next level\n\n@Transition\n\nwhen I receive [setup project v]\ngo to x: (0) y: (0)\nhide\nclear graphic effects\n\nwhen I receive [level select v]\nBasic Transition\nbroadcast (Setup Play Button v) and wait\nbroadcast (Play v)\nrepeat (([ceiling v] of ([abs v] of ((((item (4) of [settings data v]) / (10)) * (2)) - (21)) ) ) * (2))\n    change [ghost v] effect by ([ceiling v] of ([abs v] of ((((item (4) of [settings data v]) / (10)) * (2)) - (21)) ) )\n    go to [front v] layer\nend\nset [ghost v] effect to (100)\n\ndefine Basic Transition\nset [ghost v] effect to (100)\nshow\nrepeat (([ceiling v] of ([abs v] of (((item (4) of [settings data v]) / (2)) - (51)) ) ) * (2))\n    if <([ceiling v] of (((item (4) of [settings data v]) / (12.5)) - (1)) ) = ([abs v] of ([ceiling v] of (((item (4) of [settings data v]) / (12.5)) - (1)) ) )> then\n        change [ghost v] effect by ((0) - ([ceiling v] of (((item (4) of [settings data v]) / (12.5)) - (1)) ))\n    else\n        change [ghost v] effect by ([ceiling v] of (((item (4) of [settings data v]) / (12.5)) - (1)) )\n    end\n    go to [front v] layer\nend\nbroadcast (Delete Everything v)\nwait (0.5) seconds\n\nwhen I receive [home v]\nBasic Transition\nbroadcast (Menu v)\nrepeat (([ceiling v] of ([abs v] of ((((item (4) of [settings data v]) / (10)) * (2)) - (21)) ) ) * (2))\n    change [ghost v] effect by ([ceiling v] of ([abs v] of ((((item (4) of [settings data v]) / (10)) * (2)) - (21)) ) )\n    go to [front v] layer\nend\nset [ghost v] effect to (100)\n\nwhen I receive [restart v]\nBasic Transition\nbroadcast (Setup Game v) and wait\nbroadcast (Play Game v)\nrepeat (([ceiling v] of ([abs v] of ((((item (4) of [settings data v]) / (10)) * (2)) - (21)) ) ) * (2))\n    change [ghost v] effect by ([ceiling v] of ([abs v] of ((((item (4) of [settings data v]) / (10)) * (2)) - (21)) ) )\n    go to [front v] layer\nend\nset [ghost v] effect to (100)\n\nwhen I receive [next v]\nBasic Transition\nchange [level v] by (1)\nbroadcast (Setup Game v) and wait\nbroadcast (Play Game v)\nrepeat (([ceiling v] of ([abs v] of ((((item (4) of [settings data v]) / (10)) * (2)) - (21)) ) ) * (2))\n    change [ghost v] effect by ([ceiling v] of ([abs v] of ((((item (4) of [settings data v]) / (10)) * (2)) - (21)) ) )\n    go to [front v] layer\nend\nset [ghost v] effect to (100)\n\n@Collect Coin\n\nwhen I receive [_collect coin v]\ngo to x: (_Dead X) y: (_Dead Y)\ncreate clone of (_myself_ v)\n\nwhen I receive [setup project v]\nhide\ngo to [front v] layer\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I start as a clone\npoint in direction (90)\nclear graphic effects\n__Find Total coins\nshow\nrepeat (50)\n    change y by (((157) - (y position)) / (4))\n    change x by (((-215) - (x position)) / (4))\nend\ndelete this clone\n\ndefine __Find Total coins\nset [i v] to [1]\nset [1s v] to [0]\nrepeat (length of (item (Level) of [coin status v]))\n    if <(letter (i) of (item (Level) of [coin status v])) = [1]> then\n        change [1s v] by (1)\n    end\n    change [i v] by (1)\nend\nset [coins collected v] to (1s)\n\n@Moving Traps\n\nwhen I receive [tick v]\nif <(id) = [clone]> then\n    set size to (300) %\n    Re positon\n    if <(spinning?) = [true]> then\n        turn right ((Trap Speed) * (2)) degrees\n    else\n        point in direction (90)\n    end\n    set size to (100) %\n    Detection\nend\n\ndefine Create Trap (x) (y) movement (xmove) (ymove) costume (costume) spin <y/n>\nset [x v] to ((x) * (460))\nset [y v] to (y)\nset [startx v] to (x)\nset [starty v] to (y)\nset [endx v] to ((x) + (xmove))\nset [endy v] to ((y) + (ymove))\nif <(endX) < (startX)> then\n    set [left/right v] to [-1]\nelse\n    set [left/right v] to [1]\nend\nif <(endY) < (startY)> then\n    set [up/down v] to [-1]\nelse\n    set [up/down v] to [1]\nend\nif <y/n> then\n    set [spinning? v] to [true]\nelse\n    set [spinning? v] to [false]\nend\nset [id v] to [clone]\nswitch costume to (costume)\ncreate clone of (_myself_ v)\nset [id v] to [sprite]\n\nwhen I receive [setup game v]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [2]> then\n    Create Trap [0.7] [-10] movement [300] [0] costume [1] spin <[1] = [1]>\n    Create Trap ((780) / (480)) [-150] movement [0] [90] costume [2] spin <[1] = [0]>\n    Create Trap ((1000) / (480)) [-150] movement [0] [90] costume [3] spin <[1] = [0]>\nelse\n    if <(Level) = [3]> then\n        Create Trap [0.7] [-50] movement [0] [150] costume [1] spin <[1] = [1]>\n        Create Trap ((800) / (480)) [110] movement [0] [0] costume [1] spin <[1] = [1]>\n        Create Trap ((1340) / (480)) [-25] movement [350] [0] costume [1] spin <[1] = [1]>\n    else\n        if <(Level) = [4]> then\n            Create Trap ((-50) / (480)) [40] movement [0] [0] costume [5] spin <[1] = [1]>\n            Create Trap ((-710) / (480)) [-100] movement [0] [200] costume [6] spin <[1] = [1]>\n            Create Trap ((257) / (480)) [50] movement [300] [0] costume [1] spin <[1] = [1]>\n        else\n            if <(Level) = [5]> then\n                Create Trap ((280) / (480)) [51] movement [200] [0] costume [5] spin <[1] = [1]>\n            else\n                if <(Level) = [6]> then\n                    Create Trap ((765) / (480)) [115] movement [0] [0] costume [6] spin <[1] = [1]>\n                    Create Trap ((1230) / (480)) [-74] movement [0] [0] costume [7] spin <[1] = [0]>\n                else\n                    if <(Level) = [7]> then\n                        Create Trap ((85) / (480)) [0] movement [200] [0] costume [5] spin <[1] = [1]>\n                        Create Trap ((285) / (480)) [100] movement [-200] [0] costume [5] spin <[1] = [1]>\n                        Create Trap ((700) / (480)) [-170] movement [0] [100] costume [8] spin <[1] = [0]>\n                        Create Trap ((750) / (480)) [-70] movement [0] [-100] costume [8] spin <[1] = [0]>\n                        Create Trap [1.04] [0] movement [0] [0] costume [9] spin <[1] = [0]>\n                        Create Trap ((1300) / (480)) [100] movement [0] [-150] costume [6] spin <[1] = [1]>\n                        Create Trap ((1550) / (480)) [-50] movement [0] [150] costume [6] spin <[1] = [1]>\n                    else\n                        if <(Level) = [8]> then\n                            Create Trap ((530) / (480)) [105] movement [0] [0] costume [6] spin <[1] = [1]>\n                            Create Trap ((625) / (480)) [-50] movement [0] [0] costume [6] spin <[1] = [1]>\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [setup game v]\nhide\nswitch costume to (trap v)\n\nwhen I start as a clone\nRe positon\n\nwhen I receive [end v]\ndelete this clone\n\ndefine Detection\nchange [x v] by ((((endX) - (startX)) / ([abs v] of ((endX) - (startX)) )) * (Trap Speed))\nchange [y v] by ((((endY) - (startY)) / ([abs v] of ((endY) - (startY)) )) * (Trap Speed))\nif <<<<(x) > (endX)> or <(x) = (endX)>> and <(left/right) = [1]>> or <<<(x) < (endX)> or <(x) = (endX)>> and <(left/right) = [-1]>>> then\n    set [x v] to (endX)\n    set [endx v] to (startX)\n    set [startx v] to (x)\n    if <(left/right) = [1]> then\n        set [left/right v] to [-1]\n    else\n        set [left/right v] to [1]\n    end\nend\nif <<(y) = (endY)> or <<<(y) > (endY)> and <(up/down) = [1]>> or <<(y) < (endY)> and <(up/down) = [-1]>>>> then\n    set [y v] to (endY)\n    set [endy v] to (startY)\n    set [starty v] to (y)\n    if <(up/down) = [1]> then\n        set [up/down v] to [-1]\n    else\n        set [up/down v] to [1]\n    end\nend\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\ndefine Re positon\nset size to (300) %\ngo to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\nset size to (100) %\nif <<not <((x) - (Scroll X)) = (x position)>> or <not <((y) - (Scroll Y)) = (y position)>>> then\n    hide\nelse\n    show\nend\n\n@Music\n\nwhen I receive [setup project v]\nbroadcast (song v)\n\nwhen I receive [song v]\nforever\n    play sound [607493_The-Force v] until done\nend\n\nwhen I receive [song v]\nforever\n    set volume to (item (1) of [settings data v]) %\nend\n\n@Menu Icons\n\nwhen I receive [menu v]\ngo to [front v] layer\nset size to (50) %\ngo to x: ((215) - ((length of (Coins)) * (32))) y: (-153)\nshow\n\nwhen I receive [setup game v]\nhide\n\nwhen I receive [_next level v]\ngo to [front v] layer\nset size to (50) %\ngo to x: ((215) - ((length of (Coins)) * (32))) y: (-153)\nshow\n\nwhen I receive [player dies v]\ngo to [front v] layer\nset size to (50) %\ngo to x: ((215) - ((length of (Coins)) * (32))) y: (-153)\nshow\n\n@Trampoline\n\nwhen I start as a clone\nshow\nswitch costume to (pad1 v)\ngo to [front v] layer\nforever\n    if <touching (player v)?> then\n        broadcast (bounce v)\n        repeat (3)\n            next costume\n            wait (0.001) seconds\n        end\n        repeat (3)\n            switch costume to ((costume [number v]) - (1))\n            wait (0.001) seconds\n        end\n    end\nend\n\nwhen I receive [setup project v]\nhide\n\nwhen I receive [setup game v]\nCreate Clone at [200] [-65] on level [3]\nCreate Clone at [600] [-65] on level [3]\nCreate Clone at [100] [-95] on level [4]\nCreate Clone at [1255] [-93] on level [5]\nCreate Clone at [996] [-70] on level [6]\nCreate Clone at [180] [-71] on level [7]\nCreate Clone at [1150] [-71] on level [7]\nCreate Clone at [0] [-71] on level [8]\nCreate Clone at [-550] [-71] on level [8]\nCreate Clone at [325] [-71] on level [8]\nCreate Clone at [500] [-71] on level [8]\n\ndefine Create Clone at (x) (y) on level (level)\nif <(Level) = (level)> then\n    set [x v] to (x)\n    set [y v] to (y)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [tick v]\nset size to (200) %\ngo to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\nset size to (60) %\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\n@Boosters\n\nwhen I receive [setup project v]\nhide\n\ndefine Create Clone at (x) (y) on level (level) power (powerx) (powery) dir (dir) costume (costume)\nif <(Level) = (level)> then\n    switch costume to (costume)\n    point in direction (dir)\n    set [x v] to (x)\n    set [y v] to (y)\n    set [powerx v] to (powerx)\n    set [powery v] to (powery)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [tick v]\nset size to (200) %\ngo to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\nset size to (60) %\nif <touching (player v)?> then\n    set [boost x v] to (powerx)\n    set [boost y v] to (powery)\n    broadcast (boost v)\nend\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [setup game v]\nCreate Clone at [600] [110] on level [3] power [10] [0] dir [90] costume [1]\nCreate Clone at [1240] [70] on level [3] power [-10] [0] dir [-90] costume [1]\nCreate Clone at [1340] [70] on level [3] power [-10] [0] dir [-90] costume [1]\nCreate Clone at [1440] [70] on level [3] power [-10] [0] dir [-90] costume [1]\nCreate Clone at [1540] [70] on level [3] power [-10] [0] dir [-90] costume [1]\nCreate Clone at [1640] [70] on level [3] power [-10] [0] dir [-90] costume [1]\nCreate Clone at [100] [110] on level [4] power [0] [-10] dir [180] costume [1]\nCreate Clone at [-51] [117] on level [4] power [-0.75] [0] dir [-90] costume [2]\nCreate Clone at [-200] [65] on level [4] power [7] [4] dir [65] costume [1]\nCreate Clone at [645] [39] on level [6] power [2.5] [2.5] dir [65] costume [2]\nCreate Clone at [745] [39] on level [6] power [0] [5] dir [0] costume [2]\nCreate Clone at [845] [39] on level [6] power [-2.5] [2.5] dir [-65] costume [2]\nCreate Clone at [1019] [-90] on level [7] power [-10] [0] dir [-90] costume [2]\nCreate Clone at [1019] [-40] on level [7] power [-10] [0] dir [-90] costume [2]\nCreate Clone at [1019] [100] on level [7] power [-10] [0] dir [-90] costume [2]\nCreate Clone at [1019] [150] on level [7] power [-10] [0] dir [-90] costume [2]\nCreate Clone at [1019] [200] on level [7] power [-10] [0] dir [-90] costume [2]\nCreate Clone at [0] [150] on level [8] power [-15] [0] dir [-90] costume [1]\nCreate Clone at [-550] [150] on level [8] power [9] [-6] dir [120] costume [1]\nCreate Clone at [-413] [-31] on level [8] power [15] [0] dir [90] costume [1]\nCreate Clone at [250] [-40] on level [8] power [2] [0] dir [90] costume [2]\nCreate Clone at [325] [130] on level [8] power [-5] [0] dir [-90] costume [2]\nCreate Clone at [415] [-40] on level [8] power [9] [0] dir [90] costume [1]\nCreate Clone at [250] [130] on level [8] power [10] [6] dir [45] costume [1]\n\nwhen I start as a clone\nshow\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\n@Menu Counters\n\nwhen I receive [setup project v]\nhide\n\ndefine Render Screen Counters\nRender, Number (Coins) at X: ((218) - (((length of (Coins)) - (1)) * (10))) Y: [-155] Size: [25]\n\ndefine Render, Number (var) at X: (x) Y: (y) Size: (size)\nset [i v] to [1]\ngo to x: (x) y: (y)\nset size to (size) %\nrepeat (length of (var))\n    switch costume to (letter (i) of (var))\n    create clone of (_myself_ v)\n    change x by ((size) / (1.6))\n    change [i v] by (1)\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\nwhen I receive [setup game v]\nhide\n\nwhen I receive [_next level v]\nwait (0.0001) seconds\nRender Screen Counters\n\nwhen I receive [player dies v]\nwait (0.0001) seconds\nRender Screen Counters\n\nwhen I receive [setup game v]\ndelete this clone\n\nwhen I receive [setup project v]\nRender Screen Counters\n\nwhen I receive [finished loading v]\ndelete this clone\n\nwhen I receive [finished loading v]\nwait (0.0001) seconds\nRender Screen Counters\n\n@Messages\n\nwhen I receive [setup project v]\nhide\nclear graphic effects\n\nwhen I receive [_null message v]\nswitch costume to (join [Level ] (___Message))\nclear graphic effects\ngo to [front v] layer\nshow\nwait (1) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nclear graphic effects\nhide\n\n@Splash\n\nwhen flag clicked\nhide\n\ngo to [front v] layer\n\n@Portals\n\nwhen I receive [setup project v]\nhide\n\nwhen I receive [setup game v]\ndelete all of [green portal x v]\ndelete all of [green portal y v]\ndelete all of [purple portal y v]\ndelete all of [purple portal x v]\nset [i v] to [1]\nset [_teleporting? v] to [false]\nset [portal turn speed v] to [15]\nCreate Portal link starting at [150] [150] to [250] [-50] on level [5] size [100]\nCreate Portal link starting at [440] [-50] to [350] [119] on level [5] size [100]\nCreate Portal link starting at [1100] [-80] to [650] [-80] on level [5] size [75]\nCreate Portal link starting at [1244] [141] to [1384] [-70] on level [5] size [90]\nCreate Portal link starting at [-150] [50] to [275] [50] on level [6] size [90]\nCreate Portal link starting at [0] [50] to [275] [150] on level [6] size [90]\nCreate Portal link starting at [150] [50] to [275] [-50] on level [6] size [90]\nCreate Portal link starting at [430] [50] to [525] [50] on level [6] size [90]\nCreate Portal link starting at [430] [150] to [525] [50] on level [6] size [90]\nCreate Portal link starting at [430] [-50] to [525] [50] on level [6] size [90]\nCreate Portal link starting at [180] [150] to [410] [150] on level [7] size [75]\nCreate Portal link starting at [-266] [79] to [-550] [20] on level [8] size [90]\nCreate Portal link starting at [-266] [-50] to [125] [150] on level [8] size [75]\nCreate Portal link starting at [125] [50] to [-650] [150] on level [8] size [75]\nCreate Portal link starting at [-650] [-50] to [250] [50] on level [8] size [75]\nCreate Portal link starting at [655] [86] to [775] [-25] on level [8] size [75]\n\ndefine Create Portal link starting at (x) (y) to (x2) (y2) on level (level) size (size)\nif <(Level) = (level)> then\n    set [size v] to (size)\n    set [type v] to [enter]\n    switch costume to (enter v)\n    add (x) to [green portal x v]\n    add (y) to [green portal y v]\n    set [x v] to (item (i) of [green portal x v])\n    set [y v] to (item (i) of [green portal y v])\n    create clone of (_myself_ v)\n    set [type v] to [exit]\n    switch costume to (exit v)\n    add (x2) to [purple portal x v]\n    add (y2) to [purple portal y v]\n    set [x v] to (item (i) of [purple portal x v])\n    set [y v] to (item (i) of [purple portal y v])\n    create clone of (_myself_ v)\n    change [i v] by (1)\nend\n\nwhen I receive [tick v]\nset size to (200) %\nturn right ((((costume [number v]) mod (2)) * ((portal turn speed) * (2))) - (portal turn speed)) degrees\ngo to x: ((x) - (Scroll X)) y: ((y) - (Scroll Y))\nset size to (size) %\nif <<<touching (player v)?> or <touching (enemies v)?>> and <(type) = [enter]>> then\n    set [start tx v] to (x)\n    set [start ty v] to (y)\n    set [end tx v] to (item (i) of [purple portal x v])\n    set [end ty v] to (item (i) of [purple portal y v])\n    broadcast (return end v) and wait\n    if <(_teleporting?) = [false]> then\n        if <<touching (player v)?> and <([_animation in progress? v] of [player v]) = [false]>> then\n            broadcast (Teleport v)\n        else\n            if <touching (enemies v)?> then\n                broadcast (Teleport Enemies v)\n            end\n        end\n        set [_teleporting? v] to [true]\n    end\nend\n\nwhen I start as a clone\nshow\n\nwhen I receive [done teleporting v]\nset [_teleporting? v] to [false]\n\nwhen I receive [delete everything v]\ndelete this clone\n\nwhen I receive [_next level v]\nset [brightness v] effect to (-10)\n\nwhen I receive [player dies v]\nset [brightness v] effect to (-10)\n\n@Sliders\n\nwhen I receive [setup project v]\nhide\n\ndefine Create Slider at (y) and id of (id)\nset [end y v] to (y)\nset [slider id v] to (id)\nset [slider part v] to [Slider]\ncreate clone of (_myself_ v)\nset [slider part v] to [Button]\ncreate clone of (_myself_ v)\nset [slider id v] to [SPRITE]\n\nwhen I start as a clone\nhide\nswitch costume to (slider part)\nif <(slider part) = [Button]> then\n    go to x: (((item (slider id) of [settings data v]) * (1.72)) + (36)) y: (-200)\nelse\n    go to x: (122) y: (-200)\nend\ngo to [front v] layer\ngo [backward v] (costume [number v]) layers\nshow\nrepeat (40)\n    change y by (((end Y) - (y position)) / (5))\nend\nforever\n    if <(slider part) = [Button]> then\n        if <<touching (mouse-pointer v)?> and <mouse down?>> then\n            repeat until <not <mouse down?>>\n                set x to (mouse x)\n                if <(x position) < [36]> then\n                    set x to (36)\n                end\n                if <(x position) > [208]> then\n                    set x to (208)\n                end\n                Update Variables\n            end\n        end\n        Update Variables\n    end\nend\n\nwhen I receive [settings v]\nCreate Slider at [150] and id of [1]\nCreate Slider at [100] and id of [2]\nCreate Slider at [50] and id of [3]\nCreate Slider at [0] and id of [4]\n\ndefine Update Variables\nif <(length of [settings data v]) < (slider id)> then\n    repeat ((slider id) - (length of [settings data v]))\n        add [] to [settings data v]\n    end\n    replace item (slider id) of [settings data v] with (round (((x position) - (36)) / (1.72)))\nelse\n    replace item (slider id) of [settings data v] with (round (((x position) - (36)) / (1.72)))\nend\n\nwhen I receive [back v]\ndelete this clone\n\n@Slider Labels\n\nwhen I receive [setup project v]\nhide\n\ndefine Create Slider at (y) and id of (id)\nset [end y v] to (y)\nset [label id v] to (id)\ncreate clone of (_myself_ v)\nset [label id v] to [SPRITE]\n\nwhen I start as a clone\nhide\ngo to x: (-41) y: (-200)\nswitch costume to (label id)\ngo to [front v] layer\nshow\nrepeat (40)\n    change y by (((end Y) - (y position)) / (5))\nend\n\nwhen I receive [settings v]\nCreate Slider at [150] and id of [1]\nCreate Slider at [100] and id of [2]\nCreate Slider at [50] and id of [3]\nCreate Slider at [0] and id of [4]\n\nwhen I receive [back v]\ndelete this clone\n\n
+This is most likely the final release\n\nInstructions:\n+Use the arrow keys or WASD to move your character\n+Collect coins to unlock more levels\n+Jump onto enemies to kill them\n+Avoid Spikes and Blades\n+Enter Green Portals to be Teleported to Purple Portals\n\nSaving Progress:\n+Press the "Save" button in the start menu\n+Triple click the code it gives you\n+Create a .txt document and paste the code into it\n+When you want to get your progress back press the "Load" button\n\nCode:\n+Global Variables 30+\n+Total Variables 50+\n+Total Lists 10+\n+Total Blocks 2410+\n+Total Sprites 30+