Turtle - A platformer #games

Instructions: Arrow keys or mobile to play

@Stage\n\nwhen flag clicked\nforever\n    play sound [Nebula v] until done\nend\n\n@platform\n\nwhen flag clicked\nforever\n    switch costume to (join [costume] (level))\nend\n\n@Enemy\n\nwhen I receive [next level v]\nhide\nif  then\n    delete this clone\nend\nspawn emeny at [144] [10] level [2] dir [-90]\nspawn emeny at [92] [10] level [2] dir [90]\nspawn emeny at [97] [122] level [3] dir [90]\nspawn emeny at [-114] [-43] level [5] dir [90]\nspawn emeny at [0] [-101] level [6] dir [90]\nspawn emeny at [69] [-101] level [6] dir [-90]\nspawn emeny at [0] [-48] level [8] dir [-90]\n\ndefine spawn emeny at (x) (y) level (level) dir (dir)\nset rotation style [left-right v]\ngo to x: (x) y: (y)\npoint in direction (dir)\nif <(level) = (level)> then\n    create clone of (_myself_ v)\nelse\n    go to x: (0) y: (0)\n    delete this clone\nend\n\nwhen I start as a clone\nshow\nset rotation style [left-right v]\nset [yvel v] to [0]\nforever\n    set size to (75) %\n    change [yvel v] by (-1)\n    change y by (Yvel)\n    change y by (2)\n    if <touching (platform v)?> then\n        change y by ((Yvel) * (-1))\n        set [yvel v] to [0]\n    end\n    if <<touching (platform v)?> or <touching (_edge_ v)?>> then\n        turn right (180) degrees\n    end\n    change y by (-2)\n    if <touching (thumbnail v)?> then\n        delete this clone\n    end\n    move (5) steps\nend\n\nwhen flag clicked\nhide\n\n@player\n\nwhen flag clicked\ngo to [back v] layer\nset size to (70) %\nReset player\nset [level v] to [1]\nbroadcast (game loop v)\nforever\n    create clone of (_myself_ v)\n    change [xvel v] by ((<<<key (right arrow v) pressed?> or <<(mouse x) > ((x position) + (15))> and <mouse down?>>> or <key (d v) pressed?>> - <<<<(mouse x) < ((x position) + (-15))> and <mouse down?>> or <key (left arrow v) pressed?>> or <key (a v) pressed?>>) * (2))\n    if <<<<key (right arrow v) pressed?> or <<(mouse x) > ((x position) + (15))> and <mouse down?>>> or <key (d v) pressed?>> or <<<<(mouse x) < ((x position) + (-15))> and <mouse down?>> or <key (left arrow v) pressed?>> or <key (a v) pressed?>>> then\n        point in direction ((<<<key (right arrow v) pressed?> or <<(mouse x) > ((x position) + (15))> and <mouse down?>>> or <key (d v) pressed?>> - <<<<(mouse x) < ((x position) + (-15))> and <mouse down?>> or <key (left arrow v) pressed?>> or <key (a v) pressed?>>) * (90))\n    end\n    set [xvel v] to ((Xvel) * (0.8))\n    change x by (Xvel)\n    if <<touching (platform v)?> or <touching (wall v)?>> then\n        change y by (1)\n        if <<touching (platform v)?> or <touching (wall v)?>> then\n            change y by (1)\n            if <<touching (platform v)?> or <touching (wall v)?>> then\n                change y by (1)\n                if <<touching (platform v)?> or <touching (wall v)?>> then\n                    change y by (1)\n                    if <<touching (platform v)?> or <touching (wall v)?>> then\n                        change y by (1)\n                        if <<touching (platform v)?> or <touching (wall v)?>> then\n                            change x by ((Xvel) * (-1))\n                            change y by (-5)\n                            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(mouse y) > ((y position) + (20))> and <mouse down?>>> then\n                                start sound [Zoop v]\n                                if <(Xvel) > [0]> then\n                                    set [xvel v] to [-13]\n                                else\n                                    set [xvel v] to [13]\n                                end\n                                set [yvel v] to [10]\n                            else\n                                set [xvel v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yvel v] by (-1)\n    change y by (Yvel)\n    if <<touching (platform v)?> or <touching (wall v)?>> then\n        change y by ((Yvel) * (-1))\n        set [yvel v] to [0]\n    end\n    change y by (-1)\n    if <<touching (platform v)?> or <touching (wall v)?>> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(mouse y) > ((y position) + (20))> and <mouse down?>>> then\n            set [yvel v] to [13]\n        end\n    end\n    if <(y position) < [-175]> then\n        Reset player\n        start sound [Crunch v]\n    end\n    if <(x position) > [235]> then\n        broadcast (next level v)\n        change [level v] by (1)\n        change x by (-470)\n    end\n    if <<touching (spikes v)?> or <<touching (boss v)?> or <touching (enemy v)?>>> then\n        Reset player\n        start sound [Crunch v]\n    end\n    if <touching (treasure v)?> then\n        repeat (2)\n            set [treasure v] to [1]\n        end\n        stop [all v]\n    end\n    change y by (1)\nend\n\ndefine Reset player\ngo to x: (-180) y: (0)\npoint in direction (90)\nset rotation style [left-right v]\nset [xvel v] to [0]\nset [yvel v] to [0]\n\nwhen I start as a clone\nrepeat (5)\n    change [ghost v] effect by (20)\n    change size by (-4)\nend\ndelete this clone\n\n@text\n\nwhen flag clicked\nforever\n    switch costume to ( v)\n    switch costume to (join [Level] (level))\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    set [e v] to ((timer) + (.1))\n    go to [front v] layer\nend\n\nwhen [timer v] > (e)\nshow\n\nwhen flag clicked\nhide\n\n