First - A Platformer
@Stage\n\n@Ball\n\ndefine Movement\nchange [yv v] by (-1)\nif <key (left arrow v) pressed?> then\n    change [xv v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (1)\nend\npoint in direction (90)\nset [xv v] to ((Xv) * (0.9))\nchange x by (Xv)\nif <touching (level v)?> then\n    change y by (1)\nend\nif <touching (level v)?> then\n    change y by (1)\nend\nif <touching (level v)?> then\n    change y by (1)\nend\nif <touching (level v)?> then\n    change y by (1)\nend\nif <touching (level v)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    set [xv v] to [0]\nend\nchange y by (Yv)\nif <touching (level v)?> then\n    change y by ((Yv) - ((Yv) * (2)))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> and <touching (level v)?>> then\n    set [yv v] to [12]\nend\nchange y by (1)\nif <touching (spikes v)?> then\n    if <(Invulnerabllity) < [1]> then\n        change [playerhp v] by (-1)\n        set [invulnerabllity v] to [30]\n    end\nend\nchange [invulnerabllity v] by (-1)\nif <<(PlayerHP) < [1]> and <(Level) = [8]>> then\n    broadcast (Delee v)\n    Restart\n    set [playerhp v] to [3]\nend\nif <touching (dangers v)?> then\n    Restart\nend\n\ndefine Restart\nset [xv v] to [0]\nset [yv v] to [0]\ngo to x: (-200) y: (-140)\nset size to (100) %\n\nwhen flag clicked\nhide\nif <(username) = [-Entity_]> then\n    set drag mode [draggable v]\nelse\n    set drag mode [not draggable v]\nend\n\nwhen I receive [start v]\nRestart\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nRestart\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nclear graphic effects\nforever\n    Movement\nend\n\nwhen I receive [next level v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nRestart\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nclear graphic effects\n\nchange [ghost v] effect by (10)\n\nwhen I start as a clone\nrepeat (20)\n    change size by (-5)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [prepare game v]\nshow\nforever\n    wait (0.1) seconds\n    create clone of (_myself_ v)\nend\n\n@Level\n\nwhen flag clicked\nhide\ngo to [front v] layer\n\nwhen I receive [next level v]\nbroadcast (Transition v)\nwait (0.25) seconds\nswitch costume to (join [Level] (Level))\n\nwhen I receive [prepare game v]\ngo to x: (0) y: (0)\nswitch costume to (level1 v)\nshow\n\n@EndPoint\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nswitch costume to (cl v)\nchange x by (pick random (-100) to (100))\nchange y by (pick random (-100) to (100))\nrepeat until <(distance to [endpoint v]) < [3]>\n    set [ghost v] effect to (distance to [endpoint v])\n    point towards (endpoint v)\n    move (((100) - (distance to [endpoint v])) / (10)) steps\nend\ndelete this clone\n\nwhen I receive [next level v]\ngo to x: (item (((Level) * (2)) - (1)) of [levelend v]) y: (item ((Level) * (2)) of [levelend v])\nif <(Level) = [8]> then\n    hide\n    broadcast (Boss Fight v)\nend\nif <(Level) = [9]> then\n    hide\nend\n\ndefine Set\ndelete all of [levelend v]\nadd [0] to [levelend v]\nadd [-100] to [levelend v]\nadd [200] to [levelend v]\nadd [-100] to [levelend v]\nadd [200] to [levelend v]\nadd [-100] to [levelend v]\nadd [200] to [levelend v]\nadd [-100] to [levelend v]\nadd [200] to [levelend v]\nadd [-142] to [levelend v]\nadd [200] to [levelend v]\nadd [-142] to [levelend v]\nadd [200] to [levelend v]\nadd [-142] to [levelend v]\nadd [200] to [levelend v]\nadd [-142] to [levelend v]\n\nwhen I receive [prepare game v]\nshow\nSet\nset [level v] to [1]\nswitch costume to (end v)\ngo to x: (item (((Level) * (2)) - (1)) of [levelend v]) y: (item ((Level) * (2)) of [levelend v])\nbroadcast (Start v)\nforever\n    create clone of (_myself_ v)\n    if <touching (ball v)?> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        change [level v] by (1)\n        broadcast (Next Level v) and wait\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        clear graphic effects\n    end\nend\n\nwhen I receive [boss fight v]\nset [bossalive? v] to [1]\nbroadcast (Boss Instructions v) and wait\nrepeat until <(BossAlive?) = [0]>\n    broadcast (Play Boss Fight v) and wait\nend\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nclear graphic effects\n\n@Transition\n\nwhen flag clicked\nhide\n\nwhen I receive [transition v]\ngo to x: (0) y: (0)\nshow\nset size to (0) %\nrepeat (10)\n    change size by (10)\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nclear graphic effects\nhide\n\n@Dangers\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nwait (0.25) seconds\nswitch costume to (join [Level] (Level))\n\nwhen I receive [prepare game v]\ngo to x: (0) y: (0)\nswitch costume to (level1 v)\nshow\n\n@Text\n\ndefine Type (t) at (x) (y) size (s) <stamp?>\nhide\nGet Word Lengths (t) (s)\ngo to x: (x) y: (y)\nset [talk_i v] to [0]\nrepeat (length of (t))\n    change [talk_i v] by (1)\n    if <(letter (Talk_i) of (t)) = [ ]> then\n        delete (1) of [words v]\n        change x by (((s) * (8.5)) - (4))\n        if <((x position) + (item (1) of [words v])) > [235]> then\n            set x to (x)\n            change y by ((-15) * (s))\n        end\n    else\n        set [return v] to (letter (Talk_i) of (t))\n        Make letters Lowercase (letter (Talk_i) of (t))\n        switch costume to (  v)\n        set size to (((s) * (100)) + (0)) %\n        switch costume to (return)\n        if <stamp?> then\n            stamp\n        else\n            create clone of (_myself_ v)\n        end\n        if <<(letter (Talk_i) of (t)) = [m]> or <(letter (Talk_i) of (t)) = [w]>> then\n            change x by ((s) * (((8.5) / (2)) * (3)))\n        else\n            change x by (((s) * (8.5)) - (<(return) = [ ]> * (4)))\n        end\n    end\nend\n\ndefine Make letters Lowercase (number or text)\nif < [ABCDEFGHIJKLMNOPQRSTUVWXYZ] contains (number or text)?> then\n    set [return v] to [0]\n    repeat until <(letter (return) of [abcdefghijklmnopqrstuvwxyz]) = (number or text)>\n        change [return v] by (1)\n    end\n    set [return v] to (letter (return) of [abcdefghijklmnopqrstuvwxyz])\nend\n\nwhen I start as a clone\ngo to [front v] layer\nclear graphic effects\nset [ghost v] effect to (100)\nchange y by (-10)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\n    change y by (1)\nend\n\nwhen I receive [delete v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nrepeat (10)\n    delete this clone\nend\n\ndefine Fast Type (t) at (x) (y) with (size) <stamp?>\nType (t) at (x) (y) size (size) <stamp?>\n\ndefine Get Word Lengths (t) (s)\ndelete all of [words v]\nset [talk_i v] to [0]\nset [return v] to [0]\nrepeat (length of (t))\n    change [talk_i v] by (1)\n    if <(letter (Talk_i) of (t)) = [ ]> then\n        add (return) to [words v]\n        set [return v] to [0]\n    else\n        change [return v] by ((s) * (8.5))\n    end\nend\n\nwhen flag clicked\nhide\nbroadcast (DELETE v) and wait\nType [I found a door.] at [-200] [0] size [3] <>\nwait (3) seconds\nbroadcast (DELETE v) and wait\nType [Where does it lead to?] at [-200] [0] size [3] <>\nwait (3) seconds\nbroadcast (DELETE v) and wait\nbroadcast (Prepare Game v)\n\nwhen I receive [boss instructions v]\nset [color v] effect to (250)\nType [Boss Fight - Dodge his attacks and touch him when he turns blue to damage the boss!] at [-200] [50] size [2] <>\nwait (5) seconds\nbroadcast (DELETE v) and wait\n\n@Spikes\n\nwhen flag clicked\nhide\nset [cl_id v] to [0]\n\nwhen I start as a clone\nset size to (100) %\nif <(cl_id) = [1]> then\n    switch costume to (ball v)\n    set [ghost v] effect to (100)\n    show\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    repeat (30)\n        turn right (10) degrees\n    end\n    point towards (ball v)\n    set [xv v] to ([sin v] of (direction) )\n    set [yv v] to ([cos v] of (direction) )\n    repeat until <touching (_edge_ v)?>\n        change x by ((Xv) * (5))\n        change y by ((Yv) * (5))\n        turn right (10) degrees\n    end\nelse\n    if <(cl_id) = [2]> then\n        go to (random position v)\n        set y to (160)\n        switch costume to (spikes v)\n        set [ghost v] effect to (100)\n        show\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        point towards (ball v)\n        set [xv v] to ([sin v] of (direction) )\n        set [yv v] to ([cos v] of (direction) )\n        repeat until <touching (_edge_ v)?>\n            change x by ((Xv) * (20))\n            change y by ((Yv) * (20))\n        end\n    else\n        if <(cl_id) = [3]> then\n            go to (random position v)\n            set y to (160)\n            switch costume to (magic v)\n            set [ghost v] effect to (100)\n            show\n            repeat (10)\n                change [ghost v] effect by (-10)\n            end\n            repeat (3)\n                point towards (ball v)\n                set [xv v] to ([sin v] of (direction) )\n                set [yv v] to ([cos v] of (direction) )\n                repeat (10)\n                    change x by ((Xv) * (2))\n                    change y by ((Yv) * (2))\n                end\n            end\n            set [cl_id v] to [4]\n            repeat (pick random (2) to (5))\n                create clone of (_myself_ v)\n            end\n        else\n            if <(cl_id) = [4]> then\n                set size to (75) %\n                switch costume to (spikes v)\n                show\n                set [ghost v] effect to (100)\n                repeat (10)\n                    change [ghost v] effect by (-10)\n                end\n                point in direction (pick random (-180) to (180))\n                repeat (3)\n                    repeat until <touching (_edge_ v)?>\n                        move (10) steps\n                    end\n                    if on edge, bounce\n                end\n            end\n        end\n    end\nend\ndelete this clone\n\nwhen I receive [1 v]\nif <(cl_id) = [0]> then\n    go to x: (-100) y: (130)\n    repeat (5)\n        set [cl_id v] to [1]\n        create clone of (_myself_ v)\n        change x by (50)\n        set [cl_id v] to [0]\n    end\n    set [cl_id v] to [0]\nend\n\nwhen I receive [2 v]\nif <(cl_id) = [0]> then\n    repeat (pick random (10) to (15))\n        set [cl_id v] to [2]\n        create clone of (_myself_ v)\n        set [cl_id v] to [0]\n        wait (pick random (0) to (0.8)) seconds\n    end\n    set [cl_id v] to [0]\nend\n\nwhen I receive [3 v]\nif <(cl_id) = [0]> then\n    repeat (3)\n        set [cl_id v] to [3]\n        create clone of (_myself_ v)\n        set [cl_id v] to [0]\n        wait (pick random (0) to (0.8)) seconds\n    end\n    set [cl_id v] to [0]\nend\n\nwhen I receive [boss instructions v]\nrepeat (10)\n    delete this clone\nend\nset [cl_id v] to [0]\n\nwhen I receive [next level v]\nrepeat (10)\n    delete this clone\nend\nset [cl_id v] to [0]\n\nwhen I receive [delee v]\ndelete this clone\n\n@Boss\n\nwhen flag clicked\nhide\n\nwhen I receive [boss instructions v]\ngo to x: (0) y: (-50)\nhide\nrepeat (10)\n    delete this clone\nend\n\nwhen I receive [play boss fight v]\ngo to x: (0) y: (-50)\nrepeat (10)\n    delete this clone\nend\nset [playerhp v] to [3]\nset [ghost v] effect to (100)\nset size to (300) %\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nclear graphic effects\ncreate clone of (_myself_ v)\nswitch costume to (costume1 v)\nset [invulnerabllity v] to [0]\nset [bossalive? v] to [3]\nbroadcast (Boss v)\nwait until <<(BossAlive?) = [0]> or <(PlayerHP) = [0]>>\nbroadcast (Delee v) and wait\nstop [other scripts in sprite v]\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nset size to (300) %\ngo to x: (0) y: (-50)\nswitch costume to (costume2 v)\nforever\n    turn right (10) degrees\n    if <(BossAlive?) = [0]> then\n        delete this clone\n    end\nend\n\ndefine Attack random\nbroadcast (pick random (1) to (3))\n\nwhen I receive [boss v]\nforever\n    repeat (10)\n        wait (pick random (1) to (3)) seconds\n        Attack random\n    end\n    switch costume to (costume3 v)\n    repeat (30)\n        if <touching (ball v)?> then\n            change [bossalive? v] by (-1)\n            repeat (10)\n                change [ghost v] effect by (-10)\n                wait (0.1) seconds\n                change [ghost v] effect by (10)\n            end\n            clear graphic effects\n            broadcast (Delee v) and wait\n        end\n    end\n    switch costume to (costume1 v)\nend\n\n@Health\n\nwhen flag clicked\nhide\nforever\n    go to x: (-180) y: (130)\n    switch costume to (PlayerHP)\n    if <(PlayerHP) = [0]> then\n        broadcast (Delee v) and wait\n    end\nend\n\nwhen I receive [play boss fight v]\nshow\n\nwhen I receive [boss instructions v]\nhide\n\nwhen I receive [next level v]\nhide\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n