Abducted -  platformer | Game jam entry | Games

Instructions: IF LAGGING PLAY HERE:    turbowarp.org/556974726/\nthis is an entry for @radscience 's game jam\n\n\nAliens have abducted you. You need to escape the aliens spaceship.\n\n          How To Play:\n•  Use wasd or arrows to move\n•  don't touch the spikes\n•  collect coins if you want\n\n                  Credits:\n•  credit to @griffpatch for the scrolling platformer code\n•  thumbnail code by @StratfordJames\n•  music from fesliyanstudios.com\n•  all art is made by me\n\n\n\n\n

@Stage\n\nwhen flag clicked\nbroadcast (start v)\nforever\n    play sound [2020-03-22_-_A_Bit_Of_Hope_-_David_Fesliyan v] until done\nend\n\n@player\n\ndefine scroll to player\nchange [scroll x v] by ([floor v] of (((x) - (SCROLL X)) / (7)) )\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (7)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\n\nwhen I receive [start v]\nset [checkpoint v] to [1]\nset [exit v] to []\nforever\n    setup\n    set [exit v] to []\n    broadcast (clone coins v)\n    repeat until <(EXIT) > []>\n        tick\n        scroll to player\n        test die\n        position\n        broadcast (TICK v)\n    end\n    if <(EXIT) = [oof]> then\n        start sound [lose v]\n        set [shake v] to [5]\n        wait (1) seconds\n    end\n    if <(EXIT) = [win]> then\n        repeat (10)\n            change [ghost v] effect by (10)\n            change size by (-10)\n        end\n        wait (1) seconds\n        change [level v] by (1)\n    end\nend\n\ndefine change frame\n\nif <(key walk) = [0]> then\n    change [frame v] by (1)\n    wait (0.23) seconds\n    stop [this script v]\nend\nchange [frame v] by (1)\nwait (0.1) seconds\n\ndefine change y by (sy)\nswitch costume to (hitbox v)\nchange [y v] by (sy)\nchange [in air v] by (1)\nposition\nrepeat until <not <touching (level v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        set [in air v] to [0]\n        change [y v] by (1)\n    end\n    position\n    set [sy v] to [0]\nend\nset costume\n\ndefine change x by (sx)\nswitch costume to (hitbox v)\nchange [x v] by (round (sx))\nposition\nrepeat until <not <touching (level v)?>>\n    if <(sx) > [0]> then\n        change [x v] by (-1)\n    else\n        change [x v] by (1)\n    end\n    position\n    set [sx v] to [0]\nend\nset costume\n\ndefine tick\nchange [sy v] by (-3)\nchange y by (sy)\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    if <(in air) < [1]> then\n        set [sy v] to [23]\n        start sound [jump v]\n    end\nend\nset [sx v] to (((sx) + ((key walk) * (5))) * (0.6))\nchange x by (sx)\nif <not <(key walk) = [0]>> then\n    point in direction ((key walk) * (90))\n    set rotation style [left-right v]\nend\n\nwhen flag clicked\npoint in direction (90)\ngo to x: (0) y: (-1)\ngo to [front v] layer\n\nwhen I receive [start v]\nforever\n    change frame\nend\n\ndefine test die\nif <(y) < [-200]> then\n    set [exit v] to [oof]\nend\nif <touching (danger v)?> then\n    set [exit v] to [oof]\nend\n\ndefine setup\nset [sx v] to [0]\nset [sy v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [ghost v] effect to (0)\nset size to (500) %\nposition\nbroadcast (TICK v)\nif <(LEVEL) = [4]> then\n    broadcast (win v)\nend\n\ndefine position\ngo to x: ((round ((x) - (SCROLL X))) + (SHAKE X)) y: ((round ((y) - (SCROLL Y))) + (SHAKE Y))\nif <<(x position) = ((round ((x) - (SCROLL X))) + (SHAKE X))> and <(y position) = ((round ((y) - (SCROLL Y))) + (SHAKE Y))>> then\n    show\nelse\n    hide\nend\n\ndefine set costume\nset [key walk v] to (<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>)\nif <(in air) > [0]> then\n    switch costume to (walk1 v)\n    stop [this script v]\nend\nif <(key walk) = [0]> then\n    switch costume to ((3) + ((frame) mod (2)))\n    stop [this script v]\nend\nswitch costume to ((1) + ((frame) mod (2)))\n\nwhen I receive [start v]\nforever\n    wait until <not <(in air) < [1]>>\n    wait until <(in air) < [1]>\n    set [clone x - particle v] to (x)\n    set [clone y - particle v] to ((y) - (20))\n    start sound [hit-thud v]\n    broadcast (clone particles v)\nend\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@levelart\n\nwhen I receive [tick v]\nposition\nswitch costume to (LEVEL)\n\ndefine position\ngo to x: ((round ((x) - (SCROLL X))) + (SHAKE X)) y: ((round ((y) - (SCROLL Y))) + (SHAKE Y))\nif <<(x position) = ((round ((x) - (SCROLL X))) + (SHAKE X))> and <(y position) = ((round ((y) - (SCROLL Y))) + (SHAKE Y))>> then\n    show\nelse\n    hide\nend\n\nwhen flag clicked\nset [level v] to [1]\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@danger\n\nwhen I receive [tick v]\nposition\nswitch costume to (LEVEL)\n\ndefine position\ngo to x: ((round ((x) - (SCROLL X))) + (SHAKE X)) y: ((round ((y) - (SCROLL Y))) + (SHAKE Y))\nif <<(x position) = ((round ((x) - (SCROLL X))) + (SHAKE X))> and <(y position) = ((round ((y) - (SCROLL Y))) + (SHAKE Y))>> then\n    show\nelse\n    hide\nend\n\nbroadcast (start v)\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@screen shake\n\nwhen I receive [start v]\nset [shake v] to [0]\nforever\n    set [shake x v] to (pick random ((SHAKE) * (-1)) to (SHAKE))\n    set [shake y v] to (pick random ((SHAKE) * (-1)) to (SHAKE))\nend\n\nwhen I receive [start v]\nforever\n    repeat until <(SHAKE) = [0]>\n        wait (0.05) seconds\n        broadcast (TICK v)\n        change [shake v] by (-1)\n    end\nend\n\n@door\n\nwhen I receive [tick v]\nposition\nif <touching (player v)?> then\n    switch costume to ((costume [number v]) + (((17) - (costume [number v])) / (4)))\n    if <(costume [number v]) = [16]> then\n        set [exit v] to [win]\n    end\nelse\n    switch costume to ((costume [number v]) + (((-1) - (costume [number v])) / (4)))\nend\nif <(LEVEL) = [1]> then\n    set [x v] to [1391]\n    set [y v] to [-87]\nelse\n    if <(LEVEL) = [2]> then\n        set [x v] to [2053]\n        set [y v] to [-130]\n    else\n        set [x v] to [1782]\n        set [y v] to [-92]\n    end\nend\n\ndefine position\ngo to x: ((round ((x) - (SCROLL X))) + (SHAKE X)) y: ((round ((y) - (SCROLL Y))) + (SHAKE Y))\nif <<(x position) = ((round ((x) - (SCROLL X))) + (SHAKE X))> and <(y position) = ((round ((y) - (SCROLL Y))) + (SHAKE Y))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [start v]\nshow\nset [x v] to [1391]\nset [y v] to [-87]\n\nwhen [space v] key pressed\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [,] (join [ ] ((mouse y) + (SCROLL Y)))))\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@level\n\nwhen I receive [tick v]\nposition\nswitch costume to (LEVEL)\nset [ghost v] effect to (100)\n\ndefine position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\nif <<(x position) = (round ((x) - (SCROLL X)))> and <(y position) = (round ((y) - (SCROLL Y)))>> then\n    show\nelse\n    hide\nend\n\nbroadcast (start v)\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@coin\n\nwhen I receive [tick v]\nposition\ngo to [back v] layer\nif <(distance to [player v]) < [40]> then\n    set [collected v] to [yes]\nend\nif <touching (player v)?> then\n    start sound [coin v]\n    set [shake v] to [1]\n    set [clone x v] to (x)\n    set [clone y v] to (y)\n    create clone of (coin_fx v)\n    delete this clone\nend\nif <(collected) = [yes]> then\n    change [x v] by ([floor v] of ((([x v] of [player v]) - (x)) / (6)) )\n    change [y v] by ([floor v] of ((([y v] of [player v]) - (y)) / (6)) )\nend\n\ndefine position\ngo to x: ((round ((x) - (SCROLL X))) + (SHAKE X)) y: ((round ((y) - (SCROLL Y))) + (SHAKE Y))\nif <<(x position) = ((round ((x) - (SCROLL X))) + (SHAKE X))> and <(y position) = ((round ((y) - (SCROLL Y))) + (SHAKE Y))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [clone coins v]\nclone\n\nwhen I receive [delete v]\ndelete this clone\n\ndefine clone at (x) (y)\nset [collected v] to [no]\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nset [x v] to [-999999999]\n\ndefine clone\nbroadcast (delete v)\nif <(LEVEL) = [1]> then\n    clone at [197] [30]\n    clone at [167] [30]\n    clone at [227] [30]\n    clone at [1235] [25]\n    clone at [1265] [15]\n    clone at [1205] [15]\nelse\n    if <(LEVEL) = [2]> then\n        clone at [325] [9]\n        clone at [180] [9]\n        clone at [1140] [135]\n        clone at [1160] [125]\n        clone at [1120] [125]\n        clone at [1650] [14]\n        clone at [1620] [14]\n        clone at [1680] [14]\n    else\n        clone at [165] [27]\n        clone at [195] [27]\n        clone at [135] [27]\n        clone at [485] [154]\n        clone at [515] [154]\n        clone at [455] [154]\n    end\nend\n\nwhen I start as a clone\nforever\n    switch costume to (COIN - costume)\nend\n\nwhen flag clicked\nforever\n    change [coin - costume v] by (1)\n    wait (0.08) seconds\nend\n\nnext costume\nwait (0.08) seconds\n\nbroadcast (clone coins v)\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@coin_fx\n\ndefine position\ngo to x: ((round ((x) - (SCROLL X))) + (SHAKE X)) y: ((round ((y) - (SCROLL Y))) + (SHAKE Y))\nif <<(x position) = ((round ((x) - (SCROLL X))) + (SHAKE X))> and <(y position) = ((round ((y) - (SCROLL Y))) + (SHAKE Y))>> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (0)\nset [x v] to (CLONE X)\nset [y v] to (CLONE Y)\nrepeat (10)\n    position\n    change [ghost v] effect by (10)\n    change size by (10)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@particle_fx\n\ndefine position\ngo to x: ((round ((x) - (SCROLL X))) + (SHAKE X)) y: ((round ((y) - (SCROLL Y))) + (SHAKE Y))\nif <<(x position) = ((round ((x) - (SCROLL X))) + (SHAKE X))> and <(y position) = ((round ((y) - (SCROLL Y))) + (SHAKE Y))>> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nset [x v] to ((CLONE X - particle) + (pick random (-5) to (5)))\nset [y v] to (CLONE Y - particle)\nshow\nset [xv v] to (pick random (-1) to (1))\nset [yv v] to (pick random (0.1) to (1))\nrepeat (10)\n    position\n    go to [front v] layer\n    change [ghost v] effect by (10)\n    change [x v] by (xv)\n    change [y v] by (yv)\nend\ndelete this clone\n\ndefine clone\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [clone particles v]\nclone\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\n@win\n\nwhen I receive [win v]\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\ngo to [front v] layer\nforever\n    set size ((700) + (([sin v] of ((timer) * (250)) ) * (30)))\n    set y to (([sin v] of ((timer) * (100)) ) * (10))\nend\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\ndefine set size (s)\nswitch costume to (1 v)\nset size to (s) %\nswitch costume to (costume1 v)\n\n@thumb\n\nwhen flag clicked\nhide\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.0000000000001)\ngo to [front v] layer\nshow\n\n