Dream - A platformer (Mobile Friendly)

Instructions: WAD, ⬆️⬅️➡️, or use the joystick to move. The score on the right is the high score. If the high score is not updating, that means you are not a scratcher. \n\n\nAdded:\n• Highscore\n• Mobile Joystick\n• Highscore Username\n• Highscore resets (automatically does it every month)\n• Bug fix

@Stage\n\nwhen flag clicked\nwait until <not <(timer) = [0]>>\nforever\n    play sound [Trance Music for Racing Game v] until done\nend\n\nwhen flag clicked\nforever\n    if <<(level) = [12]> or > then\n        switch backdrop to (backdrop2 v)\n    else\n        switch backdrop to (backdrop1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <not <(☁ last) = (current [month v])>> then\n        set [☁ last v] to (current [month v])\n        set [☁ highs v] to [86400]\n        set [☁ u v] to [283004300850]\n    end\nend\n\n@blank\n\n@dream\n\nwhen flag clicked\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [level v] to [1]\nreset\ngo to x: (-200) y: (y position)\nforever\n    erase all\n    point in direction (90)\n    switch costume to (hitbox v)\n    tick\n    if <key (h v) pressed?> then\n        set [ghost v] effect to (0)\n        stamp\n        set [ghost v] effect to (75)\n    else\n        set [ghost v] effect to (0)\n    end\n    costume\nend\n\ndefine slope\nset [slope v] to [0]\nrepeat until <<[8] < (slope)> or <not <touching (platforms v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\n\ndefine costume\ngo to [front v] layer\ngo [backward v] (17) layers\nset [joystick direction v] to [90]\nset [joystick power v] to [0]\nif <<<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <(Joystick power x) < [-0.4]>> and <not <<key (d v) pressed?> or <key (right arrow v) pressed?>>>> then\n    switch costume to (left v)\nelse\n    if <<<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <[0.4] < (Joystick power x)>> and <not <<key (a v) pressed?> or <key (left arrow v) pressed?>>>> then\n        switch costume to (right v)\n    else\n        switch costume to (idle v)\n    end\nend\npoint in direction (((xvel) * (1.2)) + (90))\n\ndefine reset\nswitch costume to (hitbox v)\ngo to x: (-240) y: (-180)\nrepeat until <not <touching (platforms v)?>>\n    change y by (1)\nend\n\ndefine tick\nchange [xvel v] by ((<<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <[0.4] < (Joystick power x)>> - <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <(Joystick power x) < [-0.4]>>) * (4))\nset [xvel v] to ((xvel) * (0.7))\nchange x by (xvel)\nchange x by ((<(xvel) < [0]> - <[0] < (xvel)>) * (-1))\nslope\nchange x by ((<[0] < (xvel)> - <(xvel) < [0]>) * (-1))\nif <[8] < (slope)> then\n    change y by (-9)\n    change x by ((xvel) * (-1))\n    set [xvel v] to [0]\n    if <touching (platforms v)?> then\n        out\n    end\nend\nchange [yvel v] by (-1)\nchange y by (yvel)\nif <touching (platforms v)?> then\n    change y by ((yvel) * (-1))\n    if <(hands) = [1]> then\n        in\n        change y by (-1)\n    end\n    set [yvel v] to [0]\nend\nset [hands v] to [0]\nif <<<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <[0.333] < (Joystick power y)>> and <not <touching (water v)?>>> then\n    change y by (-3)\n    if <touching (platforms v)?> then\n        set [yvel v] to [14]\n    else\n        change y by (16)\n        if <touching (platforms v)?> then\n            set [yvel v] to [10]\n            set [hands v] to [1]\n        end\n        change y by (-16)\n    end\n    change y by (3)\nend\nif <touching (water v)?> then\n    set [yvel v] to ((yvel) * (0.75))\n    if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <[0.333] < (Joystick power y)>> then\n        change [yvel v] by (3)\n    else\n        if <<<key (s v) pressed?> or <key (down arrow v) pressed?>> or <(Joystick power y) < [-0.1]>> then\n            change [yvel v] by (0.25)\n        else\n            change [yvel v] by (1.1)\n        end\n    end\nend\nif <<touching (spikes v)?> or <<key (r v) pressed?> and <not <key (q v) pressed?>>>> then\n    start sound (pick random (1) to (2))\n    reset\n    go to x: (-200) y: (y position)\n    switch costume to (idle v)\n    wait until <not <key (r v) pressed?>>\nend\nif <<<key (r v) pressed?> and <key (q v) pressed?>> and <not <(level) = [18]>>> then\n    set [xvel v] to [0]\n    set [yvel v] to [0]\n    set [level v] to [1]\n    set [hands v] to [0]\n    go to x: (-200) y: (-58)\n    switch costume to (idle v)\n    repeat until <not <<key (r v) pressed?> and <key (q v) pressed?>>>\n        reset timer\n    end\n    repeat until <<<<key (a v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> or <[0.3] < (Joystick Power)>>\n        reset timer\n    end\nend\nif <[235] < (x position)> then\n    reset\n    change [level v] by (1)\nend\nif <(y position) < [-185]> then\n    start sound (pick random (1) to (2))\n    reset\n    go to x: (-200) y: (y position)\nend\n\ndefine in\nrepeat until <touching (platforms v)?>\n    change y by (1)\nend\n\ndefine out\nrepeat until <not <touching (platforms v)?>>\n    change y by (1)\nend\n\nwhen flag clicked\nrepeat until <not <(x position) = [-200]>>\n    reset timer\nend\n\nwhen flag clicked\nforever\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        set [joystick direction v] to [-90]\n        set [joystick power v] to [25]\n        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n            set [joystick direction v] to [-45]\n        else\n            if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n                set [joystick direction v] to [-125]\n                set [joystick power v] to [25]\n            end\n        end\n    else\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            set [joystick direction v] to [90]\n            set [joystick power v] to [25]\n            if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                set [joystick direction v] to [45]\n            else\n                if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n                    set [joystick direction v] to [125]\n                    set [joystick power v] to [25]\n                end\n            end\n        else\n            if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                set [joystick direction v] to [0]\n                set [joystick power v] to [25]\n            else\n                if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n                    set [joystick direction v] to [-180]\n                    set [joystick power v] to [25]\n                else\n                    set [joystick direction v] to [90]\n                    set [joystick power v] to [0]\n                end\n            end\n        end\n    end\nend\n\n@dream's hands\n\nwhen flag clicked\nset [hands v] to [0]\nforever\n    go to (dream v)\n    if <(hands) = [1]> then\n        show\n    else\n        hide\n    end\n    go to [front v] layer\nend\n\nset [hands v] to [1]\n\n@platforms\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@spikes\n\nwhen flag clicked\nforever\n    switch costume to (level)\n    if <(level) = [12]> then\n        go to [back v] layer\n        go to x: (0) y: (([cos v] of ((timer) * (100)) ) * (30))\n    else\n        go to [front v] layer\n        go [backward v] (16) layers\n        go to x: (0) y: (0)\n    end\nend\n\n@water\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@text\n\nwhen flag clicked\nforever\n    switch costume to (costume10 v)\n    go to x: (0) y: (([cos v] of ((timer) * (100)) ) * (10))\n    switch costume to (level)\n    go to [front v] layer\n    go [forward v] ((1) / (0)) layers\nend\n\nswitch costume to (costume19 v)\n\n@timer\n\ndefine draw timer\ngo to x: (-220) y: (155)\nset [num v] to [0]\nrepeat (length of (timer))\n    change [num v] by (1)\n    switch costume to (letter (num) of (timer))\n    create clone of (_myself_ v)\n    change x by (25)\nend\n\nwhen flag clicked\nhide\nforever\n    broadcast (delete clones v)\n    draw timer\n    if <(level) = [18]> then\n        if <(timer) < (☁ highs)> then\n            set [☁ highs v] to (timer)\n            broadcast (hi v)\n        end\n        forever\n    end\nend\n\nwhen I receive [delete clones v]\ndelete this clone\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nforever\n    if <touching (text v)?> then\n        set [ghost v] effect to (50)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\n@high score\n\ndefine draw timer\ngo to x: (220) y: (155)\nset [num v] to (length of (☁ highs))\nrepeat (length of (☁ highs))\n    switch costume to (letter (num) of (☁ highs))\n    create clone of (_myself_ v)\n    change x by (-25)\n    change [num v] by (-1)\nend\n\nwhen flag clicked\nhide\nforever\n    repeat until <(level) = [18]>\n        draw timer\n    end\n    draw timer\n    forever\nend\n\nwhen I receive [delete clones v]\ndelete this clone\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nforever\n    if <touching (text v)?> then\n        set [ghost v] effect to (50)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nset [☁ highs v] to [99999]\n\n@username highscore\n\ndefine ren\npoint in direction (90)\ngo to x: (215) y: (125)\nset [l v] to ((length of (username)) + (1))\nrepeat (length of (username))\n    change [l v] by (-1)\n    switch costume to (letter (l) of (username))\n    create clone of (_myself_ v)\n    change x by (-8.25)\n    set y to (125)\n    if <not <(timer) < [0.1]>> then\n        change y by (([cos v] of (((timer) * (100)) * (l)) ) * (2))\n    end\nend\n\nwhen flag clicked\nhide\nforever\n    broadcast (usus get v)\nend\n\nwhen flag clicked\nforever\n    broadcast (del v)\n    ren\nend\n\nwhen I receive [del v]\ndelete this clone\n\nwhen I start as a clone\nshow\nif <touching (text v)?> then\n    set [ghost v] effect to (50)\nend\n\n@Joystick\n\nwhen flag clicked\nset size to (100) %\nset [base sprite v] to [Joystick]\nset [joystick x pos v] to [185]\nset [joystick y pos v] to [-125]\nset [maximum stick power v] to ((size) / (4))\ngo to x: (Joystick x Pos) y: (Joystick y Pos)\nset [ghost v] effect to (60)\ngo to [front v] layer\ncreate clone of (_myself_ v)\nforever\n    switch costume to (base v)\n    go to x: (Joystick x Pos) y: (Joystick y Pos)\nend\n\nwhen I start as a clone\ngo to [front v] layer\ngo [forward v] (1) layers\nset [ghost v] effect to (25)\nforever\n    switch costume to (stick v)\n    set [joystick power v] to []\n    set [joystick power x v] to [0]\n    set [joystick power y v] to [0]\n    set [joystick direction v] to [90]\n    repeat until <mouse down?>\n        go to x: (Joystick x Pos) y: (Joystick y Pos)\n        point in direction (Joystick Direction)\n        move (Joystick Power) steps\n    end\n    if <(distance to [mouse-pointer v]) < ((size) * (.45))> then\n        if <touching (mouse-pointer v)?> then\n            set [x+ v] to ((x position) - (mouse x))\n            set [y+ v] to ((y position) - (mouse y))\n        else\n            set [x+ v] to []\n            set [y+ v] to []\n        end\n        Drag\n    else\n        wait until <not <mouse down?>>\n    end\nend\n\ndefine Drag\nrepeat until <not <mouse down?>>\n    go to x: ((mouse x) + (x+)) y: ((mouse y) + (y+))\n    point towards (base sprite)\n    turn right (180) degrees\n    set [joystick direction v] to (direction)\n    set [joystick power v] to (distance to [(base sprite) v])\n    if <(Maximum Stick Power) < (Joystick Power)> then\n        move ((Maximum Stick Power) - (Joystick Power)) steps\n        set [joystick power v] to (Maximum Stick Power)\n    end\n    set [joystick power v] to ((Joystick Power) / (Maximum Stick Power))\n    set [joystick power x v] to ((Joystick Power) * ([sin v] of (Joystick Direction) ))\n    set [joystick power y v] to ((Joystick Power) * ([cos v] of (Joystick Direction) ))\nend\n\n@encode decode\n\nwhen flag clicked\nbroadcast (init v)\n\ndefine encode (text)\nset [letter v] to [0]\nset [output v] to []\nrepeat (length of (text))\n    change [letter v] by (1)\n    switch costume to (letter (letter) of (text))\n    if <[9] < (costume [number v])> then\n        set [output v] to (join (output) (costume [number v]))\n    else\n        set [output v] to (join (output) (join [0] (costume [number v])))\n    end\nend\n\nwhen I receive [init v]\ndelete all of [chars v]\nadd [A] to [chars v]\nadd [a] to [chars v]\nadd [B] to [chars v]\nadd [b] to [chars v]\nadd [C] to [chars v]\nadd [c] to [chars v]\nadd [D] to [chars v]\nadd [d] to [chars v]\nadd [E] to [chars v]\nadd [e] to [chars v]\nadd [F] to [chars v]\nadd [f] to [chars v]\nadd [G] to [chars v]\nadd [g] to [chars v]\nadd [H] to [chars v]\nadd [h] to [chars v]\nadd [I] to [chars v]\nadd [i] to [chars v]\nadd [J] to [chars v]\nadd [j] to [chars v]\nadd [K] to [chars v]\nadd [k] to [chars v]\nadd [L] to [chars v]\nadd [l] to [chars v]\nadd [M] to [chars v]\nadd [m] to [chars v]\nadd [N] to [chars v]\nadd [n] to [chars v]\nadd [O] to [chars v]\nadd [o] to [chars v]\nadd [P] to [chars v]\nadd [p] to [chars v]\nadd [Q] to [chars v]\nadd [q] to [chars v]\nadd [R] to [chars v]\nadd [r] to [chars v]\nadd [S] to [chars v]\nadd [s] to [chars v]\nadd [T] to [chars v]\nadd [t] to [chars v]\nadd [U] to [chars v]\nadd [u] to [chars v]\nadd [V] to [chars v]\nadd [v] to [chars v]\nadd [W] to [chars v]\nadd [w] to [chars v]\nadd [X] to [chars v]\nadd [x] to [chars v]\nadd [Y] to [chars v]\nadd [y] to [chars v]\nadd [Z] to [chars v]\nadd [z] to [chars v]\nadd [`] to [chars v]\nadd [~] to [chars v]\nadd [1] to [chars v]\nadd [!] to [chars v]\nadd [2] to [chars v]\nadd [@] to [chars v]\nadd [3] to [chars v]\nadd [#] to [chars v]\nadd [4] to [chars v]\nadd [$] to [chars v]\nadd [5] to [chars v]\nadd [%] to [chars v]\nadd [6] to [chars v]\nadd [^] to [chars v]\nadd [7] to [chars v]\nadd [&] to [chars v]\nadd [8] to [chars v]\nadd [*] to [chars v]\nadd [9] to [chars v]\nadd [\(] to [chars v]\nadd [0] to [chars v]\nadd [\)] to [chars v]\nadd [-] to [chars v]\nadd [_] to [chars v]\nadd [=] to [chars v]\nadd [+] to [chars v]\nadd [\[] to [chars v]\nadd [{] to [chars v]\nadd [\]] to [chars v]\nadd [}] to [chars v]\nadd [|] to [chars v]\nadd [\] to [chars v]\nadd [;] to [chars v]\nadd [:] to [chars v]\nadd ['] to [chars v]\nadd ["] to [chars v]\nadd [,] to [chars v]\nadd [<] to [chars v]\nadd [.] to [chars v]\nadd [>] to [chars v]\nadd [/] to [chars v]\nadd [?] to [chars v]\nadd [ ] to [chars v]\n\ndefine decode (text)\nset [letter v] to [1]\nset [output v] to []\nrepeat ((length of (text)) / (2))\n    switch costume to (item (join (letter (letter) of (text)) (letter ((letter) + (1)) of (text))) of [chars v])\n    set [output v] to (join (output) (costume [name v]))\n    change [letter v] by (2)\nend\n\nwhen I receive [hi v]\nset [e v] to [1]\nencode (username)\nset [☁ u v] to (output)\nset [e v] to [0]\n\nwhen I receive [usus get v]\nif <(e) = [0]> then\n    decode (☁ u)\n    set [username v] to (output)\nend\n\ndecode []\n\nwhen flag clicked\nset [e v] to [0]\n\n@Sprite1\n\nwhen flag clicked\n\nhide\nif <not <(username) = [TrendingProjects]>> then\n    show\n    stop [all v]\nend\n\n