Clash - a Platformer
@Stage\n\nwhen flag clicked\nbroadcast (start project v)\n\nwhen backdrop switches to [backdrop3 v]\nwait (0.5) seconds\nforever\n    play sound [Geometra v] until done\nend\n\nwhen I receive [start project v]\nswitch backdrop to (backdrop1 v)\nset [color v] effect to (pick random (0) to (200))\n\nwhen I receive [nextlvl v]\nset [color v] effect to (pick random (0) to (200))\nif <(level) = [11]> then\n    set [color v] effect to (170)\nend\nif <(level) = [16]> then\n    clear graphic effects\n    switch backdrop to (backdrop2 v)\nend\nif <(level) > [16]> then\n    clear graphic effects\nend\n\nwhen I receive [start project v]\nrepeat until <(backdrop [name v]) = [backdrop2]>\n    play sound [Geometra v] until done\nend\n\nwhen I receive [realwinner! v]\nstop all sounds\n\nwhen backdrop switches to [backdrop2 v]\nstop all sounds\n\nwhen I receive [fight v]\nwait (0.01) seconds\nrepeat until <(fightstat) = [complete]>\n    play sound [Beat Shadow! v] until done\nend\n\n@Player\n\nwhen I receive [next speech v]\nSpeech [She's guarding that orb! It must be what's causing all this trouble.] (0.001)\nSpeech [I have to get it!] (0.001)\nbroadcast (nextnextspeech v)\n\nwhen flag clicked\nset [level v] to [1]\nset [move? v] to [yes]\n\ndefine Speech (text) (speed)\nset [output v] to []\nset [counter v] to [1]\nrepeat (length of (text))\n    set [output v] to (join (Output) (letter (Counter) of (text)))\n    change [counter v] by (1)\n    say (Output)\n    start sound [High Talk v]\n    wait (speed) seconds\nend\nwait until <key (space v) pressed?>\nsay []\nstop [this script v]\n\nwhen backdrop switches to [backdrop2 v]\nforever\n    wait until <touching (spectrorb v)?>\n    broadcast (winner! v)\n    set [move? v] to [no]\n    stop [this script v]\nend\n\nwhen I receive [start project v]\nshow\nswitch costume to (costume1 v)\ngo to x: (-223) y: (-106)\nset [xv v] to [0]\nset [yv v] to [0]\nrepeat until <(backdrop [name v]) = [bqckdrop3]>\n    if <(move?) = [yes]> then\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            switch costume to (costume1 v)\n            change [xv v] by (1)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            switch costume to (costume2 v)\n            change [xv v] by (-1)\n        end\n        set [xv v] to ((Xv) * (0.9))\n        change x by (Xv)\n        if <<<touching (ground v)?> or <touching (ground2 v)?>> or <touching (pedestal v)?>> then\n            change y by (1)\n            if <<<touching (ground v)?> or <touching (ground2 v)?>> or <touching (pedestal v)?>> then\n                change y by (1)\n                if <<<touching (ground v)?> or <touching (ground2 v)?>> or <touching (pedestal v)?>> then\n                    change y by (1)\n                    if <<<touching (ground v)?> or <touching (ground2 v)?>> or <touching (pedestal v)?>> then\n                        change y by (1)\n                        if <<<touching (ground v)?> or <touching (ground2 v)?>> or <touching (pedestal v)?>> then\n                            change y by (1)\n                            if <<<touching (ground v)?> or <touching (ground2 v)?>> or <touching (pedestal v)?>> then\n                                change x by ((Xv) * (-1))\n                                change y by (-5)\n                                set [xv v] to [0]\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 (ground v)?> or <touching (ground2 v)?>> or <touching (pedestal v)?>> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <<<touching (ground v)?> or <touching (ground2 v)?>> or <touching (pedestal v)?>> then\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                set [yv v] to [14]\n            end\n        end\n        change y by (1)\n        if <touching (bouncy stuff v)?> then\n            set [yv v] to [22]\n        end\n        if <(backdrop [name v]) = [backdrop3]> then\n            stop [this script v]\n        end\n    end\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [16]> then\n    set [move? v] to [no]\n    set [xv v] to [0]\n    set [yv v] to [0]\n    switch costume to (costume1 v)\n    go to x: (-240) y: (-106)\n    glide (1) secs to x: (-170) y: (-106)\nend\n\nwhen I receive [start project v]\nrepeat until <(level) = [17]>\n    wait until <<touching (bad stuff v)?> or <touching (bad stuff2 v)?>>\n    broadcast (fail v)\n    set [yv v] to [0]\n    switch costume to (costume1 v)\n    go to x: (-223) y: (-106)\n    wait until <not <(x position) > [218]>>\nend\n\nwhen [r v] key pressed\nbroadcast (fail v)\nset [yv v] to [0]\nswitch costume to (costume1 v)\ngo to x: (-223) y: (-106)\nwait until <not <(x position) > [218]>>\n\nwhen backdrop switches to [backdrop3 v]\nforever\n    wait until <touching color (#ff0000)?>\n    broadcast (fail v)\n    set [yv v] to [0]\n    switch costume to (costume1 v)\n    go to x: (-223) y: (-106)\n    wait until <not <(x position) > [218]>>\nend\n\nwhen I receive [start project v]\nrepeat until <(level) = [21]>\n    wait until <(x position) > [218]>\n    change [level v] by (1)\n    broadcast (nextlvl v)\n    switch costume to (costume1 v)\n    go to x: (-223) y: (-106)\n    wait until <not <(x position) > [218]>>\nend\n\nwhen backdrop switches to [backdrop2 v]\nforever\n    if <touching (spectra v)?> then\n        broadcast (fail v)\n        set [yv v] to [0]\n        switch costume to (costume1 v)\n        go to x: (-223) y: (-106)\n        wait until <not <(x position) > [218]>>\n    end\nend\n\nwhen backdrop switches to [backdrop3 v]\nforever\n    go to [front v] layer\n    if <(move?) = [yes]> then\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            switch costume to (costume1 v)\n            change [xv v] by (1)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            switch costume to (costume2 v)\n            change [xv v] by (-1)\n        end\n        set [xv v] to ((Xv) * (0.9))\n        change x by (Xv)\n        if <touching color (#00ff55)?> then\n            change y by (1)\n            if <touching color (#00ff55)?> then\n                change y by (1)\n                if <touching color (#00ff55)?> then\n                    change y by (1)\n                    if <touching color (#00ff55)?> then\n                        change y by (1)\n                        if <touching color (#00ff55)?> then\n                            change y by (1)\n                            if <touching color (#00ff55)?> then\n                                change x by ((Xv) * (-1))\n                                change y by (-5)\n                                set [xv v] to [0]\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 color (#00ff55)?> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <touching color (#00ff55)?> then\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                set [yv v] to [14]\n            end\n        end\n        change y by (1)\n        if <touching color (#ff00bf)?> then\n            set [yv v] to [22]\n        end\n    end\nend\n\nwhen backdrop switches to [backdrop2 v]\nforever\n    if <touching (evil rays v)?> then\n        change [xv v] by (-35)\n    end\nend\n\nwhen I receive [fightpt2 v]\nforever\n    if <(fight) = [2]> then\n        wait until <touching (spectrorb v)?>\n        broadcast (realwinner! v)\n        set [move? v] to [no]\n        wait (0.01) seconds\n        stop [this script v]\n    end\nend\n\nwhen backdrop switches to [backdrop3 v]\nhide\ngo to x: (-181) y: (-50)\nwait (1.5) seconds\nshow\nset [xv v] to [0]\ngo to x: (-181) y: (-50)\nset [move? v] to [yes]\nwait (0.5) seconds\nset [xv v] to [0]\n\n@text\n\nwhen I receive [start project v]\nshow\nswitch costume to (backdrop1 v)\ngo to [front v] layer\ngo [backward v] (10) layers\ngo to x: (0) y: (0)\nwait until <(level) = [5]>\nhide\n\nwhen backdrop switches to [backdrop3 v]\nshow\nswitch costume to (backdrop6 v)\n\nwhen I receive [nextlvl v]\nnext costume\nif <(level) = [15]> then\n    show\n    go to [front v] layer\n    switch costume to (backdrop5 v)\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [16]> then\n    hide\nend\n\n@ground\n\nwhen I receive [start project v]\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo to [front v] layer\nswitch costume to (costume1 v)\nset [color v] effect to (pick random (0) to (200))\n\nwhen I receive [nextlvl v]\nwait (0.01) seconds\nif <(level) = [16]> then\n    switch costume to (costume16 v)\n    clear graphic effects\n    clear graphic effects\nend\n\nwhen backdrop switches to [backdrop3 v]\nhide\n\nwhen I receive [nextlvl v]\nset [color v] effect to (pick random (0) to (200))\nnext costume\nif <(level) = [6]> then\n    wait (0.01) seconds\n    go to [front v] layer\nend\nif <(level) = [11]> then\n    set [color v] effect to (150)\nend\nif <(level) = [13]> then\n    set [color v] effect to (0)\nend\nif <(level) = [14]> then\n    set [color v] effect to (0)\nend\nif <(level) > [16]> then\n    clear graphic effects\nend\n\n@ground2\n\nwhen I receive [start project v]\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\nswitch costume to (costume1 v)\nset [color v] effect to (pick random (0) to (200))\n\nwhen I receive [nextlvl v]\nset [color v] effect to (pick random (0) to (200))\nnext costume\nif <(level) = [5]> then\n    go [backward v] (10) layers\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [10]> then\n    stop [other scripts in sprite v]\n    go to x: (0) y: (0)\n    set [color v] effect to (0)\nend\nif <(level) = [11]> then\n    set [color v] effect to (75)\nend\nif <(level) = [12]> then\n    set [color v] effect to (68)\nend\nif <(level) = [13]> then\n    set [color v] effect to (140)\n    go to [front v] layer\n    repeat until <(level) = [14]>\n        glide (3) secs to x: (389) y: (0)\n        wait (1) seconds\n        glide (3) secs to x: (0) y: (0)\n        wait (1) seconds\n    end\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [14]> then\n    go to x: (0) y: (0)\n    set [color v] effect to (75)\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [16]> then\n    hide\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [17]> then\n    hide\nend\n\n@bad stuff\n\nwhen I receive [start project v]\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo to [front v] layer\ngo to [front v] layer\nswitch costume to (costume1 v)\nset [color v] effect to (pick random (0) to (200))\n\nwhen I receive [nextlvl v]\nif <(level) = [15]> then\n    hide\n    stop [other scripts in sprite v]\nend\n\nwhen I receive [nextlvl v]\nnext costume\nset [color v] effect to (pick random (0) to (200))\nif <(level) = [5]> then\n    go [backward v] (10) layers\nend\nif <(level) = [6]> then\n    go to [front v] layer\nend\nif <(level) = [10]> then\n    set [color v] effect to (0)\nend\nif <(level) = [11]> then\n    wait (0.01) seconds\n    go to [front v] layer\n    set [color v] effect to (150)\nend\nif <(level) = [13]> then\n    set [color v] effect to (75)\nend\nif <(level) = [14]> then\n    go to [front v] layer\n    set [color v] effect to (140)\n    go to x: (0) y: (0)\n    repeat until <(level) = [15]>\n        glide (1) secs to x: (-70) y: (0)\n        glide (1) secs to x: (70) y: (0)\n    end\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [16]> then\n    hide\nend\nif <(level) > [16]> then\n    clear graphic effects\nend\n\nwhen backdrop switches to [backdrop3 v]\nhide\n\nwhen I receive [nextlvl v]\nif <(level) = [17]> then\n    hide\nend\n\n@bad stuff2\n\nwhen I receive [nextlvl v]\nnext costume\nset [color v] effect to (pick random (0) to (200))\nif <(level) = [10]> then\n    wait (0.01) seconds\n    go [backward v] (10) layers\nend\n\nwhen I receive [start project v]\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo to [front v] layer\ngo to [front v] layer\nswitch costume to (costume1 v)\nset [color v] effect to (pick random (0) to (200))\n\nwhen I receive [nextlvl v]\nif <(level) = [16]> then\n    hide\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [17]> then\n    hide\nend\n\n@nothing\n\nwhen I receive [start project v]\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo [backward v] (10) layers\nswitch costume to (costume1 v)\nset [color v] effect to (pick random (0) to (200))\n\nwhen I receive [nextlvl v]\nset [color v] effect to (pick random (0) to (200))\nnext costume\nif <(level) = [12]> then\n    set [color v] effect to (68)\n    wait (0.01) seconds\n    go to [front v] layer\nend\nif <(level) = [15]> then\n    go [backward v] (10) layers\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [16]> then\n    hide\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [17]> then\n    hide\nend\n\n@bouncy stuff\n\nwhen I receive [start project v]\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo to [front v] layer\nswitch costume to (costume1 v)\nset [color v] effect to (pick random (0) to (200))\n\nwhen I receive [nextlvl v]\nset [color v] effect to (pick random (0) to (200))\nnext costume\nif <(level) = [13]> then\n    set [color v] effect to (190)\n    go [backward v] (10) layers\nend\nif <(level) = [14]> then\n    set [color v] effect to (190)\n    go [backward v] (10) layers\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [16]> then\n    hide\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [17]> then\n    hide\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\ngo to x: (90) y: (0)\nclear graphic effects\nset [ghost v] effect to (70)\nforever\n    change [color v] effect by (3)\nend\n\nwhen I receive [nextlvl v]\nif <(level) = [15]> then\n    show\n    go to [front v] layer\n    switch costume to (costume1 v)\nend\nif <(level) = [16]> then\n    go to x: (0) y: (0)\n    switch costume to (costume2 v)\n    go to [front v] layer\nend\n\nwhen backdrop switches to [backdrop3 v]\nhide\n\n@Spectra\n\ndefine None\nif <(speech_mode) = [1]> then\n    set [output v] to []\n    set [counter v] to [1]\n    repeat (length of (text))\n        set [output v] to (join (Output) (letter (Counter) of (text)))\n        change [counter v] by (1)\n        say (Output)\n        start sound [Low Talk v]\n        wait (speed) seconds\n    end\n    wait until <key (space v) pressed?>\n    say []\n    stop [this script v]\nelse\n    set [output v] to []\n    set [counter v] to [1]\n    repeat (length of (text))\n        set [output v] to (join (Output) (letter (Counter) of (text)))\n        change [counter v] by (1)\n        say (Output)\n        start sound [Low Talk v]\n        wait (speed) seconds\n    end\n    wait ((10) * (speed)) seconds\n    say []\n    stop [this script v]\nend\n\nwhen backdrop switches to [backdrop2 v]\nshow\ngo to x: (179) y: (-10)\nSpeech [Hey! Who are you? How did you get here?] (0.001)\nSpeech [.........Never mind. I'll dispose of you myself.] (0.001)\nbroadcast (next speech v)\n\nwhen backdrop switches to [backdrop3 v]\nhide\n\nwhen I receive [nextnextspeech v]\nSpeech [Mwahahaha!] (0.001)\nset [move? v] to [yes]\nset [fight v] to [1]\nbroadcast (fight v)\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\nset [speech_mode v] to [1]\n\nwhen I receive [winner! v]\nswitch costume to (costume2 v)\nwait (0.5) seconds\nswitch costume to (costume1 v)\nset [speech_mode v] to [2]\nSpeech [Not on my watch!] (0.05)\nbroadcast (fightpt2 v)\n\nwhen I receive [realwinner! v]\nset [move? v] to [no]\nset [fightstat v] to [complete]\nswitch costume to (costume2 v)\nwait (0.5) seconds\nswitch costume to (costume4 v)\nSpeech [Noooooooo!!] (0.05)\nSpeech [I could have ruled this place!] (0.05)\nSpeech [The colors are returning to normal! Why--] (0.05)\nbroadcast (-> v)\n\nwhen flag clicked\nset [fightstat v] to [incomplete]\n\n@spectrorb\n\nwhen flag clicked\nhide\nforever\n    change [color v] effect by (2)\nend\n\nwhen backdrop switches to [backdrop2 v]\nshow\ngo to x: (99) y: (-41)\n\nwhen backdrop switches to [backdrop3 v]\nhide\n\n@pedestal\n\nwhen flag clicked\nhide\ngo to x: (0) y: (52)\n\nwhen backdrop switches to [backdrop2 v]\nshow\ngo [backward v] (10) layers\n\nwhen backdrop switches to [backdrop3 v]\nhide\n\n@Sprite2\n\nwhen I receive [realwinner! v]\nshow\nrepeat (300)\n    change [ghost v] effect by (-0.4)\nend\nset [ghost v] effect to (0)\nswitch backdrop to (backdrop3 v)\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@new levels\n\nwhen flag clicked\nhide\n\nwhen I receive [nextlvl v]\nnext costume\n\nwhen backdrop switches to [backdrop3 v]\nshow\ngo to x: (0) y: (0)\nswitch costume to (costume5 v)\n\n@Sprite3\n\nwhen I receive [start project v]\nhide\nforever\n    create clone of (_myself_ v)\n    wait (pick random (1) to (3)) seconds\nend\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (pick random (30) to (60))\nswitch costume to (pick random (1) to (4))\nset [y v] to (pick random (-172) to (180))\ngo to x: (249) y: (y)\nglide (pick random (5) to (5.7)) secs to x: (-298) y: (y)\nhide\n\nwhen flag clicked\nforever\n    go [backward v] (1) layers\nend\n\n@Sprite4\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop2 v]\nshow\ngo to x: (0) y: (0)\ngo [backward v] (10) layers\n\nwhen backdrop switches to [backdrop3 v]\nhide\n\n@evil rays\n\nwhen flag clicked\nhide\n\nwhen I receive [fight v]\nwait (0.01) seconds\nrepeat until <(move?) = [no]>\n    create clone of (_myself_ v)\n    wait (pick random (0.5) to (1)) seconds\nend\n\nwhen I receive [fightpt2 v]\nwait (0.01) seconds\nrepeat (20)\n    create clone of (_myself_ v)\n    wait (0.1) seconds\n    set [move? v] to [yes]\nend\nset [fight v] to [2]\nwait (2) seconds\nrepeat until <<(move?) = [no]> and <(fight) = [2]>>\n    repeat (10)\n        create clone of (_myself_ v)\n        wait (0.1) seconds\n    end\n    wait (2) seconds\nend\n\nwhen I receive [winner! v]\nstop [other scripts in sprite v]\nwait (0.01) seconds\nhide\n\nif <(fight) = [1]> then\nelse\n    show\n    switch costume to (costume1 v)\n    go to x: (129) y: (-12)\n    point towards (player v)\n    repeat until <<touching (player v)?> or <<touching (ground v)?> or <touching (_edge_ v)?>>>\n        move (10) steps\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nshow\nswitch costume to (costume1 v)\ngo to x: (129) y: (-12)\npoint towards (player v)\nrepeat until <<touching (player v)?> or <<touching (ground v)?> or <touching (_edge_ v)?>>>\n    move (10) steps\nend\ndelete this clone\n\n@thumbnail\n\nwhen flag clicked\nhide\ngo to x: (4) y: (-1)\n\n