Platformer
@Stage\n\nwhen flag clicked\nset [color v] effect to (0)\nforever\n    if <(Level) = [3]> then\n        set [color v] effect to (70)\n    end\nend\n\nwhen I receive [win! v]\nset [color v] effect to (0)\n\n@hitbox\n\nwhen flag clicked\nset [death v] to [0]\nshow\nset size to (50) %\nset [spawnx v] to [-194]\nset [spawny v] to [41]\ngo to x: (Spawnx) y: (Spawny)\nset rotation style [left-right v]\nforever\n    broadcast (Follow Hitbox v)\n    Move [12] [-1]\n    Moving [10] [0.6]\n    Checknextlevel\nend\n\ndefine Move (jump) (fall)\nchange y by (YV)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (YV) ) )\n        if <touching (level v)?> then\n            change y by (((YV) / ([abs v] of (YV) )) * (-1))\n        end\n    end\n    if <<not <(YV) > [0]>> and <key (up arrow v) pressed?>> then\n        set [yv v] to (jump)\n    else\n        set [yv v] to [0]\n    end\nelse\n    change [yv v] by (fall)\nend\n\ndefine Moving (speed) (drag)\ngo to [front v] layer\nchange x by (XV)\nset [ghost v] effect to (100)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (XV) ) )\n        if <touching (level v)?> then\n            change x by (((XV) / ([abs v] of (XV) )) * (-1))\n        end\n    end\n    set [xv v] to [0]\nend\nif <key (right arrow v) pressed?> then\n    set [xv v] to (speed)\nelse\n    if <key (left arrow v) pressed?> then\n        set [xv v] to ((speed) * (-1))\n    end\nend\nset [xv v] to ((XV) * (drag))\n\ndefine Checknextlevel\nif <(x position) > [230]> then\n    broadcast (Next Level v)\n    go to x: (Spawnx) y: (Spawny)\nend\n\nwhen I receive [game over v]\ngo to x: (Spawnx) y: (Spawny)\npoint in direction (90)\nwait (0.4) seconds\nchange [death v] by (1)\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [level v] to [1]\nswitch costume to (costume1 v)\nwait (10) seconds\ngo to x: (0) y: (0)\n\nwhen I receive [next level v]\nchange [level v] by (1)\nnext costume\n\nwhen flag clicked\nforever\n    if <(Level) = [10]> then\n        broadcast (WIN! v)\n        wait (30) seconds\n        stop [other scripts in sprite v]\n        stop [all v]\n    end\nend\n\n@Person 1\n\nwhen flag clicked\nswitch costume to (costume1 v)\nwait (1) seconds\nswitch costume to (costume2 v)\nwait (2) seconds\nswitch costume to (costume3 v)\nwait (4) seconds\nbroadcast (Play Start! v)\nswitch costume to (run! v)\nset size to (50) %\n\nwhen I receive [follow hitbox v]\ngo to (hitbox v)\ngo to [front v] layer\n\nwhen flag clicked\nwait (10) seconds\nswitch costume to (run!2 v)\nset rotation style [left-right v]\npoint in direction (90)\nforever\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        switch costume to (run! v)\n        wait (0.4) seconds\n        switch costume to (run!2 v)\n        wait (0.4) seconds\n        switch costume to (run!3 v)\n        wait (0.4) seconds\n        switch costume to (run!4 v)\n    else\n        if <key (left arrow v) pressed?> then\n            point in direction (-90)\n            switch costume to (run! v)\n            wait (0.4) seconds\n            switch costume to (run!2 v)\n            wait (0.4) seconds\n            switch costume to (run!3 v)\n            wait (0.4) seconds\n            switch costume to (run!4 v)\n        else\n            switch costume to (run! v)\n        end\n    end\n    wait (0.04) seconds\nend\n\nwhen I receive [follow hitbox v]\nforever\n    if <touching color (#ff6262)?> then\n        broadcast (GAME OVER v)\n    end\nend\n\nwhen I receive [win! v]\nswitch costume to (win! v)\nstop [other scripts in sprite v]\n\n@Win\n\nwhen I receive [win! v]\ngo to x: (0) y: (0)\nshow\nforever\n    go to [front v] layer\n    change [color v] effect by (10)\nend\n\nwhen flag clicked\nhide\n\n