Ninja - A Mobile Platformer

Instructions: [Arrow Keys] or [WASD] - Move\n[Space] - Shoot

@Stage\n\nwhen flag clicked\nswitch backdrop to (intro v)\n\nwhen I receive [before start v]\nswitch backdrop to (backdrop1 v)\nforever\n    play sound [Unknown Brain - Say Goodbye \(feat v] until done\nend\n\n@guy\n\ndefine fast\nrepeat (6)\n    if <touching (levels v)?> then\n        change y by (1)\n    end\nend\n\ndefine xcoll\nrepeat until <not <touching (levels v)?>>\n    if <(x) > [0]> then\n        change x by (-1)\n    else\n        change x by (1)\n    end\nend\n\ndefine ycoll\nrepeat until <not <touching (levels v)?>>\n    if <(y) > [0]> then\n        change y by (-1)\n    else\n        change y by (1)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [done v]\nset [y v] to [0]\nset [x v] to [0]\ngo to x: (-210) y: (-80)\nswitch costume to (guyfront v)\n\nwhen I receive [before start v]\nset size to (23) %\npoint in direction (90)\nset rotation style [left-right v]\nset [x v] to [0]\nset [y v] to [0]\ngo to x: (-200) y: (-80)\nshow\nforever\n    switch costume to (box v)\n    change [y v] by (-1)\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        point in direction (90)\n        change [x v] by (1)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        point in direction (-90)\n        change [x v] by (-1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (levels v)?> then\n        fast\n        if <touching (levels v)?> then\n            change y by (-6)\n            xcoll\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n                set [y v] to [12]\n                if <([abs v] of (x) ) = (x)> then\n                    set [x v] to [-8]\n                else\n                    set [x v] to [8]\n                end\n            else\n                set [x v] to [0]\n            end\n        end\n    end\n    change y by (y)\n    if <touching (levels v)?> then\n        ycoll\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> and <(y) < [0]>> then\n            set [y v] to [13]\n        else\n            set [y v] to [0]\n        end\n    end\n    if <<<(x position) > [240]> or <key (p v) pressed?>> and <not <([costume # v] of [levels v]) = [20]>>> then\n        broadcast (done v)\n        wait until <not <key (p v) pressed?>>\n    end\n    if <<touching (spikes v)?> or <touching (bad guys v)?>> then\n        broadcast (ded v)\n        start sound [Crunch v]\n        set [y v] to [0]\n        set [x v] to [0]\n        go to x: (-210) y: (0)\n        point in direction (90)\n    end\n    set [direc v] to (direction)\n    if <touching (tramps v)?> then\n        set [y v] to [20]\n    end\n    if <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n        switch costume to (guy v)\n    end\n    if <not <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>>> then\n        switch costume to (guyfront v)\n    end\nend\n\n@Levels\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\n\nwhen I receive [done v]\nnext costume\n\nwhen I receive [before start v]\nswitch costume to (costume1 v)\nshow\n\n@Spikes\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\n\nwhen I receive [done v]\nnext costume\n\nwhen I receive [before start v]\nswitch costume to (costume1 v)\nshow\n\n@deco and storyline\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [done v]\nnext costume\n\nwhen I receive [before start v]\nshow\nswitch costume to (costume1 v)\n\n@Bad Guys\n\nwhen flag clicked\nhide\nwait (1) seconds\nwait until <([costume # v] of [levels v]) = [9]>\ninsert bninja at [120] [50]\ninsert bninja at [-90] [-30]\nwait until <([costume # v] of [levels v]) = [10]>\ninsert bninja at [0] [-89]\ninsert bninja at [0] [35]\ninsert bninja at [0] [157]\nwait until <([costume # v] of [levels v]) = [11]>\ninsert bninja at [-50] [120]\ninsert bninja at [180] [120]\nwait until <([costume # v] of [levels v]) = [12]>\ninsert bninja at [-140] [120]\ninsert bninja at [150] [120]\nwait until <([costume # v] of [levels v]) = [13]>\ninsert bninja at [-240] [157]\ninsert bninja at [0] [172]\nwait until <([costume # v] of [levels v]) = [14]>\ninsert bninja at [85] [172]\nwait until <([costume # v] of [levels v]) = [17]>\ninsert bninja at [85] [147]\ninsert bninja at [-30] [66]\ninsert bninja at [-145] [-16]\nwait until <([costume # v] of [levels v]) = [18]>\ninsert bninja at [-20] [169]\ninsert bninja at [90] [58]\ninsert bninja at [130] [-89]\ninsert bninja at [-70] [58]\n\ndefine insert bninja at (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nset size to (23) %\npoint in direction (90)\nset rotation style [left-right v]\nforever\n    repeat (20)\n        point in direction (90)\n        change x by (2)\n    end\n    wait (1) seconds\n    repeat (20)\n        point in direction (-90)\n        change x by (-2)\n    end\n    wait (1) seconds\nend\n\nwhen I receive [done v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <touching (shuriken v)?> then\n        start sound [Squish Pop v]\n        delete this clone\n    end\nend\n\nwhen I receive [ded v]\ndelete\nif <([costume # v] of [levels v]) = [9]> then\n    insert bninja at [120] [50]\n    insert bninja at [-90] [-30]\nend\nif <([costume # v] of [levels v]) = [10]> then\n    insert bninja at [0] [-89]\n    insert bninja at [0] [35]\n    insert bninja at [0] [157]\nend\nif <([costume # v] of [levels v]) = [11]> then\n    insert bninja at [-50] [120]\n    insert bninja at [180] [120]\nend\nif <([costume # v] of [levels v]) = [12]> then\n    insert bninja at [-140] [120]\n    insert bninja at [150] [120]\nend\nif <([costume # v] of [levels v]) = [13]> then\n    insert bninja at [-240] [157]\n    insert bninja at [0] [172]\nend\nif <([costume # v] of [levels v]) = [14]> then\n    insert bninja at [85] [172]\nend\nif <([costume # v] of [levels v]) = [17]> then\n    insert bninja at [85] [147]\n    insert bninja at [-30] [66]\n    insert bninja at [-145] [-16]\nend\nif <([costume # v] of [levels v]) = [18]> then\n    insert bninja at [-20] [169]\n    insert bninja at [90] [58]\n    insert bninja at [130] [-89]\n    insert bninja at [-70] [58]\nend\n\ndefine delete\ndelete this clone\n\n@Tramps\n\ndefine insert bouncy at (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nswitch costume to (costume1 v)\nforever\n    if <touching (guy v)?> then\n        start sound [Boing v]\n        repeat (2)\n            next costume\n        end\n        repeat (2)\n            switch costume to ((costume [number v]) - (1))\n        end\n    end\nend\n\nwhen flag clicked\nhide\npoint in direction (90)\ngo to [back v] layer\nwait (1) seconds\nwait until <([costume # v] of [levels v]) = [8]>\ninsert bouncy at [-150] [-100]\nwait until <([costume # v] of [levels v]) = [10]>\ninsert bouncy at [-150] [-100]\nwait until <([costume # v] of [levels v]) = [11]>\ninsert bouncy at [-140] [-100]\ninsert bouncy at [80] [-100]\nwait until <([costume # v] of [levels v]) = [13]>\ninsert bouncy at [-110] [-100]\nwait until <([costume # v] of [levels v]) = [15]>\ninsert bouncy at [140] [-100]\ninsert bouncy at [-120] [-100]\ninsert bouncy at [10] [-100]\n\nwhen I receive [done v]\ndelete this clone\n\n@Rando Bando clouds\n\nwhen flag clicked\nhide\nforever\n    set [side v] to (pick random (1) to (2))\n    create clone of (_myself_ v)\n    wait (pick random (5) to (10)) seconds\nend\n\nwhen I start as a clone\nset [ghost v] effect to (10)\nshow\ngo to [back v] layer\nswitch costume to (pick random (1) to (4))\nif <(side) = [1]> then\n    go to x: (300) y: (pick random (150) to (50))\n    repeat until <(x position) < [-250]>\n        change x by (-1)\n    end\n    delete this clone\nend\nif <(side) = [2]> then\n    go to x: (-300) y: (pick random (150) to (50))\n    repeat until <(x position) > [250]>\n        change x by (1)\n    end\n    delete this clone\nend\n\n@Stuff\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to [back v] layer\nset [ghost v] effect to (pick random (30) to (70))\ngo to x: (270) y: (pick random (-100) to (180))\nset size to (pick random (40) to (100)) %\nglide (pick random (2) to (3)) secs to x: (-250) y: (pick random (-100) to (180))\ndelete this clone\n\nwhen I receive [before start v]\nforever\n    create clone of (_myself_ v)\n    wait (0.2) seconds\nend\n\n@skip\n\nwhen flag clicked\nhide\n\nwhen I receive [before start v]\nshow\nset size to (100) %\nset [zine v] to [0]\ngo to x: (-180) y: (-145)\nforever\n    change [zine v] by (1)\n    point in direction ((90) + (([sin v] of ((zine) * (8)) ) * (3)))\n    if <touching (mouse-pointer v)?> then\n        change size by (((110) - (size)) / (2))\n    else\n        change size by (((100) - (size)) / (4))\n    end\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        repeat until <<not <touching (mouse-pointer v)?>> or <not <mouse down?>>>\n            change [zine v] by (1)\n            point in direction ((90) + (([sin v] of ((zine) * (5)) ) * (3)))\n            change size by (((90) - (size)) / (2))\n        end\n        set size to (100) %\n        wait (0) seconds\n        if <touching (mouse-pointer v)?> then\n            broadcast (done v)\n        end\n    end\nend\n\nwhen I receive [before start v]\nforever\n    if <([costume # v] of [levels v]) = [20]> then\n        go to x: (4598234759234) y: (32453245234)\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    else\n        go to x: (-180) y: (-145)\n        show\n    end\nend\n\n@Shuriken\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nset rotation style [all around v]\nswitch costume to (shuriken v)\nif <([direction v] of [guy v]) = [90]> then\n    repeat until <(x position) > [240]>\n        turn right (30) degrees\n        change x by (30)\n    end\n    delete this clone\nend\nif <([direction v] of [guy v]) = [-90]> then\n    repeat until <(x position) < [-240]>\n        turn right (-30) degrees\n        change x by (-30)\n    end\n    delete this clone\nend\n\nwhen I receive [before start v]\nforever\n    go to (guy v)\n    if <<key (space v) pressed?> or <<mouse down?> and <touching (mouse-pointer v)?>>> then\n        start sound [sfx_wing v]\n        set size to (100) %\n        create clone of (_myself_ v)\n        wait (0.5) seconds\n    end\nend\n\n@trail\n\nwhen I start as a clone\nif <(size) = [23]> then\n    show\n    set [brightness v] effect to (100)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [before start v]\ngo to (guy v)\ngo to [back v] layer\nset size to (23) %\nforever\n    go to (guy v)\n    set size to (23) %\n    create clone of (_myself_ v)\nend\n\n@Thumb\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\n    show\n    go to [front v] layer\nend\n\n@Intro\n\nwhen I start as a clone\nif <(size) = [70]> then\n    show\n    go to x: (0) y: (-110)\n    set [ghost v] effect to (100)\n    set size to (100) %\n    go to [front v] layer\n    switch costume to (corpcooga v)\n    repeat (5)\n        change [ghost v] effect by (-20)\n    end\n    wait (0.5) seconds\n    repeat (10)\n        wait (0.01) seconds\n        change [ghost v] effect by (10)\n    end\nend\n\nwhen flag clicked\nwait until <mouse down?>\nwait until <not <mouse down?>>\nstop all sounds\nstart sound [Teleport v]\nhide\nbroadcast (before start v)\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen flag clicked\nset volume to (100) %\nstart sound [Intro music v]\nshow\ngo to [front v] layer\ngo to x: (-240) y: (0)\npoint in direction (-150)\nswitch costume to (op v)\nset [ghost v] effect to (100)\nset [vel v] to [30]\nset size to (30) %\nrepeat until <(x position) = [0]>\n    change x by (vel)\n    turn right (vel) degrees\n    change [ghost v] effect by ((vel) * (-0.5))\n    change size by ((vel) / (6))\n    change [vel v] by (-2)\nend\nset size to (71) %\ncreate clone of (_myself_ v)\nset size to (70) %\ncreate clone of (_myself_ v)\nrepeat (15)\n    set [bounce v] to (((bounce) * (0.7)) + ((80.5) - (size)))\n    change size by (bounce)\nend\nset size to (80) %\nwait (0.2) seconds\npoint in direction (90)\nset [sine v] to [0]\nrepeat (15)\n    point in direction ((90) + (([tan v] of ((sine) * (8)) ) * (10)))\nend\npoint in direction (90)\nset [size vel v] to [18]\nrepeat until <(size vel) < [2]>\n    change [size vel v] by (-2)\n    change size by (size vel)\n    turn left ((size vel) * (4)) degrees\nend\nset [sine v] to [0]\nrepeat until <(x position) < [0]>\n    set x to (([tan v] of ((sine) * (8)) ) * (20))\n    turn right (([tan v] of ((sine) * (8)) ) * (20)) degrees\nend\nrepeat until <(x position) > [0]>\n    set x to (([tan v] of ((sine) * (8)) ) * (20))\n    turn right (((90) - (direction)) / (3)) degrees\nend\nrepeat until <(size vel) < [-17]>\n    change [size vel v] by (-2)\n    change size by ((size vel) / (1.25))\n    turn left ((size vel) * (4)) degrees\nend\npoint in direction (90)\nset x to (0)\nwait (0.5) seconds\ncreate clone of (_myself_ v)\nwait (0.9) seconds\nhide\nwait (1) seconds\nstop [other scripts in sprite v]\nbroadcast (before start v)\n\nwhen I start as a clone\nif <(size) = [80]> then\n    set [sizevel v] to [30]\n    go to x: (0) y: (0)\n    switch costume to (costume1 v)\n    set size to (30) %\n    show\n    go to [front v] layer\n    repeat (30)\n        switch costume to (hax v)\n        change size by (sizevel)\n        change [sizevel v] by (-1)\n        switch costume to (costume1 v)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(size) = [71]> then\n    set size to (100) %\n    go to [front v] layer\n    switch costume to (poof-0 v)\n    repeat (13)\n        wait (0.005) seconds\n        next costume\n    end\n    delete this clone\nend\n\nwhen flag clicked\nforever\n    change [sine v] by (1)\nend\n\nwhen I start as a clone\nforever\n    if <mouse down?> then\n        delete this clone\n    end\nend\n\n