Tower || A Platformer
@Stage\n\n@Player\n\ndefine Run Engine\nchange [y v] by (-0.5)\nif <key (left arrow v) pressed?> then\n    change [x v] by (-0.9)\nend\nif <key (right arrow v) pressed?> then\n    change [x v] by (0.9)\nend\nset [x v] to ((x) * (0.9))\nchange x by (x)\nif <touching (levels v)?> then\n    change y by (1)\n    if <touching (levels v)?> then\n        change y by (1)\n        if <touching (levels v)?> then\n            change y by (1)\n            if <touching (levels v)?> then\n                change y by (1)\n                if <touching (levels v)?> then\n                    change y by (1)\n                    if <touching (levels v)?> then\n                        change y by (1)\n                        if <touching (levels v)?> then\n                            change y by (-6)\n                            change x by ((x) * (-1))\n                            if <key (up arrow v) pressed?> then\n                                set [y v] to [9]\n                                if <(x) > [0]> then\n                                    set [x v] to [-10]\n                                else\n                                    set [x v] to [10]\n                                end\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (y)\nif <touching (levels v)?> then\n    change y by ((y) * (-1))\n    set [y v] to [0]\nend\nchange y by (-0.5)\nif <<touching (levels v)?> and <key (up arrow v) pressed?>> then\n    set [y v] to [9]\nend\nchange y by (0.5)\nif <(y position) > [164]> then\n    go to x: (x position) y: (-115)\n    broadcast (Next Level v)\nend\n\nwhen flag clicked\nset [level v] to [1]\nset [health v] to [5]\nhide\n\ndefine Run block\nRun Engine\n\nwhen I receive [dead v]\nchange [health v] by (-1)\nrepeat (3)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\nset drag mode [not draggable v]\ngo to [back v] layer\ngo [forward v] (1) layers\nswitch backdrop to (tower v)\ngo to x: (0) y: (-80)\nset size to (100) %\nshow\nset [x v] to [0]\nset [y v] to [0]\nforever\n    Run block\nend\n\nwhen I receive [start v]\nforever\n    if <<touching (spikes v)?> or <touching (death wheels v)?>> then\n        broadcast (Dead v)\n        wait (3) seconds\n    end\nend\n\nwhen I receive [start v]\nset rotation style [don't rotate v]\nforever\n    if on edge, bounce\n    if <touching (go back line v)?> then\n        go to x: (x position) y: (163)\n        broadcast (Previous Level v)\n    end\nend\n\nwhen I receive [next level v]\nchange [level v] by (1)\n\nwhen I receive [previous level v]\nchange [level v] by (-1)\n\nwhen I receive [start v]\nswitch costume to (front v)\nforever\n    if <not <<key (left arrow v) pressed?> or <<key (right arrow v) pressed?> or <key (up arrow v) pressed?>>>> then\n        switch costume to (front v)\n    end\n    if <key (up arrow v) pressed?> then\n        switch costume to (up v)\n    end\n    if <key (right arrow v) pressed?> then\n        switch costume to (right v)\n    end\n    if <key (left arrow v) pressed?> then\n        switch costume to (left v)\n    end\n    if <<key (up arrow v) pressed?> and <key (right arrow v) pressed?>> then\n        switch costume to (up right v)\n    end\n    if <<key (up arrow v) pressed?> and <key (left arrow v) pressed?>> then\n        switch costume to (up left v)\n    end\nend\n\n@Levels\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [previous level v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\nswitch costume to (level1 v)\ngo to x: (0) y: (0)\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\n\n@Spikes\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nhide\n\nwhen I receive [previous level v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen I receive [start v]\nshow\ngo to [back v] layer\nswitch costume to (1 v)\ngo to x: (0) y: (0)\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\n\n@Death Wheels\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nhide\n\nwhen I receive [previous level v]\nswitch costume to ((costume [number v]) - (1))\n\nwhen I receive [start v]\nhide\nswitch costume to (death wheel v)\nforever\n    go to [back v] layer\n    turn left (5) degrees\n    if <(Level) = [1]> then\n        hide\n    end\n    if <(Level) = [2]> then\n        show\n        go to x: (-215) y: (55)\n    end\n    if <(Level) = [3]> then\n        show\n        go to x: (130) y: (60)\n    end\n    if <(Level) = [4]> then\n        hide\n    end\n    if <(Level) = [5]> then\n        hide\n    end\n    if <(Level) = [6]> then\n        show\n        go to x: (-180) y: (90)\n    end\n    if <(Level) = [7]> then\n        show\n        go to x: (-170) y: (110)\n    end\n    if <(Level) = [8]> then\n        hide\n    end\n    if <(Level) = [9]> then\n        show\n        go to x: (-210) y: (-110)\n    end\n    if <(Level) = [10]> then\n        hide\n    end\nend\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\n\ngo to [back v] layer\n\n@Go Back Line\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\ngo to x: (36) y: (28)\nset [ghost v] effect to (100)\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\n\n@Health\n\nwhen I receive [start v]\nshow\ngo to [front v] layer\nforever\n    switch costume to (Health)\n    if <(Health) < [1]> then\n        switch costume to (0 heatlth v)\n        broadcast (Game Over v)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\n\n@Game Over Screen\n\nwhen flag clicked\nset [ghost v] effect to (100)\nshow\n\nwhen I receive [game over v]\ngo to [front v] layer\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\n@Message\n\nwhen flag clicked\nset [ghost v] effect to (100)\nshow\n\nwhen I receive [game over v]\nwait (1) seconds\nrepeat (10)\n    go to [front v] layer\n    change [ghost v] effect by (-10)\nend\n\n@Logo\n\nwhen I receive [start v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (0) y: (30)\npoint in direction (90)\nset [ghost v] effect to (0)\nset size to (0) %\nrepeat (20)\n    change [ghost v] effect by (-5)\n    turn right (18) degrees\n    change size by (7)\nend\nwait (2) seconds\nbroadcast (Start v)\n\n@Screen\n\nwhen I receive [start v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\n\n@Name\n\nwhen flag clicked\nshow\nclear graphic effects\ngo to x: (-240) y: (-100)\nset size to (200) %\npoint in direction (90)\nreset timer\nrepeat (40)\n    move ((timer) * (9)) steps\nend\n\nwhen I receive [start v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n@TN\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n
-----------------WELCOME TO TOWER-----------------\n\nYou are progressing up a tower and have 5 lives to survive with 3 seconds of invincibilty after you lose a life.\n\nArrow keys to move;\nDodge the dangers;\nHave fun!!!!!