Harry Potter and The Sorcerer's Stone Platformer

Instructions: Hit the green flag to begin!\nUse arrow keys to move. To get through the table, make sure to collect the "floating" key. Avoid Devilsnare (green) fire (orange), troll boogar (orange), Fluffy (brown) and Quirrel's turban/robes (purple)

@Stage\n\nwhen flag clicked\nforever\n    play sound [HarryPotter-ThemeSong-1 v] until done\nend\n\n@Ground\n\nwhen flag clicked\ngo to x: (-1) y: (-15)\nclear graphic effects\nhide\n\nwhen I receive [start v]\ngo to x: (-1) y: (-15)\nswitch costume to (1 v)\nrepeat (16)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I receive [dead v]\nset [screen shake v] to [2.5]\n\nwhen flag clicked\nforever\n    go to x: (-1) y: (-15)\n    set [screen shake v] to ((screen shake) * (-0.7))\n    change x by (screen shake)\n    change y by (screen shake)\nend\n\nwhen I start as a clone\nshow\nforever\n    go to x: ((Scroll X) + (((costume [number v]) - (1)) * (478))) y: (-15)\nend\n\nshow\n\nwhen I receive [done v]\nstop [other scripts in sprite v]\nhide\n\nbroadcast (done v)\n\n@Player\n\nchange x by ((-1) * (xv))\nset [xv v] to ((-1) * (xv))\n\nchange [x v] by ((-1) * (x position))\nset x to (0)\n\nwhen I receive [levelup v]\nhide\ngo to x: (startX) y: (-40)\nset [xv v] to [0]\nset [yv v] to [0]\nshow\nstop [this script v]\n\nwhen I receive [start v]\nset [touchkey? v] to [no]\nset [scroll x v] to [0]\nshow\ngo to x: (-222) y: (-40)\nerase all\npen up\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nset [x v] to [0]\ngo to x: (startX) y: (-40)\nset [xv v] to [0]\nset [yv v] to [0]\nreset timer\nforever\n    switch costume to (costume2 v)\n    if <(x position) > [235]> then\n        set [levup v] to [1]\n        broadcast (levelup v) and wait\n    end\n    if <touching color (#99b2ff)?> then\n        if <<<<mouse down?> and <(x position) > (mouse x)>> or <key (left arrow v) pressed?>> or <key (a v) pressed?>> then\n            change [xv v] by (-1)\n        end\n        if <<<<mouse down?> and <(x position) < (mouse x)>> or <key (right arrow v) pressed?>> or <key (d v) pressed?>> then\n            change [xv v] by (1)\n        end\n        if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n            change [yv v] by (-1)\n        end\n        if <<<<mouse down?> and <(y position) < (mouse y)>> or <key (up arrow v) pressed?>> or <key (w v) pressed?>> then\n            change [yv v] by (1)\n        end\n        set [xv v] to ((xv) * (0.8))\n        set [yv v] to ((yv) * (0.8))\n        change [yv v] by (((yv) / (15)) + (0.1))\n        if <touching color (#ffd16b)?> then\n            set [touchkey? v] to [yes]\n        end\n        if <<(touchkey?) = [no]> and <touching color (#b16401)?>> then\n            broadcast (dead v) and wait\n            set [x v] to [0]\n            go to x: (startX) y: (-40)\n            set [xv v] to [0]\n            set [yv v] to [0]\n        end\n        if <<touching color (#ffb457)?> or <<<touching color (#185b00)?> or <touching color (#af8446)?>> or <touching color (#e5e5e5)?>>> then\n            broadcast (dead v) and wait\n            set [x v] to [0]\n            go to x: (startX) y: (-40)\n            set [xv v] to [0]\n            set [yv v] to [0]\n        end\n        change x by (xv)\n        change y by (yv)\n        if <not <touching color (#99b2ff)?>> then\n            change y by (-2)\n            if <touching color (#99b2ff)?> then\n                change y by (2)\n                change y by ((-1) * (yv))\n                if <<<<mouse down?> and <(y position) < (mouse y)>> or <key (up arrow v) pressed?>> or <key (w v) pressed?>> then\n                    change y by (yv)\n                    set [yv v] to [9]\n                end\n            end\n        end\n        if <touching color (#454545)?> then\n            change y by (-2)\n            if <touching color (#454545)?> then\n                change x by ((-1) * (xv))\n                set [xv v] to ((-1) * (xv))\n            end\n            change y by (2)\n        end\n        if <touching color (#454545)?> then\n            change y by (-6)\n            if <not <touching color (#454545)?>> then\n                change y by ((-1) * (yv))\n                set [yv v] to ((-1) * (yv))\n            end\n            change y by (6)\n        end\n    else\n        if <<(y position) < [-170]> or <<<<<touching color (#185b00)?> or <touching color (#ffb457)?>> or <touching color (#af8446)?>> or <touching color (#e5e5e5)?>> or <touching color (#9600be)?>>> then\n            broadcast (dead v) and wait\n            set [x v] to [0]\n            set [scroll x v] to [0]\n            go to x: (startX) y: (-40)\n            set [xv v] to [0]\n            set [yv v] to [0]\n        end\n        if <<<<mouse down?> and <(x position) > (mouse x)>> or <key (left arrow v) pressed?>> or <key (a v) pressed?>> then\n            change [xv v] by (-1)\n        end\n        if <<<<mouse down?> and <(x position) < (mouse x)>> or <key (right arrow v) pressed?>> or <key (d v) pressed?>> then\n            change [xv v] by (1)\n        end\n        if <touching color (#779ce7)?> then\n            broadcast (done v)\n        end\n        set [xv v] to ((xv) * (0.85))\n        change x by (xv)\n        if <touching color (#454545)?> then\n            change y by (-2)\n            if <touching color (#454545)?> then\n                change x by ((-1) * ((xv) + ((xv) / (([abs v] of (xv) ) + (0.0001)))))\n                if <<<<<mouse down?> and <(y position) < (mouse y)>> or <key (up arrow v) pressed?>> or <key (w v) pressed?>> and <not <(xv) = [0]>>> then\n                    set [yv v] to [8]\n                    set [xv v] to (((xv) / ([abs v] of (xv) )) * (-10))\n                else\n                    set [xv v] to [0]\n                end\n            end\n            change y by (2)\n        end\n        change y by (-3)\n    end\n    change [scroll x v] by (() - (x position))\n    change x by (() - (x position))\n    if <<<<<mouse down?> and <(y position) < (mouse y)>> or <key (up arrow v) pressed?>> or <key (w v) pressed?>> and <touching color (#454545)?>> then\n        set [yv v] to [9]\n    end\n    change y by (3)\n    if <(yv) > [-15]> then\n        change [yv v] by (-0.5)\n    end\n    if <(yv) < [3]> then\n        change y by (-2)\n        if <not <touching color (#454545)?>> then\n            change y by (-1)\n        end\n        change y by (2)\n    end\n    change y by (yv)\n    if <touching color (#454545)?> then\n        change y by (-2)\n        if <touching color (#454545)?> then\n            change y by ((-1) * (yv))\n            set [yv v] to [-3]\n        end\n        change y by (2)\n    end\n    switch costume to (costume1 v)\nend\n\nwhen flag clicked\nbroadcast (start v)\nset [ghost v] effect to (100)\nset [startx v] to [-222]\n\nset [level v] to [1]\n\nwhen I receive [dead v]\nstart sound [Pillow-Hit-2 v]\n\nset [level v] to [0]\n\nset [touchkey? v] to [no]\n\nwhen I receive [done v]\nstop [other scripts in sprite v]\nhide\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [done v]\nshow\n\n@Sprite2\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nshow\n\ngo to [front v] layer\nset [ghost v] effect to (0)\n\n@Sprite3\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nforever\n    go to [front v] layer\n    reset timer\nend\n\nwhen I receive [done v]\nstop [other scripts in sprite v]\nhide\n\nwhen [timer v] > (.2)\nhide\n\n@<3\n\ndefine Controls - Left and Right\nset [improved2: speed x v] to ((Improved2: speed x) * (0.7))\nif  then\n    change [improved2: speed x v] by (-1.5)\nend\nif <<<<mouse down?> and <(x position) < (mouse x)>> or <key (right arrow v) pressed?>> or <key (d v) pressed?>> then\n    change [improved2: speed x v] by (1.5)\nend\n\ndefine Walk (direction) (speed) max step (step)\npoint in direction (direction)\nchange x by (speed)\nchange [improved2: frame v] by (([abs v] of (speed) ) / (8))\nset [improved2: slope v] to [0]\nGet Touching <(Improved2: in platforrm) = [1]>\nrepeat until <<(Improved2: slope) = (step)> or <(Improved2: touch) = [0]>>\n    change y by (1)\n    change [improved2: slope v] by (1)\n    Get Touching <(Improved2: in platforrm) = [1]>\nend\nif <(Improved2: slope) = (step)> then\n    change x by ((0) - (speed))\n    change y by ((0) - (Improved2: slope))\n    if <<(Improved2: touch) = [1]> and <(Improved2: in platforrm) = [1]>> then\n        set [improved2: in platforrm v] to [2]\n        Walk (direction) (speed) max step (step)\n        if <(Improved2: speed x) = [0]> then\n            set [improved2: in platforrm v] to [1]\n        end\n    else\n        if <<<<<<mouse down?> and <(y position) < (mouse y)>> or <key (up arrow v) pressed?>> or <key (w v) pressed?>> and <([abs v] of (speed) ) > [3.5]>> and <(Improved2: touch) > [1]>> then\n            set [improved2: speed x v] to ((-1.2) * (speed))\n            set [improved2: speed y v] to [11]\n            set [improved2: falling? v] to [6]\n            set [improved2: wall jump v] to [15]\n        else\n            set [improved2: speed x v] to [0]\n        end\n    end\nend\n\ndefine Gravity\nif <<(Improved2: speed y) < [4]> or <<<<mouse down?> and <(y position) < (mouse y)>> or <key (up arrow v) pressed?>> or <key (w v) pressed?>>> then\n    change [improved2: speed y v] by (-1)\nelse\n    change [improved2: speed y v] by (-2)\nend\nchange y by (Improved2: speed y)\nchange [improved2: falling? v] by (1)\n\ndefine Check Hit Ceiling / Floor <up?>\nGet Touching \nif <(Improved2: touch) = [0]> then\n    set [improved2: in platforrm v] to [1]\nelse\n    if <<up?> and <(Improved2: touch) = [1]>> then\n        set [improved2: in platforrm v] to [2]\n    end\nend\nrepeat until <(Improved2: touch) < (Improved2: in platforrm)>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [improved2: falling? v] to [0]\n    end\n    Get Touching <not <up?>>\n    set [improved2: speed y v] to [0]\n    go to [front v] layer\nend\n\ndefine Get Touching <check platform?>\nif <<touching (ground v)?> or <touching (hay v)?>> then\n    set [improved2: touch v] to [9]\nelse\n    if <<check platform?> and <<touching (ground v)?> or <touching (hay v)?>>> then\n        set [improved2: touch v] to [1]\n    else\n        set [improved2: touch v] to [0]\n    end\n    if <touching color (#48d6db)?> then\n        broadcast (end v)\n    end\nend\n\ndefine Reset Level\npoint in direction (-90)\nset size to (25) %\nset rotation style [left-right v]\ngo to x: (-205) y: (130)\nreset timer\nshow\nset [improved2: speed x v] to [0]\nset [improved2: speed y v] to [0]\nset [improved2: falling? v] to [10]\nset [improved2: in platforrm v] to [1]\nset [improved2: frame v] to [0]\nset [improved2: wall jump v] to [0]\n\ndefine Set Costume\nif <(Improved2: falling?) < [6]> then\n    if <(Improved2: frame) = [0]> then\n        switch costume to (stand v)\n    else\n        switch costume to ([floor v] of ((1) + ((Improved2: frame) mod (10))) )\n    end\nelse\n    if <(Improved2: speed y) > [0]> then\n        switch costume to (jump v)\n    else\n        switch costume to (fall v)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\nhide\n\n