Pixel Land || a platformer (mobile friendly) (games)
@Stage\n\nwhen I receive [win v]\nrepeat (25)\n    change [brightness v] effect by (4)\nend\n\n@map\n\ndefine platform\nchange y by (y SPEED)\nif <touching (player2 v)?> then\n    repeat ([abs v] of (y SPEED) )\n        if <touching (player2 v)?> then\n            change y by ((-1) * (([abs v] of (y SPEED) ) / (y SPEED)))\n        end\n    end\n    if <<key (up arrow v) pressed?> and <not <(y SPEED) < [0]>>> then\n        set [y speed v] to [-17]\n    else\n        set [y speed v] to [0]\n    end\nelse\n    change [y speed v] by (1)\nend\nif <key (right arrow v) pressed?> then\n    change [x speed v] by (-1)\nend\nif <key (left arrow v) pressed?> then\n    change [x speed v] by (1)\nend\nchange x by (x SPEED)\nif <touching (player2 v)?> then\n    set [oldy v] to (y position)\n    repeat ([abs v] of ((x SPEED) + (-1)) )\n        if <touching (player2 v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (player2 v)?> then\n        set y to (oldy)\n        repeat ([ceiling v] of ([abs v] of (x SPEED) ) )\n            if <touching (player2 v)?> then\n                change x by ((-1) * (([abs v] of (x SPEED) ) / (x SPEED)))\n            end\n        end\n        set [x speed v] to [0]\n    end\nend\nset [x speed v] to ((x SPEED) * (0.9))\n\nwhen I receive [play v]\nset [y speed v] to [0]\ngo to x: (14) y: (-33)\nforever\n    platform\nend\n\nwhen I receive [play v]\nforever\n    set [x of map v] to (x position)\n    set [y of map v] to (y position)\nend\n\nwhen I receive [play v]\nshow\nset [dead? v] to [0]\nforever\n    if <(y position) > [80]> then\n        set [dead? v] to [1]\n        broadcast (dead v)\n        wait (0) seconds\n        repeat (80)\n            set [x speed v] to [0]\n            set [y speed v] to [0]\n        end\n        broadcast (play v) and wait\n    end\nend\n\nwhen I receive [play v]\nforever\n    set [1 v] to [0]\n    set [2 v] to [0]\n    if <<(y position) > [-560]> and <[-380] > (y position)>> then\n        wait (0) seconds\n        set [1 v] to [1]\n        if <<(x position) > [-1276]> and <[-585] > (x position)>> then\n            set [2 v] to [1]\n        end\n        if <<(1) = [1]> and <(2) = [1]>> then\n            set [dead? v] to [1]\n            broadcast (dead v)\n            wait (0) seconds\n            repeat (80)\n                set [x speed v] to [0]\n                set [y speed v] to [0]\n            end\n            broadcast (play v) and wait\n        end\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <<(x position) > [166]> and <(y position) > [-700]>> then\n        set [dead? v] to [1]\n        broadcast (dead v)\n        wait (0) seconds\n        repeat (80)\n            set [x speed v] to [0]\n            set [y speed v] to [0]\n        end\n        broadcast (play v) and wait\n    end\nend\n\nwhen I receive [escape v]\nforever\n    play sound [bensound-memories v] until done\nend\n\nwhen I receive [play v]\nforever\n    set [3 v] to [0]\n    set [4 v] to [0]\n    if <<(y position) = [-1060]> or <(y position) = [-1059]>> then\n        wait (0) seconds\n        set [3 v] to [1]\n        if <<(x position) > [-1069]> and <[-868] > (x position)>> then\n            set [4 v] to [1]\n        end\n        if <<(3) = [1]> and <(4) = [1]>> then\n            set [dead? v] to [1]\n            broadcast (dead v)\n            wait (0) seconds\n            repeat (80)\n                set [x speed v] to [0]\n                set [y speed v] to [0]\n            end\n            broadcast (play v) and wait\n        end\n    end\nend\n\nwhen I receive [play v]\nforever\n    if <<[-1221] > (x position)> and <[-1685] > (y position)>> then\n        broadcast (win v) and wait\n    end\nend\n\nwhen flag clicked\nset [brightness v] effect to (0)\n\nwhen I receive [win v]\nrepeat (25)\n    change [brightness v] effect by (4)\nend\n\n@player2\n\nwhen I receive [dead v]\nhide\n\nwhen I receive [play v]\nshow\nforever\n    if <(x SPEED) > [1]> then\n        wait (((4) - (x SPEED)) * (0.1)) seconds\n        next costume\n    else\n        if <[-1] > (x SPEED)> then\n            wait (((4) + (x SPEED)) * (0.1)) seconds\n            next costume\n        else\n            switch costume to (stay v)\n        end\n    end\nend\n\nwhen I receive [play v]\npoint in direction (90)\nforever\n    if <(x SPEED) > [0]> then\n        point in direction (-90)\n    else\n        if <(x SPEED) < [0]> then\n            point in direction (90)\n        end\n    end\nend\n\nwhen I receive [play v]\ngo to x: (0) y: (-20)\n\nwhen I receive [play v]\nforever\n    if <key (up arrow v) pressed?> then\n        set [in air ? v] to [1]\n    end\n    wait (0.1) seconds\n    wait until <touching (map v)?>\n    set [in air ? v] to [0]\nend\n\nwhen I receive [play v]\nforever\n    if <touching color (#ff7400)?> then\n        set [dead? v] to [1]\n    end\nend\n\nwhen flag clicked\nset [brightness v] effect to (0)\n\nwhen I receive [win v]\nrepeat (25)\n    change [brightness v] effect by (4)\nend\n\n@Sprite1\n\nwhen flag clicked\ngo to [back v] layer\n\nwhen flag clicked\nforever\n    go to x: (X OF MAP) y: (Y OF MAP)\nend\n\nwhen flag clicked\nset [brightness v] effect to (0)\n\nwhen I receive [win v]\nrepeat (25)\n    change [brightness v] effect by (4)\nend\n\n@player3\n\nwhen I receive [dead v]\nshow\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\nend\n\nwhen I receive [play v]\nhide\ngo to x: (0) y: (-20)\nset [ghost v] effect to (0)\n\n@ground 1\n\nwhen flag clicked\nshow\ngo to x: (10) y: (-927)\nshow\ngo to [front v] layer\nwait (0) seconds\nglide (0.9) secs to x: (10) y: (-917)\nglide (0.6) secs to x: (10) y: (-907)\nglide (0.4) secs to x: (10) y: (-897)\nglide (0.4) secs to x: (10) y: (-880)\nglide (0.5) secs to x: (10) y: (-850)\nglide (0.5) secs to x: (10) y: (-810)\nglide (0.9) secs to x: (10) y: (-700)\nglide (1.7) secs to x: (10) y: (-450)\nglide (1.5) secs to x: (10) y: (-200)\nglide (5) secs to x: (10) y: (800)\nglide (0.5) secs to x: (10) y: (850)\nglide (1) secs to x: (10) y: (900)\nglide (1.1) secs to x: (10) y: (930)\nbroadcast (escape v) and wait\n\nwhen I receive [play v]\nhide\n\n@escape\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\nwhen I receive [escape v]\nwait (1) seconds\nshow\ngo to [front v] layer\nset [ghost v] effect to (80)\nwait (0.2) seconds\nset [ghost v] effect to (55)\nwait (0.2) seconds\nset [ghost v] effect to (80)\nwait (0.1) seconds\nset [ghost v] effect to (40)\nwait (0.1) seconds\nset [ghost v] effect to (70)\nwait (0.1) seconds\nset [ghost v] effect to (50)\nwait (0.1) seconds\nset [ghost v] effect to (40)\nwait (0.1) seconds\nrepeat (20)\n    change [ghost v] effect by (-1)\nend\nrepeat (30)\n    change [ghost v] effect by (-1.5)\nend\nbroadcast (start v)\n\nwhen I receive [play v]\nhide\n\n@start\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (45) %\n    else\n        set size to (40) %\n    end\nend\n\nwhen this sprite clicked\nhide\nbroadcast (play v) and wait\n\nwhen I receive [start v]\ngo to [front v] layer\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\n@final ending\n\nwhen I receive [win v]\nwait (3) seconds\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nbroadcast (escaped v)\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\nset [brightness v] effect to (5)\nwait (1) seconds\ngo to [front v] layer\n\n@Sprite2\n\nwhen I receive [play v]\nset [time v] to [0]\nforever\n    wait (0.05) seconds\n    change [time v] by (0.1)\nend\n\nwhen I receive [win v]\nwait (0.1) seconds\nstop [other scripts in sprite v]\n\nwhen flag clicked\nhide variable [time v]\n\nwhen I receive [start v]\nshow variable [time v]\n\n@picture escaped\n\nshow\ngo to [front v] layer\nshow variable [time v]\n\nwhen flag clicked\nhide\n\n