Magic Hatter - A platformer
@Stage\n\nwhen flag clicked\nrepeat until <(backdrop [number v]) = [17]>\n    play sound [Sovereign v] until done\nend\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen backdrop switches to [backdrop17 v]\nforever\n    if <<(☁ High Score) < (score)> and <(cheat) = [0]>> then\n        set [☁ high score v] to (score)\n    end\nend\n\nwhen flag clicked\nhide variable [☁ high score v]\n\nwhen backdrop switches to [backdrop17 v]\nstop all sounds\n\nwhen flag clicked\nset [cheat v] to [0]\n\n@Magic Hat \n\nwhen I receive [hat 1 found v]\nswitch costume to (magic hat guy 1 v)\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [2]> then\n        set [speed v] to [0.6]\n        set [jump v] to [8]\n    end\nend\n\nwhen [1 v] key pressed\nswitch costume to (magic hat guy v)\n\nwhen [2 v] key pressed\nif <(hat 1) = [1]> then\n    switch costume to (magic hat guy 1 v)\nend\n\nwhen flag clicked\nhide variable [deaths v]\nforever\n    if <(costume [number v]) = [1]> then\n        set [speed v] to [0.4]\n        set [jump v] to [7]\n    end\nend\n\nwhen I receive [hat 2 found v]\nswitch costume to (magic hat guy2 v)\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [3]> then\n        set [speed v] to [0.4]\n        set [jump v] to [15]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [4]> then\n        set [speed v] to [0.7]\n        set [jump v] to [12]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [5]> then\n        set [speed v] to [1.2]\n        set [jump v] to [10]\n    end\nend\n\nwhen [3 v] key pressed\nif <(hat 2) = [1]> then\n    switch costume to (magic hat guy2 v)\nend\n\nwhen I receive [hat 3 found v]\nswitch costume to (magic hat guy3 v)\n\nwhen I receive [hat 2 found v]\nswitch costume to (magic hat guy2 v)\n\nwhen I receive [hat 4 found v]\nswitch costume to (magic hat guy4 v)\n\nwhen [5 v] key pressed\nif <(hat 4) = [1]> then\n    switch costume to (magic hat guy4 v)\nend\n\nwhen I receive [hat 5 found v]\nswitch costume to (magic hat guy5 v)\n\nwhen [6 v] key pressed\nif <(hat 5) = [1]> then\n    switch costume to (magic hat guy5 v)\nend\n\nwhen [4 v] key pressed\nif <(hat 3) = [1]> then\n    switch costume to (magic hat guy3 v)\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [6]> then\n        set [speed v] to [0.7]\n        set [jump v] to [25]\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#ff9400)?> then\n        set [dead v] to [1]\n        change [deaths v] by (1)\n    end\nend\n\nwhen backdrop switches to [backdrop1 v]\nset [xv v] to [0]\nset [yv v] to [0]\nshow\ngo to x: (-212) y: (-20)\npoint in direction (90)\nset rotation style [left-right v]\nset size to (150) %\nswitch costume to (magic hat guy v)\n\nwhen flag clicked\nforever\n    if <touching color (#006622)?> then\n        point in direction (Safe Direction)\n        go to x: (Safe X ) y: (Safe Y)\n    else\n        set [safe x  v] to (x position)\n        set [safe y v] to (y position)\n        set [safe direction v] to (direction)\n    end\nend\n\nwhen flag clicked\nset [speed v] to [0.3]\nset [jump v] to [6]\nset [hat 1 v] to [0]\nset [hat 2 v] to [0]\nset [hat 4 v] to [0]\nset [hat 3 v] to [0]\nset [dead v] to [0]\nset [deaths v] to [0]\nset [hat 5 v] to [0]\n\nwhen backdrop switches to [backdrop17 v]\nhide\n\nwhen [space v] key pressed\nwait (0.5) seconds\ngo to x: (-212) y: (-20)\nshow\n\nwhen I receive [hide guy v]\nhide\n\nwhen backdrop switches to [backdrop17 v]\nhide\nstop [other scripts in sprite v]\n\nwhen flag clicked\nforever\n    set [xx v] to (Xv)\nend\n\nwhen flag clicked\nforever\n    set [yy v] to (Yv)\nend\n\nwhen flag clicked\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (speed)\n        point in direction (90)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by ((-1) * (speed))\n        point in direction (-90)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#006622)?> then\n        change y by (1)\n        if <touching color (#006622)?> then\n            change y by (1)\n            if <touching color (#006622)?> then\n                change y by (1)\n                if <touching color (#006622)?> then\n                    change y by (1)\n                    if <touching color (#006622)?> then\n                        change y by (1)\n                        if <touching color (#006622)?> then\n                            change x by ((Xv) * (-0.5))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-2]\n                                else\n                                    set [xv v] to [2]\n                                end\n                                set [yv v] to (jump)\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching color (#006622)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#006622)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to (jump)\n        end\n    end\n    change y by (1)\n    if <(x position) > [220]> then\n        go to x: (-212) y: (-68)\n        switch backdrop to (next backdrop v)\n    end\n    if <(dead) = [1]> then\n        go to x: (-212) y: (-68)\n        set [dead v] to [0]\n    end\nend\n\n@cloud 1\n\nwhen flag clicked\nshow\ngo to x: (170) y: (100)\nset size to (200) %\ngo [backward v] (5) layers\n\nwhen flag clicked\nforever\n    set [cloud movement v] to ((pick random (0.5) to (3)) * (0.9))\nend\n\nif <(x position) > [240]> then\n    go to x: (214) y: (90)\n    hide\n    wait (1) seconds\n    go to x: (-240) y: (90)\n    show\nend\n\nwhen backdrop switches to [backdrop17 v]\nstop [other scripts in sprite v]\nhide\n\nmove (cloud movement) steps\n\n@Cloud 2\n\nwhen backdrop switches to [backdrop17 v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\nshow\ngo to x: (-180) y: (85)\nset size to (200) %\ngo [backward v] (5) layers\n\n@Cloud 3\n\nwhen backdrop switches to [backdrop17 v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\nshow\ngo to x: (50) y: (85)\nset size to (200) %\ngo [backward v] (5) layers\n\n@Cloud 4\n\nwhen flag clicked\nshow\ngo to x: (-65) y: (100)\nset size to (200) %\ngo [backward v] (5) layers\n\nwhen backdrop switches to [backdrop17 v]\nstop [other scripts in sprite v]\nhide\n\n@Text for hats\n\nwhen I receive [hat 1 found v]\nbroadcast (hide guy v)\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nshow\n\nwhen I receive [hat 2 found v]\nbroadcast (hide guy v)\ngo to x: (0) y: (0)\nswitch costume to (costume2 v)\nshow\n\nwhen I receive [hat 3 found v]\nbroadcast (hide guy v)\ngo to x: (0) y: (0)\nswitch costume to (costume3 v)\nshow\n\nwhen I receive [hat 4 found v]\nbroadcast (hide guy v)\ngo to x: (0) y: (0)\nswitch costume to (costume4 v)\nshow\n\nwhen I receive [hat 5 found v]\nbroadcast (hide guy v)\ngo to x: (0) y: (0)\nswitch costume to (costume5 v)\nshow\n\nwhen [space v] key pressed\nhide\n\nwhen flag clicked\nhide\ngo to [front v] layer\n\n@Sprite4\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\ngo to [front v] layer\ngo [backward v] (100) layers\nif <(pick random (1) to (4)) = [1]> then\n    switch costume to (star v)\nend\nif <(pick random (1) to (4)) = [2]> then\n    switch costume to (heart v)\nend\nif <(pick random (1) to (4)) = [3]> then\n    switch costume to (smile v)\nend\nif <(pick random (1) to (4)) = [4]> then\n    switch costume to (speach v)\nend\nset size to (pick random (2) to (12)) %\ngo to x: (pick random (-240) to (240)) y: (180)\nglide (pick random (2) to (10)) secs to x: (pick random (-240) to (240)) y: (-180)\ndelete this clone\n\nwhen backdrop switches to [backdrop17 v]\nforever\n    forever\n        forever\n            create clone of (_myself_ v)\n        end\n    end\nend\n\nwhen backdrop switches to [backdrop17 v]\nwait (1) seconds\nforever\n    play sound [Red Lights- Tiesto v] until done\nend\n\n@Sprite6\n\nwhen flag clicked\nhide\n\nwhen flag clicked\n\nforever\n    if <<(backdrop [name v]) = [backdrop 18]> and <(Ninja Dead?) = [0]>> then\n        show\n    else\n        hide\n    end\nend\n\nwhen backdrop switches to [backdrop18 v]\nbroadcast (Ninja v)\n\nwhen I receive [ninja v]\nif <(backdrop [name v]) = [backdrop 18]> then\n    repeat until <<(Ninja Dead?) = [1]> or <(backdrop [name v]) = <not <(backdrop [name v]) = [18]>>>>\n    end\nend\n\n@Sprite5\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\n@hit box\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (speed)\n        point in direction (90)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by ((-1) * (speed))\n        point in direction (-90)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#006622)?> then\n        change y by (1)\n        if <touching color (#006622)?> then\n            change y by (1)\n            if <touching color (#006622)?> then\n                change y by (1)\n                if <touching color (#006622)?> then\n                    change y by (1)\n                    if <touching color (#006622)?> then\n                        change y by (1)\n                        if <touching color (#006622)?> then\n                            change x by ((Xv) * (-0.5))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-2]\n                                else\n                                    set [xv v] to [2]\n                                end\n                                set [yv v] to (jump)\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching color (#006622)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#006622)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to (jump)\n        end\n    end\n    change y by (1)\n    if <(x position) > [220]> then\n        go to x: (-212) y: (-68)\n        switch backdrop to (next backdrop v)\n    end\n    if <(dead) = [1]> then\n        go to x: (-212) y: (-68)\n        set [dead v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    set x to (Xx)\n    set y to (Yy)\nend\n\n@display\n\nwhen I receive [gameover v]\nstop [other scripts in sprite v]\nset [ghost v] to [100]\nrepeat (10)\n    stamp (score) at (0) (0) size (600) gap (6) allign (0) ghost (ghost)\nend\n\nwhen flag clicked\nbroadcast (start v)\ngo to x: (0) y: (152)\nforever\n    go to [front v] layer\nend\n\ndefine None\n\nwhen flag clicked\nforever\n    set [score v] to ((500) - (deaths))\nend\n\ndefine None\nif <(length of (string)) > [0]> then\n    erase all\n    if <(a) = [2]> then\n        go to x: (x) y: (y)\n    else\n        if <(a) = [3]> then\n            go to x: ((x) - (((length of (string)) - (1)) * ((g) * ((s) / (100))))) y: (y)\n        else\n            go to x: (((x) - (((length of (string)) / (2)) * ((g) * ((s) / (100))))) + (((g) / (2)) * ((s) / (100)))) y: (y)\n        end\n    end\n    if <not <(size) = (s)>> then\n        set size to (s) %\n    end\n    set [_l v] to [1]\n    repeat (length of (string))\n        if <not <(_t) = (join [] (letter (_l) of (string)))>> then\n            set [_t v] to (join [] (letter (_l) of (string)))\n            switch costume to (join [] (_t))\n        end\n        stamp\n        change x by ((g) * ((s) / (100)))\n        change [_l v] by (1)\n    end\nend\n\nwhen I receive [start v]\ngo to [front v] layer\nset [score v] to [0]\nrepeat until <(backdrop [name v]) = [backdrop17]>\n    stamp (score) at (0) (152) size (600) gap (6) allign (0) ghost (0)\nend\n\nwhen backdrop switches to [backdrop17 v]\nhide\nwait (0.01) seconds\nforever\n    stamp (☁ High Score) at (1) (152) size (600) gap (600) allign (0) ghost (0)\nend\n\n@display2\n\ndefine None\n\nwhen flag clicked\nhide\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (-100)\nset size to (300) %\nhide\n\nwhen backdrop switches to [backdrop8 v]\nshow\nrepeat until <touching (magic hat  v)?>\n    switch costume to (costume3 v)\nend\nhide\nbroadcast (hat 3 found v)\nset [hat 3 v] to [1]\n\nwhen backdrop switches to [backdrop11 v]\nshow\nrepeat until <touching (magic hat  v)?>\n    switch costume to (costume4 v)\nend\nhide\nbroadcast (hat 4 found v)\nset [hat 4 v] to [1]\n\nwhen backdrop switches to [backdrop2 v]\nshow\nrepeat until <touching (magic hat  v)?>\n    switch costume to (costume1 v)\nend\nhide\nbroadcast (hat 1 found v)\nset [hat 1 v] to [1]\n\nwhen backdrop switches to [backdrop5 v]\nshow\nrepeat until <touching (magic hat  v)?>\n    switch costume to (costume2 v)\nend\nhide\nbroadcast (hat 2 found v)\nset [hat 2 v] to [1]\n\nwhen backdrop switches to [backdrop14 v]\nshow\nrepeat until <touching (magic hat  v)?>\n    switch costume to (costume5 v)\nend\nhide\nbroadcast (hat 5 found v)\nset [hat 5 v] to [1]\n\n@Sprite2\n\nwhen flag clicked\nhide\n\n@Sprite3\n\nwhen flag clicked\nset size to (100) %\ngo to x: (0) y: (0)\nshow\nset [ghost v] effect to (100)\ngo to [front v] layer\n\n@Sprite7\n\nwhen flag clicked\nhide\n\n
-Use W, A, S, D or the arrow keys to control the Guy.\n-To switch between the hats you have picked up use \n-the number keys 1-6\n-everything is possible!\n-Heart or Star it if you liked it!\n-WARNING: you may need to switch hats mid-jump to complete levels\n- Don't switch hats while climbing!\n-press space to restart a level\n- Thanks for three thousand views!\n-Credit to whoever made the score