Skywalker || A Platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (logo v)\nset volume to (200) %\nstart sound [Star Wars v]\n\nwhen I receive [next level v]\nbroadcast (setup v) and wait\nnext backdrop\n\nwhen I receive [reboot level v]\nbroadcast (setup v) and wait\nswitch backdrop to (backdrop [number v])\n\nwhen [r v] key pressed\nset [player status v] to [die]\n\nwhen [s v] key pressed\nset [player status v] to [win]\n\nwhen [a v] key pressed\nif <<(backdrop [number v]) > [1]> and <(backdrop [number v]) < [14]>> then\n    switch backdrop to ((backdrop [number v]) - (1))\n    broadcast (spawn num v) and wait\n    set [enemy status v] to [die]\n    set [player status v] to [die]\nend\n\nwhen I receive [music v]\nset volume to (100) %\n\n    play sound [The Force Theme v] until done\nend\n\nwhen I receive [green flag v]\nswitch backdrop to (level-1 v)\nstop all sounds\nbroadcast (music v)\nbroadcast (setup v) and wait\nbroadcast (play game v) and wait\n\nwhen backdrop switches to [level-win v]\nbroadcast (End v) and wait\nstop [other scripts in sprite v]\nforever\n    play sound [End Title v] until done\nend\n\n@Blank\n\n@You\n\nwhen I receive [setup v]\nset [player status v] to []\nset [x velocity v] to [0]\nset [in air v] to [0]\nset [y velocity v] to [0]\nset rotation style [left-right v]\nswitch costume to (luke skywalker v)\nset [ghost v] effect to (0)\ngo to [front v] layer\nshow\n\nwhen I receive [play game v]\nset [spawn num v] to [1]\nforever\n    go to x: (item (spawn num) of [spawn x v]) y: (item (spawn num) of [spawn y v])\n    repeat until <(Player Status) > []>\n        run\n    end\n    if <(Player Status) = [win]> then\n        change [spawn num v] by (1)\n        broadcast (next level v) and wait\n    else\n        broadcast (reboot level v) and wait\n    end\nend\n\ndefine movement\ndivision x\ndivision y\nchange x by (round (x velocity))\nchange y by (y velocity)\n\ndefine division x\nif <key (left arrow v) pressed?> then\n    point in direction (-90)\n    x velocity [-1]\nend\nif <key (right arrow v) pressed?> then\n    point in direction (90)\n    x velocity [1]\nend\nfriction\n\ndefine division y\nif <<key (up arrow v) pressed?> and <(in air) < [8]>> then\n    y velocity [16]\n    change [in air v] by (1)\nend\ngravity\n\ndefine gravity\nchange [y velocity v] by (-2)\nchange [in air v] by (1)\n\ndefine get out of the ground\nif <touching color (#000000)?> then\n    if <(y velocity) > [0]> then\n        repeat until <not <touching color (#000000)?>>\n            change y by (-1)\n            set [y velocity v] to [0]\n        end\n    else\n        repeat until <not <touching color (#000000)?>>\n            change y by (1)\n            set [y velocity v] to [0]\n            set [in air v] to [0]\n        end\n    end\nend\n\ndefine x velocity (v)\nchange [x velocity v] by (v)\n\ndefine friction\nset [x velocity v] to ((x velocity) * (0.9))\n\ndefine y velocity (y)\nset [y velocity v] to (y)\n\ndefine change x by (x)\nchange x by (x)\nrepeat (8)\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\nend\nif <not <touching color (#000000)?>> then\n\ndefine change y by (y)\nchange y by (y)\nget out of the ground\n\ndefine did I win\nif <(x position) > [240]> then\n    set [player status v] to [win]\nend\n\ndefine test die\nif <<(y position) < [-180]> or <touching color (#603b00)?>> then\n    set [player status v] to [die]\nend\n\nwhen [m v] key pressed\nadd (mouse x) to [spawn x v]\nadd (mouse y) to [spawn y v]\nwait until <[51] = [50]>\n\nwhen I receive [spawn num v]\nchange [spawn num v] by (-1)\n\ndefine run\nmovement\nbroadcast (movement v) and wait\ndid I win\ntest die\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Lightsaber\n\nwhen I receive [setup v]\nhide\nset [in action v] to [0]\nif <<(backdrop [number v]) = [5]> and <not <(lightsaber) = [true]>>> then\n    show\nend\n\nwhen I receive [slash v]\nif <(in action) = [0]> then\n    set [in action v] to [1]\n    start sound (pick random (1) to (5))\n    point in direction ([direction v] of [you v])\n    go to (you v)\n    turn left (180) degrees\n    switch costume to (swing v)\n    show\n    repeat (12)\n        go to (you v)\n        turn right (12) degrees\n        create clone of (_myself_ v)\n        go to (you v)\n        turn right (12) degrees\n        create clone of (_myself_ v)\n        go to (you v)\n        turn right (12) degrees\n        create clone of (_myself_ v)\n    end\n    hide\n    wait (0.5) seconds\n    wait until <not <key (space v) pressed?>>\n    set [in action v] to [0]\nend\n\nwhen backdrop switches to [level-4 v]\nif <not <(lightsaber) = [true]>> then\n    point in direction (90)\n    go to x: (2) y: (58)\n    switch costume to (collect v)\n    show\n    wait until <touching (you v)?>\n    hide\n    broadcast (you go a... LIGHTSABER v) and wait\nend\n\nwhen I start as a clone\nwait (0.01) seconds\ndelete this clone\n\nset [in action v] to [0]\n\nwhen backdrop switches to [level-5 v]\nhide\nbroadcast (you go a... LIGHTSABER v) and wait\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Weapon Icon\n\nwhen flag clicked\nhide\nset [lightsaber v] to [false]\nset [blaster v] to [false]\n\nwhen I receive [you go a... lightsaber v]\nswitch costume to (weapon-lightsaber v)\nshow\nset [lightsaber v] to [true]\n\nwhen [space v] key pressed\nset [weapon choice v] to (costume [number v])\nif <<(lightsaber) = [true]> and <(weapon choice) = [1]>> then\n    if <(in action) = [0]> then\n        broadcast (Slash v)\n    end\nend\nif <<(blaster) = [true]> and <(weapon choice) = [2]>> then\n    if <(in action) = [0]> then\n        broadcast (blaster fire v)\n    end\nend\nwait until <not <key (space v) pressed?>>\n\nwhen backdrop switches to [level-5 v]\nswitch costume to (weapon-lightsaber v)\nshow\nset [lightsaber v] to [true]\n\nwhen backdrop switches to [level-3 v]\nhide\nset [lightsaber v] to [false]\n\nwhen I receive [you got a.. blaster v]\nset [blaster v] to [true]\n\nwhen backdrop switches to [level-7 v]\nset [blaster v] to [false]\n\nwhen [z v] key pressed\nif <(blaster) = [true]> then\n    next costume\n    set [weapon choice v] to (costume [number v])\nend\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Moving Platform\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [level-3 v]\nshow\ngo to x: (-119) y: (-131)\nrepeat until <not <(backdrop [number v]) = [3]>>\n    repeat until <<touching color (#000000)?> and <not <touching (you v)?>>>\n        change x by (6)\n        if <not <(backdrop [number v]) = [3]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    get out of wall 1\n    repeat until <touching color (#000000)?>\n        change x by (-6)\n        if <not <(backdrop [number v]) = [3]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    get out of wall 2\nend\nhide\n\ndefine get out of wall 1\nif <touching color (#000000)?> then\n    repeat until <not <touching color (#000000)?>>\n        change x by (-1)\n    end\nend\n\ndefine get out of wall 2\nif <touching color (#000000)?> then\n    repeat until <not <touching color (#000000)?>>\n        change x by (1)\n    end\nend\n\nwhen backdrop switches to [level-10 v]\nshow\ngo to x: (-104) y: (-156)\nrepeat until <not <(backdrop [number v]) = [10]>>\n    repeat until <<touching color (#000000)?> and <not <touching (you v)?>>>\n        change x by (6)\n        if <not <(backdrop [number v]) = [10]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    get out of wall 1\n    repeat until <touching color (#000000)?>\n        change x by (-6)\n        if <not <(backdrop [number v]) = [10]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    get out of wall 2\nend\nhide\n\nwhen backdrop switches to [level-13 v]\nshow\ngo to x: (38) y: (-156)\nrepeat until <not <(backdrop [number v]) = [13]>>\n    repeat until <<touching color (#000000)?> and <not <touching (you v)?>>>\n        change x by (6)\n        if <not <(backdrop [number v]) = [13]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    get out of wall 1\n    repeat until <touching color (#000000)?>\n        change x by (-6)\n        if <not <(backdrop [number v]) = [13]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    get out of wall 2\nend\nhide\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Enemy\n\nwhen flag clicked\nhide\ngo to [front v] layer\nset [# v] to [0]\n\nwhen backdrop switches to [level-5 v]\nset [# v] to [1]\ngo to x: (item (#) of [enemy spawn x v]) y: (item (#) of [enemy spawn y v])\nset [player status v] to []\nset [enemy status v] to []\nshow\nwait until <<<touching (lightsaber v)?> or <(Player Status) = [win]>> or <(enemy status) = [die]>>\nset [enemy status v] to [die]\nhide\n\nwhen [f v] key pressed\nadd (mouse x) to [enemy spawn x v]\nadd (mouse y) to [enemy spawn y v]\n\nwhen backdrop switches to [level-6 v]\nset [# v] to [2]\ngo to x: (item (#) of [enemy spawn x v]) y: (item (#) of [enemy spawn y v])\nset [player status v] to []\nset [enemy status v] to []\nshow\nwait until <<<touching (lightsaber v)?> or <(Player Status) = [win]>> or <(enemy status) = [die]>>\nset [enemy status v] to [die]\nhide\n\nwait until <<<touching (lightsaber v)?> or <(Player Status) = [win]>> or <(enemy status) = [die]>>\nset [enemy status v] to [die]\nhide\n\nwhen backdrop switches to [level-10 v]\nset [# v] to [3]\ngo to x: (item (#) of [enemy spawn x v]) y: (item (#) of [enemy spawn y v])\nset [player status v] to []\nset [enemy status v] to []\nshow\nwait until <<<touching (lightsaber v)?> or <(Player Status) = [win]>> or <(enemy status) = [die]>>\nset [enemy status v] to [die]\nhide\n\nwhen backdrop switches to [level-14 v]\nset [# v] to [2]\ngo to x: (item (#) of [enemy spawn x v]) y: (item (#) of [enemy spawn y v])\nset [player status v] to []\nset [enemy status v] to []\nshow\nwait until <<<touching (lightsaber v)?> or <(Player Status) = [win]>> or <(enemy status) = [die]>>\nset [enemy status v] to [die]\nhide\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Enemy-Fire\n\nwhen backdrop switches to [level-5 v]\nrepeat until <<not <(backdrop [number v]) = [5]>> or <(enemy status) = [die]>>\n    hide\n    go to x: ([x position v] of [enemy v]) y: (([y position v] of [enemy v]) + (25))\n    wait (0.7) seconds\n    point towards (you v)\n    start sound [Blaster v]\n    show\n    repeat until <<<touching (you v)?> or <touching (_edge_ v)?>> or <<touching (lightsaber v)?> or <touching color (#fff8be)?>>>\n        move (15) steps\n        if <<not <(backdrop [number v]) = [5]>> or <(enemy status) = [die]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    what did i hit\nend\n\nwhen flag clicked\nhide\n\ndefine what did i hit\nif <touching (lightsaber v)?> then\n    turn right (180) degrees\n    repeat until <<<touching (enemy v)?> or <touching (_edge_ v)?>> or <touching color (#fff8be)?>>\n        move (15) steps\n        if <<(Player Status) = [win]> or <(enemy status) = [die]>> then\n            hide\n            stop [this script v]\n        end\n    end\nend\nif <<touching color (#fff8be)?> or <touching (_edge_ v)?>> then\n    hide\nend\nif <touching (you v)?> then\n    set [player status v] to [die]\n    hide\nend\nif <touching (enemy v)?> then\n    set [enemy status v] to [die]\n    hide\nend\n\nwhen I receive [reshoot v]\n\nbroadcast (reshoot v) and wait\n\nwhen backdrop switches to [level-6 v]\nrepeat until <<not <(backdrop [number v]) = [6]>> or <(enemy status) = [die]>>\n    hide\n    go to x: ([x position v] of [enemy v]) y: (([y position v] of [enemy v]) + (25))\n    wait (0.7) seconds\n    point towards (you v)\n    start sound [Blaster v]\n    show\n    repeat until <<<touching (you v)?> or <touching (_edge_ v)?>> or <<touching (lightsaber v)?> or <touching color (#fff8be)?>>>\n        move (15) steps\n        if <<not <(backdrop [number v]) = [6]>> or <(enemy status) = [die]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    what did i hit\nend\n\nif <<touching color (#fff8be)?> or <touching (_edge_ v)?>> then\n    hide\nend\nif <touching (you v)?> then\n    set [player status v] to [die]\n    hide\nend\nif <touching (enemy v)?> then\n    set [enemy status v] to [die]\n    hide\nend\n\nwhen backdrop switches to [level-10 v]\nrepeat until <<not <(backdrop [number v]) = [10]>> or <(enemy status) = [die]>>\n    hide\n    go to x: ([x position v] of [enemy v]) y: (([y position v] of [enemy v]) + (25))\n    wait (0.7) seconds\n    point towards (you v)\n    start sound [Blaster v]\n    show\n    repeat until <<<touching (you v)?> or <touching (_edge_ v)?>> or <<touching (lightsaber v)?> or <touching color (#fff8be)?>>>\n        move (15) steps\n        if <<not <(backdrop [number v]) = [10]>> or <(enemy status) = [die]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    what did i hit\nend\n\nwhen backdrop switches to [level-6 v]\nrepeat until <<not <(backdrop [number v]) = [14]>> or <(enemy status) = [die]>>\n    hide\n    go to x: ([x position v] of [enemy v]) y: (([y position v] of [enemy v]) + (25))\n    wait (0.7) seconds\n    point towards (you v)\n    start sound [Blaster v]\n    show\n    repeat until <<<touching (you v)?> or <touching (_edge_ v)?>> or <<touching (lightsaber v)?> or <touching color (#fff8be)?>>>\n        move (15) steps\n        if <<not <(backdrop [number v]) = [14]>> or <(enemy status) = [die]>> then\n            hide\n            stop [this script v]\n        end\n    end\n    what did i hit\nend\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Target\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [level-8 v]\ngo to x: (141) y: (63)\nshow\nwait until <<<touching (blaster-fire v)?> or <(Player Status) = [win]>> or <(Player Status) = [die]>>\nhide\nbroadcast (kazap v)\n\nwhen backdrop switches to [level-9 v]\ngo to x: (57) y: (40)\nshow\nwait until <<<touching (blaster-fire v)?> or <(Player Status) = [win]>> or <(Player Status) = [die]>>\nhide\nbroadcast (kazap v)\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Walls\n\nwhen flag clicked\nhide\ndelete this clone\n\nwhen backdrop switches to [level-8 v]\npoint in direction (90)\nswitch costume to (1 v)\ngo to x: (239) y: (0)\ncreate clone of (_myself_ v)\ngo to x: (239) y: (-100)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\n\nwhen I receive [kazap v]\ndelete this clone\n\nwhen I receive [reboot level v]\ndelete this clone\n\nwhen I receive [next level v]\ndelete this clone\n\nwhen backdrop switches to [level-9 v]\npoint in direction (90)\nswitch costume to (4 v)\ngo to x: (-12) y: (-110)\ncreate clone of (_myself_ v)\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Blaster\n\nwhen backdrop switches to [level-8 v]\nif <not <(blaster) = [true]>> then\n    point in direction (90)\n    go to x: (34) y: (-25)\n    switch costume to (costume1 v)\n    show\n    wait until <touching (you v)?>\n    hide\n    broadcast (you got a.. blaster v) and wait\nend\n\nwhen I receive [blaster fire v]\nif <(in action) = [0]> then\n    go to [front v] layer\n    set [in action v] to [1]\n    point in direction ([direction v] of [you v])\n    go to (you v)\n    turn left (180) degrees\n    switch costume to (costume1 v)\n    show\n    repeat until <not <key (space v) pressed?>>\n        go to (you v)\n        point towards (mouse-pointer v)\n        if <(mouse x) > (x position)> then\n            switch costume to (costume1 v)\n        else\n            switch costume to (costume2 v)\n        end\n    end\n    start sound [Blaster v]\n    broadcast (shoot v)\n    hide\n    wait (1) seconds\n    set [in action v] to [0]\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen backdrop switches to [level-9 v]\nhide\nbroadcast (you got a.. blaster v) and wait\n\n@Blaster-Fire\n\nwhen I receive [shoot v]\nshow\npoint in direction ([direction v] of [blaster v])\ngo to (blaster v)\nrepeat until <<<touching color (#fff8be)?> or <touching (_edge_ v)?>> or <touching (enemy v)?>>\n    move (15) steps\nend\nif <<touching color (#fff8be)?> or <touching (_edge_ v)?>> then\n    hide\nend\nif <touching (enemy v)?> then\n    set [enemy status v] to [die]\n    hide\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Sprite1\n\nwhen flag clicked\nswitch costume to (logo v)\ngo to x: (0) y: (0)\nset size to (0) %\nshow\nrepeat (7)\n    change size by (10)\nend\nrepeat (4)\n    change size by (-5)\nend\nbroadcast (message1 v)\nrepeat (5)\n    change y by (10)\nend\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Sprite2\n\nwhen flag clicked\nhide\nrepeat (120)\n    go to x: (pick random (-230) to (-200)) y: (pick random (-120) to (120))\n    create clone of (_myself_ v)\n    go to x: (pick random (230) to (200)) y: (pick random (-120) to (120))\n    create clone of (_myself_ v)\nend\nbroadcast (green flag v)\nhide\n\nwhen I start as a clone\ngo to [back v] layer\nset size to (pick random (10) to (30)) %\nif <not <touching color (#000000)?>> then\n    show\nend\nif <(x position) > [0]> then\n    repeat until <(x position) < [0]>\n        point in direction (-90)\n        move (10) steps\n    end\nelse\n    repeat until <(x position) > [0]>\n        point in direction (90)\n        move (10) steps\n    end\nend\ndelete this clone\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Sprite3\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\nwhen I receive [message1 v]\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@Thumbnail2\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n
• Arrow keys to move.\n• Space bar to slash lightsaber.\n• Hold space bar to aim blaster at mouse pointer, and release to fire.\n• Blaster has a 1 second cooldown.\n• Shoot targets.\n• Kill Stormtroopers.\n• Z to change weapon.\n• S to skip a level.\n• A to go back a level.\n• R to restart the level.\n• Avoid mud.\n• Have fun.\n• Follow @Saturn-Rings.