The Knight | Amateur | Mobile Friendly Platformer |


@Stage\n\nwhen flag clicked\nbroadcast (game v)\nforever\n    play sound [Open Secrets v] until done\nend\n\n@player\n\nwhen I receive [game v]\nforever\n    if <<[240] < (x position)> and <(dead?) = [0]>> then\n        broadcast (NAXT LEVEL v)\n        change [lv v] by (1)\n        reset\n    end\nend\n\nwhen flag clicked\nhide variable [xv v]\nhide variable [dead? v]\nhide variable [lv v]\nhide variable [yv v]\nhide\n\nwhen I receive [game v]\nset [dead? v] to [0]\nset [lv v] to [1]\nset size to (20) %\nreset\nforever\n    go to [front v] layer\n    if <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> and <(dead?) = [0]>> then\n        switch costume to (1 v)\n        change [xv v] by (1)\n    end\n    if <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> and <(dead?) = [0]>> then\n        switch costume to (2 v)\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (.9))\n    change x by (Xv)\n    if <touching (ground v)?> then\n        change y by (2)\n        if <touching (ground v)?> then\n            change y by (2)\n        end\n        if <touching (ground v)?> then\n            change y by (2)\n            if <touching (ground v)?> then\n                change y by (2)\n                if <touching (ground v)?> then\n                    change y by (2)\n                    if <touching (ground v)?> then\n                        change x by ((Xv) * (-2))\n                        change y by (-5)\n                        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>>> then\n                            if <(Xv) > [0]> then\n                                set [xv v] to [-5]\n                            else\n                                set [xv v] to [5]\n                            end\n                            set [yv v] to [13]\n                        else\n                            set [xv v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-0.8)\n    change y by (Yv)\n    if <touching (ground v)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching (ground v)?> then\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > ((y position) + (10))>>>> then\n            set [yv v] to [12]\n        end\n    end\n    change y by (1)\n    if <<touching (spike v)?> or <touching (lava v)?>> then\n        Dead\n    end\n    if <(y position) < [-180]> then\n        Dead\n    end\n    if <touching (bouncy v)?> then\n        set [yv v] to [15]\n    end\nend\n\nwhen I receive [game v]\nset [lv v] to [1]\nforever\n    create clone of (_myself_ v)\nend\n\ndefine reset\nclear graphic effects\npoint in direction (90)\ngo to x: (-201) y: (30)\nswitch costume to (1 v)\nset [dead? v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nset size to (20) %\nshow\n\ndefine Dead\nset [dead? v] to [1]\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nreset\n\nwhen I start as a clone\nswitch costume to (3 v)\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (-1.5)\nend\ndelete this clone\n\n@ground\n\nwhen flag clicked\nhide\n\nwhen I receive [game v]\nshow\nforever\n    switch costume to (LV)\nend\n\n@shadow\n\nwhen flag clicked\nhide\n\nwhen I receive [game v]\nshow\nforever\n    set [ghost v] effect to (50)\n    switch costume to (LV)\n    go to [back v] layer\nend\n\n@text\n\nwhen flag clicked\nhide\n\nwhen I receive [game v]\nshow\nforever\n    switch costume to (LV)\nend\n\n@spike\n\nwhen flag clicked\nhide\n\nwhen I receive [game v]\nshow\nforever\n    go to [back v] layer\n    switch costume to (LV)\nend\n\n@lava\n\nwhen flag clicked\nhide\n\nwhen I receive [game v]\nshow\nforever\n    go to [back v] layer\n    switch costume to (LV)\nend\n\nwhen I receive [game v]\nshow\nforever\n    set y to (([cos v] of ((timer) * (150)) ) * (7))\nend\n\n@sword\n\nwhen flag clicked\nhide\n\nwhen I receive [game v]\nclear graphic effects\nset size to (70) %\nforever\n    set y to (([cos v] of ((timer) * (150)) ) * (7))\n    if <(LV) = [14]> then\n        show\n        if <touching (player v)?> then\n            play sound [Collect v] until done\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            hide\n            stop [this script v]\n        end\n    else\n        hide\n    end\nend\n\n@tb\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (100)\n    show\n    go to [front v] layer\nend\n\n