AgentJ- ~ A Scrolling Platformer

Instructions: This is a scrolling platformer for AgentJ- 's project contest. AgentJ- is the main character and you're trying to find the ultimate form by discovering skulls and defeating obstacles that have been set by other enemy organizations.\nLeft/right arrows or A/D keys to move.\nSpacebar or up arrow to jump.\nPress s key to skip dialouge.\nYou CAN wall jump.\nEnjoy!

@Stage\n\nwhen I receive [begin v]\nclear graphic effects\nset volume to (100) %\nforever\n    play sound [2019-05-09_-_Escape_Chase_-_David_Fesliyan v] until done\nend\n\nwhen stage clicked\nbroadcast (anim v)\nif <(username) = [brypros]> then\n    ask [x?] and wait\n    set [scrollx v] to (answer)\n    ask [y?] and wait\n    set [scrolly v] to (answer)\nend\n\nwhen I receive [res all v]\nstop [other scripts in sprite v]\nset [brightness v] effect to (-100)\n\nwhen flag clicked\nset [brightness v] effect to (-100)\n\nwhen I receive [choice v]\nask [It seems dangerous...should we fight it? \[Y/N\]] and wait\nbroadcast (send ans v)\n\nwhen I receive [battle v]\nforever\n    play sound [Boss v] until done\nend\n\nwhen I receive [oof v]\nrepeat (50)\n    change [brightness v] effect by (-2)\n    change volume by (-2)\nend\nhide\nstop [other scripts in sprite v]\n\nset [enemy hp v] to [2]\n\n@Empty\n\nwhen I receive [begin v]\nshow\ngo to x: (0) y: (0)\nforever\n    go to [front v] layer\n    if <<(Level) > [4]> and <(Level) < [10]>> then\n        clear graphic effects\n    else\n        set [brightness v] effect to (100)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [res all v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [oof v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\n@Texter\n\ndefine Print (text) Special (?)\nhide\nstart sound (text)\nset [charcounter v] to [0]\nrepeat (length of (text))\n    change [charcounter v] by (1)\n    //Chr (letter (charcounter) of (text))\n    if <not <[speech list v] contains (text)?>> then\n        start sound [A Elec Guitar v]\n    end\n    wait (0.01) seconds\nend\nset [charcounter v] to [0]\nset [enter v] to (?)\nif <not <(?) = []>> then\n    wait until <key ((enter) v) pressed?>\nend\nInitiate\n\ndefine Color (c)\nif <(c) = [black]> then\n    set [color v] effect to (0)\n    set [brightness v] effect to (-100)\nend\nif <(c) = [red]> then\n    set [color v] effect to (0)\n    set [brightness v] effect to (0)\nend\nif <(c) = [orange]> then\n    set [color v] effect to (17)\n    set [brightness v] effect to (0)\nend\nif <(c) = [yellow]> then\n    set [color v] effect to (33)\n    set [brightness v] effect to (0)\nend\nif <(c) = [green]> then\n    set [color v] effect to (67)\n    set [brightness v] effect to (0)\nend\nif <(c) = [cyan]> then\n    set [color v] effect to (100)\n    set [brightness v] effect to (0)\nend\nif <(c) = [blue]> then\n    set [color v] effect to (133)\n    set [brightness v] effect to (0)\nend\nif <(c) = [purple]> then\n    set [color v] effect to (150)\n    set [brightness v] effect to (0)\nend\nif <(c) = [magenta]> then\n    set [color v] effect to (167)\n    set [brightness v] effect to (0)\nend\nif <(c) = [white]> then\n    set [color v] effect to (0)\n    set [brightness v] effect to (100)\nend\n\ndefine //Chr (s)\ngo to [front v] layer\nif <[characters v] contains (s)?> then\n    set [listcounter v] to [0]\n    repeat until <(item (listcounter) of [characters v]) = (s)>\n        change [listcounter v] by (1)\n    end\n    if <<(listcounter) > [65]> and <(listcounter) < [92]>> then\n        switch costume to (6 v)\n        switch costume to (s)\n        if <(costume [number v]) = [32]> then\n            change [listcounter v] by (32)\n        end\n    end\n    //Chr (listcounter)\nelse\n    //Chr (256)\nend\nif <(x position) > [230]> then\n    go to x: (-220) y: ((y position) - (((size) / (100)) * (8)))\nend\n\ndefine Initiate\nclear graphic effects\nerase all\npoint in direction (180)\nset size to (200) %\nset [color v] to [cyan]\ngo to x: (-220) y: (xpos)\nif <(xpos) = [0]> then\n    stop all sounds\nend\n\ndefine //Chr (n)\ngo to [front v] layer\nColor (Color)\nset [writecounter v] to [0]\nrepeat (7)\n    change [writecounter v] by (1)\n    switch costume to (letter (writecounter) of (item (n) of [chardata v]))\n    if <(costume [number v]) > [1]> then\n        stamp\n    end\n    change y by ((size) / (-100))\nend\nchange y by (((size) / (100)) * (7))\nchange x by (((size) / (100)) * (6))\n\nwhen flag clicked\nset [xpos v] to [0]\nset ['@ v] to [0]\nInitiate\nset [color v] to [white]\nPrint [Press s key to skip.] Special [s]\nset [color v] to [cyan]\nPrint [It seems that your last investigation failed miserably. I knew that mission was too dangerous for you. That's why we're coming with you today. Make sure everything is ready unlike the previous time.] Special [s]\nPrint [Before we get to our location in Antarctica, we need to climb several mountains and gather all the pieces we will collect at the peak to find the ultimate intelligent form.] Special [s]\nPrint [Get ready, Agent. We're about to drop off!] Special [s]\nbroadcast (begin v)\n\nwhen I receive [begin v]\nwait (1) seconds\nset [xpos v] to [170]\nInitiate\nset [xpos v] to [170]\nset [color v] to [white]\nPrint [Press left/right or A/D keys to move. Press space key or up arrow to jump.] Special [s]\nInitiate\n\nwhen I receive [skull collected v]\nchange [tc v] by (1)\nInitiate\nset [xpos v] to [170]\nset [color v] to [white]\nPrint (join [Skulls found ] (join (tc) [/3])) Special [s]\nInitiate\n\nwhen flag clicked\nset [tc v] to [0]\n\nwhen I receive [res all v]\nset [color v] to [cyan]\nInitiate\nPrint [All the skulls are found...Thank you, Agent J.] Special [s]\nInitiate\nbroadcast (something is approaching... v) and wait\nset [color v] to [white]\nPrint [The skulls...have opened a path to an ancient creature...] Special [s]\nInitiate\nset [color v] to [white]\nPrint [It seems dangerous...should we fight it?] Special []\nInitiate\nbroadcast (choice v)\n\nwhen I receive [send ans v]\nif <(answer) = [y]> then\n    set [color v] to [white]\n    Print [You have decided to fight the creature...] Special [s]\n    Initiate\n    set [color v] to [white]\n    Print [Good choice...] Special [s]\n    Initiate\n    broadcast (battle v)\nelse\n    set [color v] to [white]\n    Print [You have decided NOT to fight the creature...] Special [s]\n    Initiate\n    set [color v] to [white]\n    Print [He will be caged and sent to the United States for further investigation...] Special [s]\n    Initiate\n    broadcast (close v) and wait\n    broadcast (end v)\nend\n\nwhen I receive [oof v]\nwait (3) seconds\nset [xpos v] to [0]\nInitiate\nPrint [It was the right decision to attack the monster, Agent. We'll call this mission a success!] Special [s]\nbroadcast (end v)\n\n@AgentJ\n\nwhen flag clicked\nhide\n\nwhen I receive [begin v]\no\n\nwhen I start as a clone\nswitch costume to (agentj- v)\nclear graphic effects\ngo to [front v] layer\nforever\n    point in direction ([direction v] of [agentj v])\nend\n\nwhen I receive [res all v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [battle v]\nstop [other scripts in sprite v]\nbroadcast (o v)\n\ndefine o\ngo to x: (0) y: (0)\nset size to (100) %\nshow\nset [xv v] to [0]\nset [scrollx v] to [0]\nset [scrolly v] to [-100]\nset [yv v] to [0]\nshow\nset [ghost v] effect to (100)\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\nforever\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n        change [xv v] by (-1)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n        change [xv v] by (1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching (terrain v)?> then\n        change y by (1)\n        if <touching (terrain v)?> then\n            change y by (1)\n            if <touching (terrain v)?> then\n                change y by (1)\n                if <touching (terrain v)?> then\n                    change y by (1)\n                    if <touching (terrain v)?> then\n                        change y by (1)\n                        if <touching (terrain v)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\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    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching (terrain v)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching (terrain v)?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> then\n            set [yv v] to [13]\n        end\n    end\n    change y by (1)\n    change [scrollx v] by ((x position) * (-1))\n    change [scrolly v] by ((y position) * (-1))\n    go to x: (0) y: (0)\nend\n\nwhen I receive [o v]\no\n\nwhen I receive [oof v]\nstop [other scripts in sprite v]\nrepeat (50)\n    change [brightness v] effect by (-2)\nend\nhide\ndelete this clone\n\nwhen I receive [end v]\nstart sound [Music I want when I die v]\nclear graphic effects\ngo to x: (79) y: (-28)\nswitch costume to (agentj- v)\nset size to (800) %\nshow\nset [counter v] to [0]\nforever\n    change [counter v] by (4)\n    change y by ([cos v] of (counter) )\nend\n\nbroadcast (begin v)\n\nset [xeffect v] to [0]\n\nbroadcast (begin v)\n\nset [level v] to [13]\n\n@Snow\n\nwhen flag clicked\ngo to x: (-200) y: (0)\nhide\n\nwhen I receive [begin v]\nerase all\nrepeat (75)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (1) layers\nclear graphic effects\nset size to (pick random (5) to (50)) %\nset [randomx v] to (pick random (-1) to (-5))\nset [x v] to (pick random (-200) to (200))\ngo to x: (x) y: (200)\nshow\nforever\n    if <[6] > (Level)> then\n        repeat until <(y position) < ((-175) - ((size) / (50)))>\n            change y by ((randomx) * (((100) / (size)) + ((60) / (distance to [agentj v]))))\n            change x by ((randomx) * (((-25) / (size)) + ((75) / (distance to [agentj v]))))\n            if <(Level) > [4]> then\n                hide\n            else\n                show\n            end\n        end\n    else\n        show\n        repeat until <(y position) < ((-175) - ((size) / (50)))>\n            change y by ((randomx) * (((400) / (size)) + ((60) / (distance to [agentj v]))))\n            change x by ((randomx) * (((-200) / (size)) + ((75) / (distance to [agentj v]))))\n        end\n    end\n    go to x: (x) y: (200)\nend\n\nwhen I receive [res all v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [battle v]\nerase all\nrepeat (75)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [oof v]\nrepeat (50)\n    change [brightness v] effect by (-2)\nend\nhide\ndelete this clone\n\n@terrain\n\nwhen flag clicked\nclear graphic effects\nhide\n\nwhen I receive [begin v]\nset [level v] to [1]\nset [y v] to [0]\npoint in direction (90)\nhide\nbroadcast (costumes v)\n\nwhen I start as a clone\ngo to [front v] layer\nshow\nforever\n    go to x: ((ScrollX) - (k)) y: ((ScrollY) - (y))\n    if <<([abs v] of ((ScrollX) - (k)) ) > ((460) + (<(costume [number v]) = [17]> * (100)))> or <<(ScrollY) > [450]> and <not <(costume [number v]) = [17]>>>> then\n        hide\n    else\n        show\n    end\n    if <(ScrollY) > [450]> then\n        broadcast (anim v)\n    end\n    change [counter v] by (1)\nend\n\nbroadcast (begin v)\n\nwhen I receive [costumes v]\nif <[] = []> then\n    stop [other scripts in sprite v]\n    delete this clone\nend\nswitch costume to (((Level) * (4)) - (3))\nset [yeffect v] to [0]\nset [xeffect v] to [0]\nset [k v] to [0]\nrepeat (4)\n    next costume\n    create clone of (_myself_ v)\n    change [k v] by (-450)\nend\n\nwhen I receive [battle v]\nswitch costume to (costume58 v)\nset [yeffect v] to [0]\nset [xeffect v] to [0]\nset [k v] to [0]\ncreate clone of (_myself_ v)\nchange [k v] by (-450)\n\nwhen I receive [oof v]\nstop [other scripts in sprite v]\nrepeat (50)\n    change [brightness v] effect by (-2)\nend\nhide\ndelete this clone\n\nwhen I receive [res all v]\ndelete this clone\n\n@Boss\n\nwhen flag clicked\nhide\n\nwhen I receive [something is approaching... v]\nstop [other scripts in sprite v]\ngo to x: (50) y: (0)\nset [brightness v] effect to (-100)\nset size to (100) %\nshow\nbroadcast (costume v)\nstart sound [cellar-stairs-1 v]\nrepeat (200)\n    change [brightness v] effect by (0.125)\n    change size by (0.125)\nend\n\nwhen I receive [costume v]\nforever\n    wait (0.1) seconds\n    next costume\nend\n\nwhen I receive [close v]\nstart sound [cellar-stairs-2 v]\nrepeat (200)\n    change [brightness v] effect by (-0.125)\n    change size by (-0.125)\nend\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [battle v]\nhide\nwait (1) seconds\nclear sound effects\nset [xboss v] to [-90]\nset [wow v] to [0]\nset size to (30) %\nset [touch? v] to [0]\nset [enemy hp v] to [10]\nset [yboss v] to [-80]\nshow\nforever\n    broadcast (bruh v) and wait\n    set [brightness v] effect to (-20)\n    repeat until <(timer) > [2]>\n        set [cnter v] to [0]\n        go to x: ((ScrollX) - ()) y: (((ScrollY) + (yboss)) - (30))\n        add ((ScrollX) + (xboss)) to [pos v]\n        add (((ScrollY) + (yboss)) - (30)) to [pos v]\n        delete all of [pos v]\n        change x by (xboss)\n        Y\n        point towards (agentj v)\n        turn right (180) degrees\n        if <touching (agentj v)?> then\n            if <(touch?) = [0]> then\n                set [touch? v] to [1]\n                broadcast (touch v)\n            end\n        end\n        if <(Enemy HP) < [1]> then\n            stop [other scripts in sprite v]\n            broadcast (oof v)\n            stop [this script v]\n        end\n    end\n    reset timer\nend\n\ndefine Y\nif <touching (terrain v)?> then\n    change y by (1)\n    if <touching (terrain v)?> then\n        change y by (1)\n        if <touching (terrain v)?> then\n            change y by (1)\n            if <touching (terrain v)?> then\n                change y by (1)\n                if <touching (terrain v)?> then\n                    change y by (1)\n                    if <touching (terrain v)?> then\n                end\n            end\n        end\n    end\nend\nchange [wow v] by (-1)\nchange [yboss v] by (wow)\nchange y by (yboss)\nif <touching (terrain v)?> then\n    change y by ((yboss) * (-1))\n    set [wow v] to [0]\n    set [yboss v] to [0]\nend\n\nwhen I receive [anim v]\nset [xboss v] to [-90]\nset [wow v] to [0]\nset size to (30) %\nset [yboss v] to [0]\n\nwhen I receive [bruh v]\nreset timer\nrepeat until <(timer) > [4]>\n    res?\nend\nreset timer\nset [cnter v] to [0]\n\ndefine res?\nset [brightness v] effect to (40)\ngo to x: ((ScrollX) - ()) y: (((ScrollY) + (yboss)) - (30))\nchange x by (xboss)\nY\npoint towards (agentj v)\nturn right (180) degrees\nchange [xboss v] by ((((direction) / ([abs v] of (direction) )) * (((-800) / ((Enemy HP) * (2.5))) * (0.8))) / (distance to [agentj v]))\nif <touching (agentj v)?> then\n    change [cnter v] by (1)\n    if <(cnter) > [15]> then\n        set [xboss v] to [-90]\n        set [wow v] to [0]\n        set size to (30) %\n        set [yboss v] to [-80]\n        show\n        set [scrolly v] to [0]\n        set [scrollx v] to [0]\n        set [xeffect v] to [0]\n        set [yeffect v] to [0]\n        set [enemy hp v] to [10]\n        set [touch? v] to [0]\n        set [cnter v] to [0]\n    end\nend\n\nwhen I receive [touch v]\nstart sound [mixkit-aquatic-creature-scream-2203 v]\nchange [enemy hp v] by (-1)\nrepeat (10)\n    set [brightness v] effect to (-100)\n    wait (0.05) seconds\n    set [brightness v] effect to (100)\n    wait (0.05) seconds\nend\nclear graphic effects\nset [touch? v] to [0]\n\nwhen I receive [battle v]\nforever\n    wait (1) seconds\n    if <(pick random (1) to (Enemy HP)) = [1]> then\n        broadcast (bomb v) and wait\n    end\nend\n\nwhen I receive [oof v]\nset [pitch v] effect to (-90)\nstart sound [mixkit-aquatic-creature-scream-2203 v]\nrepeat (10)\n    set [brightness v] effect to (-100)\n    wait (0.1) seconds\n    set [brightness v] effect to (100)\n    wait (0.1) seconds\nend\nclear graphic effects\nhide\n\nwhen I receive [oof v]\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\nhide\n\n@Explosion\n\nwhen flag clicked\nhide\n\nwhen I receive [explode v]\nstart sound [mixkit-shot-light-explosion-1682 v]\nswitch costume to (xcvt v)\nset size to (60) %\nshow\nrepeat (6)\n    next costume\n    go to x: ((ScrollX) + (bomb)) y: (((ScrollY) + (bomy)) - (30))\n    if <touching (agentj v)?> then\n        set [xboss v] to [-90]\n        set [wow v] to [0]\n        set size to (30) %\n        set [yboss v] to [-80]\n        set [scrolly v] to [0]\n        set [scrollx v] to [0]\n        set [xeffect v] to [0]\n        set [yeffect v] to [0]\n        set [enemy hp v] to [10]\n        set [cnter v] to [0]\n        hide\n    end\n    wait (0.1) seconds\nend\nhide\n\n@Parallax\n\nwhen flag clicked\nclear graphic effects\nhide\n\nwhen I receive [begin v]\n0\n\nwhen I start as a clone\nnext costume\nshow\nforever\n    go to x: ((ScrollX) / (50)) y: (-50)\n    if <<<(Level) > [4]> and <(Level) < [10]>> or <(Level) > [14]>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [res all v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [battle v]\n0\n\ndefine 0\nswitch costume to (p1 v)\nshow\ncreate clone of (_myself_ v)\nforever\n    go to [back v] layer\n    go to x: ((ScrollX) / (25)) y: (-73)\n    set [ghost v] effect to (30)\n    if <<(Level) > [14]> or <<(Level) > [4]> and <(Level) < [10]>>> then\n        switch costume to (ice-cave-game-background-vector-31900215 v)\n    else\n        switch costume to (p1 v)\n    end\n    if <<(Level) = [6]> or <(Level) = [11]>> then\n        set [ghost v] effect to (80)\n    else\n        set [ghost v] effect to (0)\n    end\n    if <(Level) = [15]> then\n        set [brightness v] effect to (-70)\n    end\nend\n\nwhen I receive [oof v]\nstop [other scripts in sprite v]\nrepeat (50)\n    change [brightness v] effect by (-2)\nend\nhide\n\nwhen this sprite clicked\nbroadcast (anim v)\nif <(username) = [brypros]> then\n    ask [x?] and wait\n    set [scrollx v] to (answer)\n    ask [y?] and wait\n    set [scrolly v] to (answer)\nend\n\n@Objects\n\nwhen flag clicked\nhide\n\ndefine Spawn (x) (y) type (type)\nset [cx v] to (x)\nset [cy v] to (y)\nset [type v] to (type)\ncreate clone of (_myself_ v)\n\nwhen I receive [begin v]\nSpawn [-1585] [35] type [finish]\n\nwhen I start as a clone\ngo to [front v] layer\nset [counter v] to [0]\nset [ry v] to [0]\nset [yyy v] to [0]\nset [killed? v] to [0]\nset [true? v] to [false]\nreset timer\nif <(type) = [finish]> then\n    set size to (35) %\n    switch costume to (hnvywoe v)\nelse\n    if <(type) = [checkpoint]> then\n        set size to (15) %\n        switch costume to (f1e48b3e301c6e7 v)\n    else\n        if <(type) = [spike]> then\n            set size to (45) %\n            switch costume to (6f4467b57a36e6c5b09b60ddb422ad8e v)\n        else\n            if <(type) = [enemy]> then\n                set size to (35) %\n                switch costume to (mohammx-alam-mehrjerdi-enemy-gun v)\n            else\n                if <(type) = [robot]> then\n                    set size to (25) %\n                    switch costume to (ezgif v)\n                else\n                    set size to (40) %\n                    switch costume to (skull v)\n                end\n            end\n        end\n    end\nend\nforever\n    go to x: (((ScrollX) - (cx)) - (cx2)) y: (((ScrollY) - (cy)) - (ry))\n    if <<([abs v] of ((ScrollY) - (cy)) ) > [170]> or <([abs v] of (((ScrollX) - (cx)) - (cx2)) ) > [240]>> then\n        hide\n    else\n        if <<(killed?) = [1]> and << (costume [name v]) contains [ezgif]?> or < (costume [name v]) contains [moham]?>>> then\n            hide\n            set y to (200)\n        else\n            show\n        end\n    end\n    if <<<not <(type) = [enemy]>> and <not <(type) = [robot]>>> and <not <(type) = [skull]>>> then\n        next costume\n    end\n    if <(type) = [enemy]> then\n        if <(timer) > [2]> then\n            if <not <(killed?) = [1]>> then\n                set volume to (((1000) / (distance to [agentj v])) * (10)) %\n                start sound [ie_shot_gun-luminalace-770179786 v]\n                repeat (4)\n                    next costume\n                    go to x: ((ScrollX) - (cx)) y: ((ScrollY) - (cy))\n                end\n                broadcast (shoot v)\n                switch costume to (mohammx-alam-mehrjerdi-enemy-gun v)\n                reset timer\n            end\n        end\n    end\n    if <(type) = [finish]> then\n        if <(costume [number v]) = [9]> then\n            switch costume to (hnvywoe v)\n        end\n        if <touching (agentj v)?> then\n            if <(Level) = [14]> then\n                broadcast (res all v)\n            else\n                change [level v] by (1)\n                Delete All\n                broadcast (anim v)\n                broadcast (costumes v)\n            end\n        end\n    end\n    if <(type) = [checkpoint]> then\n        if <(costume [number v]) = [23]> then\n            switch costume to (f1e48b3e301c6e7 v)\n        end\n        if <touching (agentj v)?> then\n            Delete All\n            add ([floor v] of (ScrollY) ) to [ypos v]\n            add ([floor v] of (ScrollX) ) to [xpos v]\n        else\n            say []\n        end\n    end\n    if <touching (mouse-pointer v)?> then\n        say (type)\n    else\n        if <<(type) = [checkpoint]> and <touching (agentj v)?>> then\n            say [Checkpoint Acquired!]\n        else\n            say []\n        end\n    end\n    if <(type) = [spike]> then\n        if <(costume [number v]) = [27]> then\n            switch costume to (6f4467b57a36e6c5b09b60ddb422ad8e v)\n        end\n        if <touching (agentj v)?> then\n            broadcast (anim v)\n        end\n    end\n    if <(type) = [enemy]> then\n        if <(costume [number v]) = [32]> then\n            switch costume to (mohammx-alam-mehrjerdi-enemy-gun v)\n        end\n        if <(killed?) = [0]> then\n            set [xenemy v] to ((ScrollX) - (cx))\n            set [yenemy v] to ((ScrollY) - (cy))\n        end\n        if <<touching (agentj v)?> and <(((ScrollY) - (cy)) + (5)) < ([y position v] of [agentj v])>> then\n            start sound [mixkit-scream-in-pain-2200 v]\n            hide\n            set [killed? v] to [1]\n        else\n            if <touching (agentj v)?> then\n                broadcast (anim v)\n            end\n        end\n    end\n    if <(type) = [robot]> then\n        if <(costume [number v]) = [1]> then\n            switch costume to (ezgif v)\n        end\n        if <<touching (empty v)?> and <(((ScrollY) - (cy)) - (ry)) < [-200]>> then\n            if <(killed?) = [0]> then\n                set volume to (100) %\n                start sound [Snd_Fall v]\n                set [killed? v] to [1]\n                hide\n            end\n        end\n        if <<(distance to [agentj v]) < [150]> or <(true?) = [true]>> then\n            set [true? v] to [true]\n            change [yyy v] by (1)\n            change [ry v] by (yyy)\n            if <touching (terrain v)?> then\n                start sound [Boing v]\n                change [ry v] by ((yyy) * (-1))\n                set [ry v] to [0]\n                set [yyy v] to [0]\n            end\n            if <touching color (#eaeaea)?> then\n                change y by (1)\n                if <touching color (#eaeaea)?> then\n                    change y by (1)\n                    if <touching color (#eaeaea)?> then\n                        change y by (1)\n                        if <touching color (#eaeaea)?> then\n                            change y by (1)\n                            if <touching color (#eaeaea)?> then\n                                change y by (1)\n                                if <(killed?) = [0]> then\n                                    set volume to (100) %\n                                    start sound [mixkit-car-explosion-debris-1562 v]\n                                    set [killed? v] to [1]\n                                    hide\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n            change y by (10)\n            next costume\n            point towards (agentj v)\n            set rotation style [left-right v]\n            if <(x position) < ([x position v] of [agentj v])> then\n                change [cx2 v] by (-3.5)\n            else\n                change [cx2 v] by (3.5)\n            end\n            if <touching (agentj v)?> then\n                broadcast (anim v)\n            end\n            if <(costume [number v]) = [44]> then\n                switch costume to (ezgif v)\n            end\n        end\n    end\n    if <(type) = [skull]> then\n        set rotation style [all around v]\n        turn right ([cos v] of (counter) ) degrees\n        set [skullx v] to ((ScrollX) - (cx))\n        set [skully v] to ((ScrollY) - (cy))\n        change [counter v] by (4)\n        if <touching (agentj v)?> then\n            if <(Level) = [14]> then\n                change [level v] by (1)\n                broadcast (res all v)\n            else\n                hide\n                Delete All\n                broadcast (anim v)\n                broadcast (costumes v)\n                broadcast (skull collected v)\n                change [level v] by (1)\n            end\n        end\n    end\nend\n\nwhen I receive [costumes v]\ndelete all of [ypos v]\ndelete all of [xpos v]\nadd [0] to [xpos v]\nadd [0] to [ypos v]\nerase all\nif <<not <(Level) = [1]>> and <[50] = [50]>> then\n    delete this clone\nend\nif <(Level) = [2]> then\n    Spawn [-1585] [-40] type [finish]\n    Spawn [-550] [-20] type [spike]\n    Spawn [-1000] [-110] type [spike]\n    Spawn [-900] [-160] type [checkpoint]\nelse\n    if <(Level) = [3]> then\n        Spawn [-1585] [120] type [finish]\n        Spawn [-100] [0] type [spike]\n        Spawn [-300] [0] type [spike]\n        Spawn [-840] [60] type [spike]\n        Spawn [-1080] [-100] type [spike]\n        Spawn [-1180] [-100] type [spike]\n    else\n        if <(Level) = [4]> then\n            Spawn [-100] [-20] type [spike]\n            Spawn [-650] [15] type [enemy]\n            Spawn [-950] [20] type [spike]\n            Spawn [-1050] [130] type [spike]\n            Spawn [-1250] [90] type [finish]\n        else\n            if <(Level) = [5]> then\n                Spawn [-500] [100] type [robot]\n                Spawn [-800] [80] type [enemy]\n                Spawn [-875] [80] type [checkpoint]\n                Spawn [-1020] [10] type [spike]\n                Spawn [-1220] [10] type [spike]\n                Spawn [-1320] [10] type [enemy]\n                Spawn [-1420] [80] type [robot]\n                Spawn [-1420] [80] type [spike]\n                Spawn [-1520] [10] type [spike]\n                Spawn [-1760] [25] type [skull]\n            else\n                if <(Level) = [6]> then\n                    Spawn [0] [90] type [robot]\n                    Spawn [-80] [10] type [enemy]\n                    Spawn [20] [-160] type [spike]\n                    Spawn [-275] [-85] type [enemy]\n                    Spawn [-350] [-50] type [spike]\n                    Spawn [-650] [90] type [robot]\n                    Spawn [-750] [80] type [enemy]\n                    Spawn [-900] [20] type [spike]\n                    Spawn [-1100] [50] type [enemy]\n                    Spawn [-1150] [50] type [robot]\n                    Spawn [-1450] [90] type [finish]\n                else\n                    if <(Level) = [7]> then\n                        Spawn [-140] [-30] type [spike]\n                        Spawn [-250] [-100] type [spike]\n                        Spawn [-625] [-55] type [enemy]\n                        Spawn [-925] [-120] type [robot]\n                        Spawn [-925] [30] type [robot]\n                        Spawn [-800] [120] type [checkpoint]\n                        Spawn [-1550] [120] type [enemy]\n                        Spawn [-1250] [-80] type [spike]\n                        Spawn [-1550] [-35] type [finish]\n                    else\n                        if <(Level) = [8]> then\n                            Spawn [-760] [90] type [enemy]\n                            Spawn [-300] [20] type [robot]\n                            Spawn [-410] [80] type [spike]\n                            Spawn [-460] [80] type [spike]\n                            Spawn [-510] [80] type [spike]\n                            Spawn [-560] [90] type [robot]\n                            Spawn [-560] [80] type [spike]\n                            Spawn [-650] [80] type [checkpoint]\n                            Spawn [-300] [20] type [enemy]\n                            Spawn [-860] [80] type [spike]\n                            Spawn [-1260] [-15] type [spike]\n                            Spawn [-1460] [0] type [spike]\n                            Spawn [-1550] [110] type [finish]\n                        else\n                            if <(Level) = [9]> then\n                                Spawn [150] [-80] type [robot]\n                                Spawn [-175] [-210] type [spike]\n                                Spawn [-300] [-190] type [spike]\n                                Spawn [-400] [80] type [spike]\n                                Spawn [-1150] [27] type [enemy]\n                                Spawn [-900] [90] type [enemy]\n                                Spawn [-550] [-70] type [enemy]\n                                Spawn [60] [-165] type [enemy]\n                                Spawn [-800] [90] type [robot]\n                                Spawn [-1150] [40] type [checkpoint]\n                                Spawn [-1350] [-50] type [robot]\n                                Spawn [-1550] [0] type [finish]\n                            else\n                                if <(Level) = [10]> then\n                                    Spawn [100] [80] type [robot]\n                                    Spawn [-375] [80] type [spike]\n                                    Spawn [-500] [200] type [spike]\n                                    Spawn [-700] [125] type [spike]\n                                    Spawn [-800] [75] type [spike]\n                                    Spawn [-850] [40] type [checkpoint]\n                                    Spawn [-900] [25] type [spike]\n                                    Spawn [-1000] [-25] type [spike]\n                                    Spawn [-1125] [-90] type [enemy]\n                                    Spawn [-1225] [-50] type [spike]\n                                    Spawn [-1325] [0] type [spike]\n                                    Spawn [-1425] [50] type [spike]\n                                    Spawn [-1525] [100] type [spike]\n                                    Spawn [-1625] [125] type [skull]\n                                else\n                                    if <(Level) = [11]> then\n                                        Spawn [100] [80] type [robot]\n                                        Spawn [-75] [20] type [spike]\n                                        Spawn [-225] [-40] type [spike]\n                                        Spawn [-375] [20] type [spike]\n                                        Spawn [-500] [80] type [spike]\n                                        Spawn [-700] [75] type [robot]\n                                        Spawn [-1300] [5] type [enemy]\n                                        Spawn [-1100] [75] type [enemy]\n                                        Spawn [-900] [5] type [enemy]\n                                        Spawn [-1475] [0] type [spike]\n                                        Spawn [-1550] [-85] type [finish]\n                                    else\n                                        if <(Level) = [12]> then\n                                            Spawn [50] [-50] type [spike]\n                                            Spawn [-75] [-125] type [spike]\n                                            Spawn [-375] [-120] type [spike]\n                                            Spawn [-600] [-180] type [spike]\n                                            Spawn [-600] [-150] type [spike]\n                                            Spawn [-600] [-120] type [spike]\n                                            Spawn [-600] [-90] type [spike]\n                                            Spawn [-600] [-60] type [spike]\n                                            Spawn [-600] [-30] type [spike]\n                                            Spawn [-600] [0] type [spike]\n                                            Spawn [-600] [30] type [spike]\n                                            Spawn [-500] [-30] type [spike]\n                                            Spawn [-700] [30] type [checkpoint]\n                                            Spawn [-1200] [0] type [robot]\n                                            Spawn [-1300] [70] type [enemy]\n                                            Spawn [-850] [5] type [enemy]\n                                            Spawn [-700] [70] type [enemy]\n                                            Spawn [-250] [-180] type [enemy]\n                                            Spawn [-1550] [85] type [finish]\n                                        else\n                                            if <(Level) = [13]> then\n                                                Spawn [-200] [-15] type [robot]\n                                                Spawn [-725] [90] type [spike]\n                                                Spawn [-1060] [-90] type [enemy]\n                                                Spawn [-650] [75] type [enemy]\n                                                Spawn [-450] [15] type [enemy]\n                                                Spawn [-650] [90] type [checkpoint]\n                                                Spawn [-825] [-50] type [robot]\n                                                Spawn [-925] [-25] type [spike]\n                                                Spawn [-1200] [-75] type [robot]\n                                                Spawn [-1400] [0] type [checkpoint]\n                                                Spawn [-1450] [20] type [spike]\n                                                Spawn [-1500] [-20] type [spike]\n                                                Spawn [-1500] [130] type [finish]\n                                            else\n                                                if <(Level) = [14]> then\n                                                    Spawn [-200] [90] type [robot]\n                                                    Spawn [-560] [80] type [spike]\n                                                    Spawn [-1160] [80] type [robot]\n                                                    Spawn [-2260] [0] type [enemy]\n                                                    Spawn [-1260] [80] type [enemy]\n                                                    Spawn [-1060] [80] type [enemy]\n                                                    Spawn [-860] [35] type [enemy]\n                                                    Spawn [-830] [35] type [spike]\n                                                    Spawn [-1025] [-80] type [spike]\n                                                    Spawn [-1125] [-180] type [spike]\n                                                    Spawn [-700] [-300] type [skull]\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nbroadcast (del v)\n\nwhen I receive [del v]\nset [ry v] to [0]\ndelete this clone\n\nwhen I receive [anim v]\nset [killed? v] to [0]\nset [scrollx v] to (xpos)\nset [cx2 v] to [0]\nset [scrolly v] to ((ypos) - (60))\nset [xeffect v] to [0]\nset [yeffect v] to [0]\nset [skullx v] to [0]\nset [skully v] to [0]\nset [ry v] to [0]\nset [true? v] to [false]\nset [yyy v] to [0]\n\ndefine Delete All\ndelete all of [xpos v]\ndelete all of [ypos v]\n\ndefine Create Row (length)\nset [cx v] to (cx)\nrepeat (length)\n    change [cx v] by (-50)\n    Spawn (cx) [-100] type [spike]\nend\n\nswitch costume to (ezgif v)\nrepeat (35)\n    wait (0.01) seconds\n    next costume\nend\n\nbroadcast (del v)\n\nwhen I start as a clone\n\nset rotation style [left-right v]\n\nbroadcast (del v)\n\nchange y by (10)\n\nwhen I receive [res all v]\nstop [other scripts in sprite v]\ndelete this clone\n\nSpawn [] [] type [finish]\n\nSpawn [] [] type [spike]\n\nSpawn [] [] type [enemy]\n\nSpawn [] [] type [skull]\n\nSpawn [] [] type [robot]\n\nSpawn [] [] type [checkpoint]\n\n@Gun\n\nwhen flag clicked\nhide\n\nwhen I receive [shoot v]\nhide\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nclear graphic effects\nset [xgun v] to [0]\nshow\ngo to [front v] layer\nrepeat (50)\n    if <([abs v] of (((xenemy) - (30)) - (xgun)) ) > [400]> then\n        hide\n    else\n        show\n    end\n    go to x: (((xenemy) - (30)) - (xgun)) y: ((yenemy) - (5))\n    change [xgun v] by (20)\n    if <touching (agentj v)?> then\n        broadcast (anim v)\n        hide\n        stop [this script v]\n    end\n    if <touching (terrain v)?> then\n        hide\n        stop [this script v]\n    end\n    change [ghost v] effect by (2)\nend\ndelete this clone\n\nwhen I receive [anim v]\ndelete this clone\n\n@Bomb\n\nwhen flag clicked\nhide\n\nwhen I receive [bomb v]\nset size to (15) %\nwait until <not <(pos) = [ ]>>\nset [bomb v] to (item (1) of [pos v])\nset [bomy v] to (item (2) of [pos v])\nset [dir v] to (([direction v] of [boss v]) / ([abs v] of ([direction v] of [boss v]) ))\nshow\nrepeat (20)\n    go to x: ((ScrollX) + (bomb)) y: (((ScrollY) + (bomy)) - (30))\n    turn right ((dir) * (15)) degrees\n    change [bomy v] by (4)\n    change [bomb v] by ((-4) * (dir))\nend\nrepeat until <<touching (_edge_ v)?> or <touching (terrain v)?>>\n    go to x: ((ScrollX) + (bomb)) y: (((ScrollY) + (bomy)) - (30))\n    turn right ((dir) * (15)) degrees\n    change [bomy v] by (-4)\n    change [bomb v] by ((-4) * (dir))\nend\nbroadcast (explode v)\nhide\n\nwhen I receive [oof v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\n@Effect\n\nwhen flag clicked\nhide\nset [skully v] to [0]\nset [skullx v] to [0]\nforever\n    if <<not <(skullx) = [0]>> or <not <(skully) = [0]>>> then\n        go to x: (skullx) y: (skully)\n        turn right (1) degrees\n        set size to (45) %\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [res all v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\n@end\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nwait (8) seconds\nset [ghost v] effect to (100)\ngo to x: (0) y: (200)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\n    change y by (-2)\nend\n\nbroadcast (end v)\n\n@Flashlight\n\nwhen flag clicked\nhide\n\nwhen I receive [battle v]\ngo to x: (0) y: (0)\nshow\nrepeat (10)\n    go to [front v] layer\nend\n\nwhen I receive [oof v]\nwait (3) seconds\nhide\n\n@Thumbnail\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\n\n