Dungeons || A Platformer
@Stage\n\n@Player\n\ndefine Reset Level\nswitch costume to (player v)\nclear graphic effects\ngo to x: (-200) y: (0)\nset [xv v] to [0]\nset [yv v] to [0]\nset size to (300) %\ngo to [front v] layer\nshow\n\ndefine Die\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\nReset Level\n\nwhen flag clicked\npoint in direction (90)\nset [level v] to [1]\nReset Level\nforever\n    change [yv v] by (-1)\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [xv v] by (.8)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [xv v] by (-.8)\n    end\n    set [xv v] to ((xv) * (.9))\n    change x by (xv)\n    if <touching color (#aaaaaa)?> then\n        change y by (1)\n    end\n    if <touching color (#aaaaaa)?> then\n        change y by (1)\n    end\n    if <touching color (#aaaaaa)?> then\n        change y by (1)\n    end\n    if <touching color (#aaaaaa)?> then\n        change y by (1)\n    end\n    if <touching color (#aaaaaa)?> then\n        change y by (-4)\n        change x by ((xv) * (-1))\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n            set [yv v] to [13]\n            if <(xv) > [0]> then\n                set [xv v] to [-5]\n            else\n                set [xv v] to [5]\n            end\n        else\n            set [xv v] to [0]\n        end\n    end\n    change y by (yv)\n    if <touching color (#aaaaaa)?> then\n        change y by ((yv) - ((yv) * (2)))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#aaaaaa)?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n            set [yv v] to [12]\n        end\n    end\n    change y by (1)\n    if <<<(y position) < [-211]> or <touching (spikes v)?>> or <touching color (#a32323)?>> then\n        Die\n    end\nend\n\nwhen flag clicked\nforever\n    if <(x position) > [238]> then\n        Reset Level\n        change [level v] by (1)\n    end\nend\n\n@Ground\n\nwhen flag clicked\nswitch costume to (ground1 v)\ngo to x: (0) y: (0)\nshow\nforever\n    switch costume to (Level)\nend\n\n@Spikes\n\nwhen flag clicked\nswitch costume to (spikes1 v)\ngo to [front v] layer\ngo to x: (0) y: (0)\nshow\nforever\n    switch costume to (Level)\nend\n\n@TN\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n
Controls:\nArrows, WASD or click the screen.\n\nThe background is actually part of the ground so I had to make the player do (if touching colour {colour}) in the script.