Super Random World | Random Platformer [1.04]
@Stage\n\nwhen flag clicked\nset volume to (100) %\nforever\n    play sound [Weekend_In_The_City.mp3 v] until done\nend\n\nwhen I receive [0% v]\nset volume to (0) %\n\nwhen I receive [100% v]\nset volume to (100) %\n\n@blocks\n\nwhen flag clicked\nerase all\nbuild-world\nbroadcast (begin v)\n\ndefine build-world\nset [height v] to (pick random (1) to (35))\ngo to x: (-240) y: (-170)\nswitch costume to (2 v)\nrepeat ((height) - (1))\n    stamp\n    change y by (10)\nend\nswitch costume to (1 v)\nstamp\nchange y by (10)\nset [start height v] to (y position)\nswitch costume to (3 v)\nrepeat ((36) - (height))\n    stamp\n    change y by (10)\nend\nrepeat (47)\n    change x by (10)\n    set y to (-170)\n    if <(round (hole?)) > [19]> then\n        repeat (36)\n            stamp\n            change y by (10)\n        end\n        if <(hole-length) > [8]> then\n            set [hole? v] to [0]\n        else\n            set [hole? v] to (pick random (18) to (25))\n        end\n        change [hole-length v] by (1)\n    else\n        change [height v] by (pick random (1.4) to (-1.4))\n        switch costume to (2 v)\n        repeat ((round (height)) - (1))\n            stamp\n            change y by (10)\n        end\n        switch costume to (1 v)\n        stamp\n        change y by (10)\n        switch costume to (3 v)\n        repeat ((36) - (round (height)))\n            stamp\n            change y by (10)\n        end\n        set [hole? v] to (pick random (1) to (20))\n        if <(round (hole?)) > [19]> then\n            set [hole-length v] to [0]\n        end\n    end\nend\n\nset size to (700) %\n\nset size to (100) %\n\nwhen I receive [build v]\nset [brightness v] effect to (25)\nshow\nforever\n    go to x: ((round ((mouse x) / (10))) * (10)) y: ((round ((mouse y) / (10))) * (10))\n    if <mouse down?> then\n        set [brightness v] effect to (0)\n        stamp\n    end\n    if <key (right arrow v) pressed?> then\n        next costume\n        wait until <not <key (right arrow v) pressed?>>\n    end\n    if <key (left arrow v) pressed?> then\n        switch costume to ((costume [number v]) - (1))\n        wait until <not <key (left arrow v) pressed?>>\n    end\nend\n\nwhen I receive [new v]\nerase all\nbuild-world\nbroadcast (begin v)\n\nwhen I receive [play v]\nhide\n\n@playa\n\nwhen I receive [begin v]\nset [movementx v] to [0]\nset [movementy v] to [0]\ngo to x: (-240) y: (180)\nshow\nforever\n    gametick\nend\n\nwhen flag clicked\nhide\n\ndefine gametick\nset [costume v] to (costume [number v])\nset [direction v] to (direction)\nif <<touching color (#663b00)?> or <<touching color (#814901)?> or <<touching color (#009933)?> or <touching color (#006622)?>>>> then\n    switch costume to (hitbox v)\n    set [movementy v] to [0]\n    change y by (1)\nelse\n    switch costume to (hitbox v)\n    change [movementy v] by (-0.25)\n    point in direction (0)\n    move (movementY) steps\n    if <<touching color (#663b00)?> or <<touching color (#814901)?> or <<touching color (#009933)?> or <touching color (#006622)?>>>> then\n        repeat until <not <<touching color (#663b00)?> or <<touching color (#814901)?> or <<touching color (#009933)?> or <touching color (#006622)?>>>>>\n            change y by (1)\n            set [movementy v] to [0]\n            if <key (w v) pressed?> then\n                change [movementy v] by (4)\n            end\n        end\n    end\nend\nmovement\nif <(x position) > [236]> then\n    set [movementx v] to [0]\n    set [movementy v] to [0]\n    go to x: (-240) y: (180)\n    broadcast (new v)\n    show\nend\nif <(y position) < [-178]> then\n    set [movementx v] to [0]\n    set [movementy v] to [0]\n    go to x: (-240) y: (180)\n    show\nend\n\ndefine movement\npoint in direction (direction)\nif <not <<<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> or <<key (a v) pressed?> or <key (d v) pressed?>>>> then\n    set [movementx v] to ((movementX) / (3))\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    point in direction (-90)\n    if <not <(movementX) > [4]>> then\n        change [movementx v] by (0.25)\n    end\nend\nif <<key (left arrow v) pressed?> or <key (d v) pressed?>> then\n    point in direction (90)\n    if <not <(movementX) > [4]>> then\n        change [movementx v] by (0.25)\n    end\nend\nmove (movementX) steps\nswitch costume to (hitbox-side v)\nif <<touching color (#663b00)?> or <<touching color (#814901)?> or <<touching color (#009933)?> or <touching color (#006622)?>>>> then\n    repeat until <not <<touching color (#663b00)?> or <<touching color (#814901)?> or <<touching color (#009933)?> or <touching color (#006622)?>>>>>\n        move (-1) steps\n    end\nend\nswitch costume to (costume)\n\n@Build\n\nwhen flag clicked\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <(costume [number v]) = [2]> then\n            switch costume to (costume1 v)\n            broadcast (build v)\n        else\n            next costume\n            broadcast (play v)\n        end\n        wait until <not <mouse down?>>\n    end\nend\n\ngo to x: (0) y: (0)\n\nwhen I start as a clone\nswitch costume to (costume3 v)\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <(costume [number v]) = [4]> then\n            switch costume to (costume3 v)\n            broadcast (100% v)\n        else\n            next costume\n            broadcast (0% v)\n        end\n        wait until <not <mouse down?>>\n    end\nend\n\n@random platformer\n\ngo to x: (0) y: (0)\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n