MAGIC PLATFORMER

Instructions: Arrow keys to move.\nClick the spellbook icon to view your spells.\nPress space on the platforms to use the spells.\n\nI am currently working on the sequel\nPlease don't comment about glitches as I will not be fixing them for this project. I will fix bugs in the sequel though.

@Stage\n\n@Player\n\nwhen flag clicked\nset [gravity v] to [-1]\nBegin and Reset Level\n\ndefine move in steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((Speed X) / (steps))\n    Check touching solid\n    if <(touching) > [0]> then\n        set x to (last value)\n        set [speed x v] to [0]\n    end\n    set [last value v] to (y position)\n    change y by ((Speed Y) / (steps))\n    Check touching solid\n    if <(touching) > [0]> then\n        set y to (last value)\n        if <(Speed Y) < [0]> then\n            set [falling v] to [0]\n        end\n        set [speed y v] to [0]\n    end\nend\n\ndefine Check touching solid\nif <touching (level v)?> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick- player v]\nControls - Up and Down\nControls - Left and Right\nmove in steps (([abs v] of (Speed Y) ) + ([abs v] of (Speed X) ))\n\ndefine Controls - Up and Down\nif <key (up arrow v) pressed?> then\n    if <(falling) < [3]> then\n        set [speed y v] to [12]\n    end\nend\nchange [speed y v] by (Gravity)\n\ndefine Controls - Left and Right\nset rotation style [left-right v]\nif <key (left arrow v) pressed?> then\n    change [speed x v] by (-1.5)\nend\nif <key (right arrow v) pressed?> then\n    change [speed x v] by (1.5)\nend\nset [speed x v] to ((Speed X) * (0.8))\n\ndefine Begin and Reset Level\nset [speed y v] to [0]\nset [speed x v] to [0]\nset [falling v] to [99]\ngo to x: (-194) y: (46)\nbroadcast (Game Loop v)\n\nwhen I receive [game loop v]\nforever\n    broadcast (Tick- Player v)\nend\n\nwhen I receive [next level v]\nset x to (-220)\nset y to (-39)\n\nwhen flag clicked\nforever\n    if <touching (next level v)?> then\n        broadcast (Next Level v)\n    end\nend\n\n@Level\n\nwhen I receive [next level v]\nnext costume\nchange [level v] by (1)\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (costume1 v)\n\nwhen I receive [learn mage hand v]\nswitch costume to (costume4 v)\n\nwhen I receive [pull lever v]\nswitch costume to (costume5 v)\n\nwhen I receive [tick- player v]\nreception\n\ndefine reception\nif <(receptor) = [3]> then\n    switch costume to (costume9 v)\n    set [receptor v] to [0]\nend\n\nwhen I receive [burn v]\nswitch costume to (costume13 v)\n\nwhen I receive [learn chain lightning v]\nswitch costume to (costume16 v)\n\nwhen I receive [learn cone of cold v]\nswitch costume to (costume19 v)\n\n@next level\n\n@spellbook\n\nwhen flag clicked\nshow list [spells known v]\ndelete all of [spells known v]\nset [ghost v] effect to (50)\n\nwhen I receive [tick- player v]\nselect\n\ndefine select\nif <touching (mouse-pointer v)?> then\n    clear graphic effects\nelse\n    set [ghost v] effect to (50)\nend\n\nwhen this sprite clicked\nhide list [spells known v]\nbroadcast (open v)\n\n@close\n\nwhen flag clicked\nhide\n\nwhen I receive [tick- player v]\nselect\n\ndefine select\nif <touching (mouse-pointer v)?> then\n    clear graphic effects\nelse\n    set [ghost v] effect to (50)\nend\n\nwhen this sprite clicked\nshow list [spells known v]\nhide\n\nwhen I receive [open v]\nshow\n\n@platform mh\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [tick- player v]\nlearn mage hand\n\ndefine learn mage hand\nif <(LEVEL) = [3]> then\n    show\nelse\n    hide\nend\n\nwhen [space v] key pressed\nif <touching (player v)?> then\n    if <(LEVEL) = [3]> then\n        add [Mage Hand] to [spells known v]\n        broadcast (learn mage hand v)\n    end\nend\n\n@mage hand\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [tick- player v]\nmove\ninteract\n\ndefine move\nif <key (w v) pressed?> then\n    change y by (10)\nend\nif <key (s v) pressed?> then\n    change y by (-10)\nend\nif <key (d v) pressed?> then\n    change x by (10)\nend\nif <key (a v) pressed?> then\n    change x by (-10)\nend\n\ndefine interact\nif <touching color (#bababa)?> then\n    if <key (e v) pressed?> then\n        broadcast (pull lever v)\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [learn mage hand v]\nshow\ngo to x: (0) y: (0)\n\n@receptor\n\nwhen flag clicked\ngo to x: (148) y: (138)\nhide\n\nwhen I receive [tick- player v]\nappear\n\ndefine appear\nif <(LEVEL) = [6]> then\n    show\nelse\n    hide\nend\n\n@receptor2\n\nwhen I receive [tick- player v]\nappear\n\ndefine appear\nif <(LEVEL) = [6]> then\n    show\nelse\n    hide\nend\n\nwhen flag clicked\ngo to x: (-98) y: (137)\nhide\n\n@receptor3\n\nwhen I receive [tick- player v]\nappear\n\ndefine appear\nif <(LEVEL) = [6]> then\n    show\nelse\n    hide\nend\n\nwhen flag clicked\ngo to x: (20) y: (138)\nhide\n\n@platform mm\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [tick- player v]\nlearn mage hand\n\ndefine learn mage hand\nif <(LEVEL) = [6]> then\n    show\nelse\n    hide\nend\n\nwhen [space v] key pressed\nif <touching (player v)?> then\n    if <(LEVEL) = [6]> then\n        add [Magic Missiles] to [spells known v]\n        broadcast (learn magic missiles v)\n    end\nend\n\n@magic missile\n\nwhen I receive [learn magic missiles v]\ngo to (player v)\nshow\nglide (1) secs to (receptor v)\nchange [receptor v] by (1)\nhide\n\nwhen flag clicked\nset [receptor v] to [0]\nhide\n\n@magic missile2\n\nwhen I receive [learn magic missiles v]\ngo to (player v)\nshow\nglide (1) secs to (receptor2 v)\nchange [receptor v] by (1)\nhide\n\nwhen flag clicked\nhide\n\n@magic missile3\n\nwhen I receive [learn magic missiles v]\ngo to (player v)\nshow\nglide (1) secs to (receptor3 v)\nchange [receptor v] by (1)\nhide\n\nwhen flag clicked\nhide\n\n@platform fire\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [tick- player v]\nlearn mage hand\n\ndefine learn mage hand\nif <(LEVEL) = [9]> then\n    show\nelse\n    hide\nend\n\nwhen [space v] key pressed\nif <touching (player v)?> then\n    if <(LEVEL) = [9]> then\n        add [Fireball] to [spells known v]\n        broadcast (learn fireball v)\n    end\nend\n\n@fireball\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [learn fireball v]\ngo to (player v)\nshow\nglide (1) secs to x: (45) y: (-17)\nbroadcast (burn v)\nnext costume\nwait (0.5) seconds\nhide\n\n@platform thunder\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [tick- player v]\nlearn mage hand\n\ndefine learn mage hand\nif <(LEVEL) = [11]> then\n    show\nelse\n    hide\nend\n\nwhen [space v] key pressed\nif <touching (player v)?> then\n    if <(LEVEL) = [11]> then\n        add [Chain Lightning] to [spells known v]\n        broadcast (learn chain lightning v)\n        switch costume to (costume4 v)\n    end\nend\n\n@lightning\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [learn chain lightning v]\nshow\nwait (1) seconds\nhide\n\n@platform thunder2\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [tick- player v]\nlearn mage hand\n\ndefine learn mage hand\nif <(LEVEL) = [13]> then\n    show\nelse\n    hide\nend\n\nwhen [space v] key pressed\nif <touching (player v)?> then\n    if <(LEVEL) = [13]> then\n        add [Cone of Cold] to [spells known v]\n        broadcast (learn cone of cold v)\n    end\nend\n\n@cone\n\nwhen flag clicked\nhide\n\nwhen I receive [learn cone of cold v]\nshow\nwait (1) seconds\nhide\n\n@tb\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\n