Pen Platformer Generator #all #games

Instructions: Share your replay codes here: https://scratch.mit.edu/discuss/topic/503257/\n\nAre you tired of generic platformers? If you are then this project is for you! This project creates a platformer everytime you play! Not only that but it is equipped with a replay feature. \n\n\n\n\n\n---CHANGES---\nNone\n\n---HISTORY---\n4/7/2021 - Basically done\n4/8/2021 - shared!\n4/13/2021 - Top Loved!!!\n---HOW TO PLAY---\nJust like a normal platformer ;)\n\n---CONTROLS---\nArrow keys or WASD: movement\nJoystick: Mobile movement\n\n---CREDITS---\nThanks to @Maxybrian for the joystick\nThanks to @04tmoody for the pen engine\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#all #games #cool #titanium #titanium01 #pen #100 #PPG #AI #generator #platformer #non-generic #trending #wow #awesome #replay #generate 

@Stage\n\n@pen\n\ndefine map creator\npen up\nerase all\nset pen size to (5)\nset [i v] to [0]\nrepeat (length of [level xs v])\n    change [i v] by (1)\n    if <<<((Scroll Y) + (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))) > [-180]> and <((Scroll Y) + ((item (i) of [level ys v]) + (5))) < [240]>> and <<((Scroll X) + (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5))) > [-240]> and <((Scroll X) + ((item (i) of [level xs v]) + (5))) < [240]>>> then\n        Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5))\n        set pen color to (#000000)\n        if <(item (i) of [level types v]) = [2]> then\n            set pen color to (#2ca5e2)\n        end\n        if <(item (i) of [level types v]) = [1]> then\n            set pen color to (#ffffff)\n        end\n        if <(item (i) of [level types v]) = [3]> then\n            set pen color to (#ff0000)\n        end\n        pen down\n        if <(i) = (test touching)> then\n            set pen color to (#00ffbf)\n            Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) ((item (i) of [level ys v]) + (5))\n            Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n            Go To ((item (i) of [level xs v]) + (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n            Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5))\n            pen up\n            Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) ((item (i) of [level ys v]) + (5))\n            pen up\n            set pen size to (8)\n            set pen color to (#e1e1e1)\n            pen down\n            set pen size to (5)\n            pen up\n            Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n            pen up\n            set pen size to (8)\n            set pen color to (#e1e1e1)\n            pen down\n            set pen size to (5)\n            pen up\n            Go To ((item (i) of [level xs v]) + (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n            pen up\n            set pen size to (8)\n            set pen color to (#e1e1e1)\n            pen down\n            set pen size to (5)\n            pen up\n            Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5))\n            pen up\n            set pen size to (8)\n            set pen color to (#e1e1e1)\n            pen down\n            set pen size to (5)\n            pen up\n        else\n            Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) ((item (i) of [level ys v]) + (5))\n            Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n            Go To ((item (i) of [level xs v]) + (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n            Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5))\n        end\n        pen up\n    end\nend\nset pen color to (#ee7d16)\ngo to x: (x position) y: (y position)\npen down\ngo to x: (x position) y: ((y position) + (20))\ngo to x: ((x position) + (20)) y: ((y position) + (20))\ngo to x: ((x position) + (20)) y: (y position)\ngo to x: (x position) y: (y position)\npen up\n\ndefine touching #\nset [# v] to [0]\nchange [## v] by (1)\nrepeat (length of [level xs v])\n    change [# v] by (1)\n    if <not <<([abs v] of (((item (#) of [level xs v]) + (5)) + (Scroll X)) ) > [240]> or <([abs v] of (((item (#) of [level ys v]) + (5)) + (Scroll Y)) ) > [180]>>> then\n        if <<<(mouse x) > ((item (#) of [level xs v]) + (Scroll X))> and <(mouse x) < (((item (#) of [level xs v]) + (Scroll X)) + (item (#) of [level widths v]))>> and <<(mouse y) > ((item (#) of [level ys v]) + (Scroll Y))> and <(mouse y) < (((item (#) of [level ys v]) + (Scroll Y)) + (item (#) of [level heights v]))>>> then\n            if <<<mouse down?> and <[5] < (##)>> and > then\n                if <(test touching) = (#)> then\n                    set [test touching v] to [0]\n                    set [## v] to [0]\n                else\n                    set [test touching v] to (#)\n                    set [## v] to [0]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [map creator v]\nforever\n    touching #\n    map creator\n    Update\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(right) = [1]>> then\n        change [scroll x v] by (-15)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(left) = [1]>> then\n        change [scroll x v] by (15)\n    end\n    if <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <(up) = [1]>> then\n        change [scroll y v] by (15)\n    end\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(up) = [1]>> then\n        change [scroll y v] by (-15)\n    end\nend\n\nwhen I receive [map creator v]\nshow variable [recording? v]\nbroadcast (map creator v)\n\nset pen color to (#00ffbf)\n\nset pen color to (#00ffbf)\n\ngo to x: (180) y: (-64)\n\ndefine Go To (x) (y)\ngo to x: ((x) + (Scroll X)) y: ((y) + (Scroll Y))\n\ndefine Scrolling\nchange [scroll x v] by (() - (round ((x position) / (10))))\nchange [x position v] by (() - (round ((x position) / (10))))\nchange [scroll y v] by (() - (round ((y position) / (10))))\nchange [y position v] by (() - (round ((y position) / (10))))\nset [recorded data v] to (join (recorded data) (join (Scroll X) (join [*] (join (join (Scroll Y) [*]) (join (x position) (join [*] (join (y position) [#])))))))\n\ndefine Update\ndelete (all) of [touching v]\nset [i v] to [0]\nrepeat (length of [level xs v])\n    change [i v] by (1)\n    if <<<(x position) < (((item (i) of [level xs v]) + (Scroll X)) + (item (i) of [level widths v]))> and <((x position) + (20)) > ((item (i) of [level xs v]) + (Scroll X))>> and <<(y position) < (((item (i) of [level ys v]) + (Scroll Y)) + (item (i) of [level heights v]))> and <((y position) + (20)) > ((item (i) of [level ys v]) + (Scroll Y))>>> then\n        if <not <[touching v] contains (item (i) of [level types v])?>> then\n            add (item (i) of [level types v]) to [touching v]\n        end\n    end\nend\n\ndefine Create Level\ndelete (all) of [level xs v]\ndelete (all) of [level ys v]\ndelete (all) of [level widths v]\ndelete (all) of [level heights v]\ndelete (all) of [level types v]\nAdd Rectangle (-150) (-50) (300) (25) (1)\nset [x v] to [-200]\npre gen\nup or down\ngenerate map \n\ndefine Draw\npen up\nerase all\nset pen size to (5)\nset [i v] to [0]\nrepeat (length of [level xs v])\n    change [i v] by (1)\n    if <<<((Scroll Y) + (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))) > [-180]> and <((Scroll Y) + ((item (i) of [level ys v]) + (5))) < [240]>> and <<((Scroll X) + (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5))) > [-240]> and <((Scroll X) + ((item (i) of [level xs v]) + (5))) < [240]>>> then\n        Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5))\n        set pen color to (#000000)\n        if <(item (i) of [level types v]) = [2]> then\n            set pen color to (#2ca5e2)\n        end\n        if <(item (i) of [level types v]) = [1]> then\n            set pen color to (#ffffff)\n        end\n        if <(item (i) of [level types v]) = [3]> then\n            set pen color to (#ff0000)\n        end\n        pen down\n        Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) ((item (i) of [level ys v]) + (5))\n        Go To (((item (i) of [level xs v]) + (item (i) of [level widths v])) - (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n        Go To ((item (i) of [level xs v]) + (5)) (((item (i) of [level ys v]) + (item (i) of [level heights v])) - (5))\n        Go To ((item (i) of [level xs v]) + (5)) ((item (i) of [level ys v]) + (5))\n        pen up\n    end\nend\nset pen color to (#ee7d16)\ngo to x: (x position) y: (y position)\npen down\ngo to x: (x position) y: ((y position) + (20))\ngo to x: ((x position) + (20)) y: ((y position) + (20))\ngo to x: ((x position) + (20)) y: (y position)\ngo to x: (x position) y: (y position)\npen up\n\ndefine Add Rectangle (x) (y) (width) (height) (tyoe)\nadd (x) to [level xs v]\nadd (y) to [level ys v]\nadd (width) to [level widths v]\nadd (height) to [level heights v]\nadd (tyoe) to [level types v]\n\ndefine pre gen\ndelete all of [types gen v]\nadd (pick random (1) to (2)) to [types gen v]\nrepeat (300)\n    if <(item (length of [types gen v]) of [types gen v]) = [2]> then\n        if <(pick random (1) to (2)) = [1]> then\n            add [4] to [types gen v]\n        else\n            add [3] to [types gen v]\n        end\n    else\n        if <(item (length of [types gen v]) of [types gen v]) = [3]> then\n            add [1] to [types gen v]\n        else\n            if <<(item ((length of [types gen v]) - (1)) of [types gen v]) = [2]> or <(item ((length of [types gen v]) - (1)) of [types gen v]) = [3]>> then\n                add [1] to [types gen v]\n            else\n                add (pick random (1) to (3)) to [types gen v]\n            end\n        end\n    end\nend\n\ndefine up or down\nset [up or down # v] to [0]\ndelete all of [up or down v]\nrepeat (100)\n    change [up or down # v] by (1)\n    add (pick random (1) to (2)) to [up or down v]\nend\n\ndefine generate map \ndelete all of [test v]\ndelete all of [test 2 v]\ndelete all of [test 3 v]\nset [clone # v] to [0]\nrepeat (301)\n    change [clone # v] by (1)\n    //\n    set [cur v] to [0]\n    set [block x v] to [0]\n    repeat (length of [level widths v])\n        change [cur v] by (1)\n        set [block x v] to ((block X) + (item (cur) of [level widths v]))\n    end\n    set [block x v] to ((block X) - (155))\n    //\n    set [total v] to ([abs v] of (pick random (50) to (((<(item ((clone #) - (1)) of [types gen v]) = [1]> * (200)) + (<(item ((clone #) - (1)) of [types gen v]) = [2]> * (230))) + (<<(item ((clone #) - (1)) of [types gen v]) = [3]> or <(item ((clone #) - (1)) of [types gen v]) = [4]>> * (150)))) )\n    add (Total) to [test v]\n    set [type v] to (pick random (1) to (3))\n    set [block x v] to (block X)\n    set [block height v] to ((<(type) = [1]> * ((pick random (50) to ((Total) / (2))) + (10))) + ((<(type) = [2]> * ((pick random (20) to ((Total) / (2))) + (10))) + (<(type) = [3]> * (pick random (50) to ((Total) / (2))))))\n    set [block y v] to ((Total) - ((Block Height) + (pick random (5) to (20))))\n    add (Block Height) to [test 2 v]\n    add (block Y) to [test 3 v]\n    set [block width v] to [50]\n    Add Rectangle (block X) ((block Y) + ((item (length of [level ys v]) of [level ys v]) - (item (clone #) of [level heights v]))) ([abs v] of (Block Width) ) ([abs v] of (Block Height) ) (item (clone #) of [types gen v])\nend\nset [recorded data v] to (join (Level Xs) (join [,] (join (Level Ys) (join [,] (join (Level Widths) (join [,] (join (Level Heights) (join (join [,] (Level Types)) [:]))))))))\n\ndefine //\n\nwhen I receive [game start v]\nCreate Level\nset [xv v] to [0]\nset [yv v] to [0]\nset [x position v] to [0]\nset [y position v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nforever\n    Draw\n    Update\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(right) = [1]>> then\n        change [xv v] by (1)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(left) = [1]>> then\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change [x position v] by (Xv)\n    Update\n    if <[touching v] contains [1]?> then\n        change [y position v] by (1)\n        Update\n        if <[touching v] contains [1]?> then\n            change [y position v] by (1)\n            Update\n            if <[touching v] contains [1]?> then\n                change [y position v] by (1)\n                Update\n                if <[touching v] contains [1]?> then\n                    change [y position v] by (1)\n                    Update\n                    if <[touching v] contains [1]?> then\n                        change [y position v] by (1)\n                        Update\n                        if <[touching v] contains [1]?> then\n                            change [x position v] by ((Xv) * (-1))\n                            change [y position v] by (-5)\n                            \n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [10]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    Update\n    change [yv v] by (-1)\n    change [y position v] by (Yv)\n    Update\n    if <[touching v] contains [1]?> then\n        change [y position v] by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    Update\n    change [y position v] by (-1)\n    Update\n    if <[touching v] contains [1]?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(up) = [1]>> then\n            set [yv v] to [15]\n        end\n    end\n    Update\n    if <[touching v] contains [2]?> then\n        set [yv v] to [20]\n    end\n    Update\n    if <<[touching v] contains [3]?> or <<(Scroll Y) > [1000]> and <<not <[touching v] contains [1]?>> or <not <[touching v] contains [2]?>>>>> then\n        if <(recording?) = [0]> then\n        show list [click 3 times to copy\[replay data\] v]\n        Create Level\n        set [xv v] to [0]\n        set [yv v] to [0]\n        set [x position v] to [0]\n        set [y position v] to [0]\n        set [scroll x v] to [0]\n        set [scroll y v] to [0]\n    end\n    Update\n    change [y position v] by (1)\n    Scrolling\nend\n\nwhen I receive [game start v]\nforever\n    Update\nend\n\nwhen flag clicked\nhide variable [recording? v]\nforever\n    decode recorded playlist (pick random (1) to (length of [recorded playlists v]))\n    set [run recorded playlist # v] to [0]\n    repeat (length of [scroll x v])\n        change [run recorded playlist # v] by (1)\n        set [scroll x v] to (item (run recorded playlist #) of [scroll x v])\n        set [scroll y v] to (item (run recorded playlist #) of [scroll y v])\n        set [x position v] to (item (run recorded playlist #) of [x position v])\n        set [y position v] to (item (run recorded playlist #) of [y position v])\n        Draw\n        Update\n        if <(ttty) = [1]> then\n            stop [this script v]\n        end\n    end\nend\n\ndefine decode recorded playlist (#)\ndelete all of [x position v]\ndelete all of [y position v]\ndelete all of [level widths v]\ndelete all of [level heights v]\ndelete all of [level xs v]\ndelete all of [level ys v]\ndelete all of [level types v]\ndelete all of [scroll x v]\ndelete all of [scroll y v]\nset [d.r.p v] to [0]\nrepeat (302)\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <<(letter (D.R.P) of (item (#) of [recorded playlists v])) = [ ]> or <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [,]>>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [level xs v]\nend\nrepeat (302)\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <<(letter (D.R.P) of (item (#) of [recorded playlists v])) = [ ]> or <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [,]>>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [level ys v]\nend\nrepeat (302)\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <<(letter (D.R.P) of (item (#) of [recorded playlists v])) = [ ]> or <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [,]>>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [level widths v]\nend\nrepeat (302)\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <<(letter (D.R.P) of (item (#) of [recorded playlists v])) = [ ]> or <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [,]>>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [level heights v]\nend\nrepeat (302)\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <<(letter (D.R.P) of (item (#) of [recorded playlists v])) = [ ]> or <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [:]>>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [level types v]\nend\nrepeat until <(D.R.P) = (length of (item (#) of [recorded playlists v]))>\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [*]>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [scroll x v]\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [*]>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [scroll y v]\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [*]>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [x position v]\n    change [d.r.p v] by (1)\n    set [temp rec play v] to []\n    repeat until <(letter (D.R.P) of (item (#) of [recorded playlists v])) = [#]>\n        set [temp rec play v] to (join (TEMP REC PLAY) (letter (D.R.P) of (item (#) of [recorded playlists v])))\n        change [d.r.p v] by (1)\n    end\n    add (TEMP REC PLAY) to [y position v]\nend\n\nadd (recorded data) to [recorded playlists v]\n\ndelete all of [recorded playlists v]\n\nwhen flag clicked\nshow list [click 3 times to copy\[replay data\] v]\n\nwhen I receive [play v]\nshow variable [recording? v]\nstop [other scripts in sprite v]\nset [recording? v] to [1]\nset [recorded data v] to []\nif <key (space v) pressed?> then\n    set [recording? v] to [0]\nend\nbroadcast (game start v)\nbroadcast (activate v)\n\nwhen I receive [replay v]\nstop [other scripts in sprite v]\nask [recording data?] and wait\nif <(answer) = []> then\n    stop [all v]\nelse\n    add (answer) to [recorded playlists v]\n    decode recorded playlist (length of [recorded playlists v])\n    set [run recorded playlist # v] to [0]\n    repeat (length of [scroll x v])\n        change [run recorded playlist # v] by (1)\n        set [scroll x v] to (item (run recorded playlist #) of [scroll x v])\n        set [scroll y v] to (item (run recorded playlist #) of [scroll y v])\n        set [x position v] to (item (run recorded playlist #) of [x position v])\n        set [y position v] to (item (run recorded playlist #) of [y position v])\n        Draw\n        Update\n        switch costume to (replay v)\n        go to x: (0) y: (-5)\n        show\n        stamp\n        hide\n        switch costume to (costume1 v)\n    end\nend\n\nforever\n    set [ww v] to <<<([abs v] of ((item (1) of [level xs v]) + (Scroll X)) ) > ([abs v] of (mouse x) )> and <([abs v] of ((item (1) of [level xs v]) + (Scroll X)) ) < (([abs v] of (mouse x) ) + (10))>> or <<([abs v] of ((item (1) of [level ys v]) + (Scroll X)) ) > ([abs v] of (mouse y) )> and <([abs v] of ((item (1) of [level ys v]) + (Scroll X)) ) < (([abs v] of (mouse y) ) + (2))>>>\nend\n\n@main-menu\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\nset [type v] to [0]\nset size to (100) %\nswitch costume to (new2 v)\ncreate clone of (_myself_ v)\nswitch costume to (new v)\ncreate clone of (_myself_ v)\n\nswitch costume to (load2 v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    show\n    go to [front v] layer\n    go [backward v] (1) layers\n    change y by (((0) - (y position)) / (5))\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        if <(costume [number v]) = [1]> then\n            switch backdrop to (backdrop1 v)\n            broadcast (play v)\n        else\n            if <(costume [number v]) = [2]> then\n                broadcast (replay v)\n            end\n        end\n    else\n        if <touching (mouse-pointer v)?> then\n            set [brightness v] effect to (13)\n            change size by (((110) - (size)) / (8))\n        else\n            set [brightness v] effect to (0)\n            change size by (((100) - (size)) / (8))\n        end\n    end\nend\n\nwhen I receive [play v]\ndelete this clone\n\nwhen I receive [replay v]\ndelete this clone\n\nwhen I receive [map creator v]\ndelete this clone\n\nwhen flag clicked\nset [ttty v] to [0]\n\nbroadcast (map creator v)\nset [ttty v] to [1]\n\n@mobile circle\n\nwhen flag clicked\nhide\nset [ghost v] effect to (30)\n\nwhen I receive [activate v]\nforever\n    go to (mouse-pointer v)\n    if <mouse down?> then\n        show\n        go to [back v] layer\n        wait until <not <mouse down?>>\n        hide\n    end\nend\n\n@mobile outline\n\nwhen flag clicked\nhide\nset [ghost v] effect to (30)\n\nwhen I receive [activate v]\nforever\n    go to (mouse-pointer v)\n    show\n    go to [front v] layer\n    wait until <not <mouse down?>>\n    hide\nend\n\n@mobile joystick\n\nwhen I receive [activate v]\nforever\n    if <<<mouse down?> and <(x position) > ((initmousex) + (5))>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n        set [right v] to [1]\n    else\n        set [right v] to [0]\n    end\n    if <<<mouse down?> and <(initmousex) > ((x position) + (5))>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n        set [left v] to [1]\n    else\n        set [left v] to [0]\n    end\n    if <<<mouse down?> and <(y position) > ((initmousey) + (5))>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [up v] to [1]\n    else\n        set [up v] to [0]\n    end\nend\n\nwhen flag clicked\nhide\nset [ghost v] effect to (30)\n\ndefine gotomouse (centerx) (centery)\ngo to x: (centerx) y: (centery)\npoint towards (mouse-pointer v)\nif <not <touching (mouse-pointer v)?>> then\n    move (35) steps\nend\n\nwhen flag clicked\nset [left v] to [0]\nset [right v] to [0]\nset [up v] to [0]\n\nwhen I receive [activate v]\nforever\n    go to (mouse-pointer v)\n    if <mouse down?> then\n        set [initmousex v] to (mouse x)\n        set [initmousey v] to (mouse y)\n        show\n        go to [front v] layer\n        repeat until <not <<mouse down?> and <(inventoryopen) = [0]>>>\n            gotomouse (initmousex) (initmousey)\n        end\n        hide\n    else\n    end\nend\n\n@thumbnail\n\nwhen flag clicked\nhide\nforever\n    set [timer v] to (timer)\nend\n\nwhen [timer v] > (timer)\nhide variable [recording? v]\nshow\n\n