The Mandalorian Platformer

Instructions: Number "4" now when you search for #Mandalorian.\n\nI created this game when I was still a bitmap user and beginner scratcher, but now that I have gotten better at Scratch, this game looks very basic (to me). If it does not work right, then that was my fault in the past, since I did not know how to code as good.\n\nRemasstered Version:\nhttps://scratch.mit.edu/projects/641103648/\n\nNew Mandalorian Themed Game:\nhttps://scratch.mit.edu/projects/454389677\n\nUpdate log:\nFebruary 8, 2022, remastered verison released.\nFebruary 7, 2022, v1.3, changed ground color to a darker theme so that it is easier to see.\nMarch 17, 2020, v1.2, added mobile-compatibility.\nMarch 15, 2020, v1.1, added the AT-ST Raider.\n\n\nThis game is probably not compatible with older models of computers; so, it might glitch. This is the first edition of "The Mando-Former." Avoid and eliminate the stormtroopers. PLEASE READ THIS IF YOU ARE USING MOBILE! This is now a mobile-friendly project; tap on Mando then wait for an arrow to show up then tap on the desired location to shoot rifle in that direction, and tap on either side of the screen to move right or left and the top of the screen to jump.\n-----------------------------------------------------------------\nBasic controls:\narrows: moving around.\ndown arrow or "S": shoot (when you achieve the rifle).\n"E" or jump button: jetpacks (When you achieve it).\n-----------------------------------------------------------------\nPlatform code by @04tmoody\nAll art and other codes by @Whiteout12\nMusic by Lucas-films: Star-Wars, The Mandalorian.\n\n#All #Platformer #Mando #Games 

@Stage\n\n@Title\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (1 v)\ngo to [front v] layer\nshow\n\nwhen I receive [start game v]\nhide\n\nwhen I receive [end game v]\nswitch costume to (2 v)\nshow\n\n@Mando\n\ndefine Move Y (yv)\nchange y by (yv)\nrepeat until <not <touching color (#b7a468)?>>\n    if <(yv) < [0]> then\n        set [can jump v] to [1]\n    end\n    set [yv v] to [0]\n    change y by (() - ((yv) / ([abs v] of (yv) )))\nend\nchange y by (() - ((yv) / ([abs v] of (yv) )))\n\ndefine Move X (xv)\nchange x by (xv)\nrepeat until <not <touching color (#b7a468)?>>\n    set [xv v] to [0]\n    change x by (() - ((xv) / ([abs v] of (xv) )))\nend\nchange x by (() - ((xv) / ([abs v] of (xv) )))\n\nwhen I receive [start game v]\nswitch costume to (1 v)\nset [jetpack ability v] to [0]\ngo to x: (-189) y: (-6)\nshow\nset [health v] to [10]\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    set rotation style [left-right v]\n    set [xv v] to ((xv) * (0.9))\n    Move X (round (xv))\n    change [yv v] by (-1)\n    set [can jump v] to [0]\n    Move Y (yv)\nend\n\nwhen flag clicked\nhide\nforever\n    if <<(can jump) = [1]> and <<key (space v) pressed?> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>>> then\n        set [yv v] to [12]\n    end\n    if <(Jetpack Ability) = [0]> then\n        if <<(can jump) = [1]> and <<mouse down?> and <(mouse y) > [0]>>> then\n            set [yv v] to [12]\n        end\n    end\n    if <(Jetpack Ability) = [1]> then\n        if <<mouse down?> and <(mouse y) > [0]>> then\n            broadcast (Launch v)\n        end\n    end\n    if <(costume [name v]) = [3]> then\n        set [jetpack ability v] to [0]\n        repeat until <not <(costume [name v]) = [3]>>\n            if <<<key (space v) pressed?> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> or <<mouse down?> and <(mouse y) > [0]>>> then\n                set [yv v] to [8]\n            end\n        end\n    end\n    if <(costume [name v]) = [3]> then\n        set [jetpack ability v] to [1]\n    end\nend\n\nwhen flag clicked\nforever\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > [0]>>> then\n        change [xv v] by (1)\n        if <not <(costume [name v]) = [3]>> then\n            switch costume to (1 v)\n            broadcast (Right Gun  v)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < [0]>>> then\n        change [xv v] by (-1)\n        if <not <(costume [name v]) = [3]>> then\n            switch costume to (2 v)\n            broadcast (Left Gun v)\n        end\n    end\nend\n\nwhen flag clicked\nset [ghost v] effect to (0)\nforever\n    if <touching color (#4d4d4d)?> then\n        wait (0.5) seconds\n        broadcast (Next Level v)\n        broadcast (Reposition v)\n    end\n    if <touching color (#878585)?> then\n        broadcast (Reposition v)\n    end\n    if <touching (stormtrooper v)?> then\n        wait (0.75) seconds\n        broadcast (Take Damage v)\n    end\n    if <touching (trooper bullet v)?> then\n        wait (0.75) seconds\n        broadcast (Take Damage v)\n    end\n    if <touching (at-st raider v)?> then\n        wait (0.75) seconds\n        broadcast (Take Damage v)\n    end\n    if <([costume name v] of [platformer v]) > [15]> then\n        if <<(x position) > [180]> and <touching (_edge_ v)?>> then\n            broadcast (Reposition v)\n            broadcast (Next Level v)\n        end\n    end\n    if <([costume # v] of [platformer v]) > [15]> then\n        if <<(costume [name v]) = [1]> or <(costume [name v]) = [2]>> then\n            broadcast (Take Damage v)\n        end\n    end\nend\n\nwhen I receive [reposition v]\ngo to x: (-189) y: (-6)\n\nwhen [r v] key pressed\nset [can jump v] to [0]\nbroadcast (Reposition v)\n\nwhen I receive [launch v]\nset [yv v] to [10]\n\nwhen this sprite clicked\nif <(Gun Ability) = [1]> then\n    broadcast (Mobile Attack v)\nend\n\nwhen I receive [ship mode v]\nwait (0.3) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nset [ghost v] effect to (100)\nif <<(costume [name v]) = [1]> or <(costume [name v]) = [2]>> then\n    switch costume to (3 v)\nend\nif <(costume [name v]) = [3]> then\n    switch costume to (1 v)\nend\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nset [ghost v] effect to (0)\n\n@Start Button\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\ngo to x: (163) y: (-28)\nwait (2) seconds\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (2 v)\n    else\n        switch costume to (1 v)\n    end\nend\n\nwhen this sprite clicked\nbroadcast (Start Game v)\nhide\n\n@Platformer\n\nwhen flag clicked\nswitch costume to (1 v)\nswitch backdrop to (tatooine v)\nwait (1) seconds\ngo to x: (0) y: (0)\ngo to [back v] layer\nforever\n    if <touching (bullet v)?> then\n        broadcast (Delete Bullet v)\n    end\n    if <touching (trooper bullet v)?> then\n        broadcast (Delete trooper Bullet v)\n    end\n    if <(costume [name v]) = [16]> then\n        switch backdrop to (space v)\n    end\n    if <(costume [name v]) = [17]> then\n        switch backdrop to (outer-space v)\n    end\nend\n\nwhen I receive [next level v]\nwait (0.1) seconds\nnext costume\n\n@Rifle\n\nwhen flag clicked\nwait (1) seconds\nset [gun ability v] to [0]\nhide\nforever\n    if <([costume name v] of [platformer v]) = [4]> then\n        show\n        go to x: (-91) y: (-51)\n        repeat until <touching (mando v)?>\n            glide (0.5) secs to x: (-91) y: (-45)\n            glide (0.5) secs to x: (-91) y: (-51)\n        end\n        set [gun ability v] to [1]\n        forever\n            go to (mando v)\n            if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n                broadcast (Shoot Rifle v)\n            end\n        end\n    else\n        hide\n    end\nend\n\nwhen I receive [left gun v]\nset rotation style [left-right v]\npoint in direction (-90)\n\nwhen I receive [right gun  v]\nset rotation style [left-right v]\npoint in direction (90)\n\n@Bullet\n\nwhen flag clicked\nforever\n    wait (3) seconds\n    hide\n    delete this clone\nend\n\nwhen I receive [shoot rifle v]\nwait (0.2) seconds\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset rotation style [all around v]\nwait (0.1) seconds\ngo to (rifle v)\npoint towards (mouse-pointer v)\nrepeat (6)\n    move (10) steps\nend\nshow\nrepeat until <touching (_edge_ v)?>\n    move (10) steps\nend\nhide\ndelete this clone\n\nwhen I receive [delete bullet v]\nhide\ndelete this clone\n\n@Health\n\nwhen flag clicked\nwait (1) seconds\nhide\ngo to x: (-156) y: (-141)\nswitch costume to (full health v)\n\nwhen I receive [start game v]\nswitch costume to (full health v)\nshow\nforever\n    if <(costume [name v]) = [Empty Health]> then\n        hide\n        broadcast (End Game v)\n    end\nend\n\nwhen I receive [take damage v]\nwait (0.5) seconds\nnext costume\n\nwhen I receive [restore health v]\nswitch costume to (full health v)\n\n@Stormtrooper\n\nwhen flag clicked\nforever\n    if <([costume name v] of [platformer v]) = [13]> then\n        wait (1) seconds\n        go to x: (-11) y: (60)\n        show\n        switch costume to (full v)\n        create clone of (_myself_ v)\n        forever\n            if <([costume name v] of [platformer v]) = [13]> then\n                point towards (mando v)\n                if <(costume [name v]) = [Dead]> then\n                    broadcast (Trooper Exit v)\n                    stop [this script v]\n                end\n            else\n                broadcast (Trooper Exit v)\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <([costume name v] of [platformer v]) = [11]> then\n        wait (1) seconds\n        go to x: (158) y: (-84)\n        show\n        switch costume to (full v)\n        create clone of (_myself_ v)\n        forever\n            if <([costume name v] of [platformer v]) = [11]> then\n                point towards (mando v)\n                move (1) steps\n                if <(costume [name v]) = [Dead]> then\n                    broadcast (Trooper Exit v)\n                    stop [this script v]\n                end\n            else\n                broadcast (Trooper Exit v)\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <([costume name v] of [platformer v]) = [8]> then\n        wait (1) seconds\n        go to x: (52) y: (-74)\n        show\n        switch costume to (full v)\n        create clone of (_myself_ v)\n        forever\n            if <([costume name v] of [platformer v]) = [8]> then\n                point towards (mando v)\n                move (1) steps\n                if <(costume [name v]) = [Dead]> then\n                    broadcast (Trooper Exit v)\n                    stop [this script v]\n                end\n            else\n                broadcast (Trooper Exit v)\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <([costume name v] of [platformer v]) = [7]> then\n        wait (1) seconds\n        go to x: (-30) y: (95)\n        show\n        switch costume to (full v)\n        create clone of (_myself_ v)\n        forever\n            if <([costume name v] of [platformer v]) = [7]> then\n                point towards (mando v)\n                move (1) steps\n                if <(costume [name v]) = [Dead]> then\n                    broadcast (Trooper Exit v)\n                    stop [this script v]\n                end\n            else\n                broadcast (Trooper Exit v)\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <([costume name v] of [platformer v]) = [6]> then\n        wait (1) seconds\n        go to x: (99) y: (-83)\n        show\n        switch costume to (full v)\n        forever\n            if <([costume name v] of [platformer v]) = [6]> then\n                point towards (mando v)\n                if <(costume [name v]) = [Dead]> then\n                    broadcast (Trooper Exit v)\n                    stop [this script v]\n                end\n            else\n                broadcast (Trooper Exit v)\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nset rotation style [left-right v]\nset size to (100) %\nswitch costume to (dead v)\nhide\nforever\n    if <(costume [name v]) = [Dead]> then\n        hide\n    else\n        if <touching (platformer v)?> then\n            repeat until <not <touching (platformer v)?>>\n                change y by (1)\n            end\n        end\n        if <not <touching (platformer v)?>> then\n            repeat until <touching (platformer v)?>\n                change y by (-1)\n            end\n        end\n    end\nend\n\nwhen I receive [trooper exit v]\nswitch costume to (dead v)\nhide\n\nwhen flag clicked\nforever\n    if <([costume name v] of [platformer v]) = [4]> then\n        wait (1) seconds\n        go to x: (208) y: (-82)\n        show\n        switch costume to (full v)\n        forever\n            if <([costume name v] of [platformer v]) = [4]> then\n                point towards (mando v)\n                move (1) steps\n                if <(costume [name v]) = [Dead]> then\n                    broadcast (Trooper Exit v)\n                    stop [this script v]\n                end\n            else\n                broadcast (Trooper Exit v)\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <([costume name v] of [platformer v]) = [5]> then\n        wait (1) seconds\n        go to x: (99) y: (68)\n        show\n        switch costume to (full v)\n        forever\n            if <([costume name v] of [platformer v]) = [5]> then\n                point towards (mando v)\n                if <(costume [name v]) = [Dead]> then\n                    broadcast (Trooper Exit v)\n                    stop [this script v]\n                end\n            else\n                broadcast (Trooper Exit v)\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nshow\nswitch costume to (full v)\nif <([costume name v] of [platformer v]) = [7]> then\n    go to x: (131) y: (-2)\nend\nif <([costume name v] of [platformer v]) = [8]> then\n    go to x: (-32) y: (-74)\nend\nif <([costume name v] of [platformer v]) = [11]> then\n    go to x: (42) y: (-85)\nend\nif <([costume name v] of [platformer v]) = [13]> then\n    go to x: (50) y: (-68)\nend\nrepeat until <(costume [name v]) = [Dead]>\n    point towards (mando v)\n    move (1) steps\n    if <touching (platformer v)?> then\n        repeat until <not <touching (platformer v)?>>\n            change y by (1)\n        end\n    end\n    if <not <touching (platformer v)?>> then\n        repeat until <touching (platformer v)?>\n            change y by (-1)\n        end\n        if <touching (bullet v)?> then\n            wait (0.75) seconds\n            next costume\n        end\n    end\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <touching (bullet v)?> then\n        wait (0.75) seconds\n        next costume\n        wait (0.75) seconds\n    end\nend\n\nif <(costume [name v]) = [Dead]> then\n    broadcast (Delete Stormtrooper Bullet v)\n    stop [this script v]\nend\n\nwhen flag clicked\nforever\n    repeat until <(costume [name v]) = [Dead]>\n        if <<([costume name v] of [platformer v]) = [5]> or <<([costume name v] of [platformer v]) = [6]> or <<([costume name v] of [platformer v]) = [8]> or <<([costume name v] of [platformer v]) = [11]> or <([costume name v] of [platformer v]) = [13]>>>>> then\n            wait (5) seconds\n            broadcast (Trooper Shoot v)\n        end\n    end\nend\n\n@Trooper Bullet\n\nwhen flag clicked\nwait (1) seconds\nhide\nforever\n    wait (3) seconds\n    hide\n    delete this clone\nend\n\nwhen I receive [trooper shoot v]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nset rotation style [all around v]\nwait (0.1) seconds\ngo to (stormtrooper v)\nwait (0.1) seconds\nif <([costume name v] of [platformer v]) = [14]> then\n    go to (at-st raider v)\nend\npoint towards (mando v)\nrepeat (6)\n    move (10) steps\nend\nif <not <([costume name v] of [platformer v]) = [14]>> then\n    if <([costume name v] of [stormtrooper v]) = [Dead]> then\n        hide\n        delete this clone\n    end\nend\nshow\nrepeat until <touching (_edge_ v)?>\n    move (10) steps\nend\nhide\ndelete this clone\n\nwhen I receive [delete trooper bullet v]\nhide\ndelete this clone\n\nwhen I receive [delete stormtrooper bullet v]\nhide\ndelete this clone\n\n@Baby Yoda\n\nwhen flag clicked\nwait (0.5) seconds\nhide\ngo to x: (144) y: (-62)\nswitch costume to (1 v)\nset size to (50) %\nforever\n    if <([costume name v] of [platformer v]) = [8]> then\n        show\n        forever\n            if <touching (mando v)?> then\n                wait (1) seconds\n                broadcast (Reposition v)\n                broadcast (Next Level v)\n                switch costume to (2 v)\n                forever\n                    go to (mando v)\n                    if <key (q v) pressed?> then\n                        repeat (10)\n                            change y by (2)\n                        end\n                        repeat (10)\n                            change y by (-2)\n                        end\n                    end\n                    if <<([costume name v] of [mando v]) = [1]> or <([costume name v] of [mando v]) = [2]>> then\n                        show\n                    else\n                        hide\n                    end\n                end\n            end\n        end\n    end\nend\n\n@Jetpack\n\nwhen flag clicked\nwait (1) seconds\nhide\ngo to x: (33) y: (-53)\nforever\n    if <([costume name v] of [platformer v]) = [10]> then\n        switch costume to (1 v)\n        show\n        repeat until <touching (mando v)?>\n            glide (1) secs to x: (33) y: (-45)\n            glide (1) secs to x: (33) y: (-53)\n        end\n        set [jetpack ability v] to [1]\n        forever\n            go to (mando v)\n            if <key (e v) pressed?> then\n                broadcast (Launch v)\n            end\n            if <<([costume name v] of [mando v]) = [1]> or <([costume name v] of [mando v]) = [2]>> then\n                show\n            else\n                hide\n            end\n        end\n    end\nend\n\nwhen I receive [launch v]\nswitch costume to (2 v)\nwait (1) seconds\nswitch costume to (1 v)\n\n@Med Kit\n\nwhen flag clicked\nwait (1) seconds\nhide\ngo to [front v] layer\nforever\n    if <<([costume name v] of [platformer v]) = [10]> or <([costume name v] of [platformer v]) = [14]>> then\n        if <([costume name v] of [platformer v]) = [10]> then\n            go to x: (177) y: (-70)\n        end\n        if <([costume name v] of [platformer v]) = [14]> then\n            go to x: (-122) y: (39)\n        end\n        show\n        repeat until <touching (mando v)?>\n            if <([costume name v] of [platformer v]) = [10]> then\n                glide (1) secs to x: (177) y: (-65)\n                glide (1) secs to x: (177) y: (-70)\n            end\n            if <([costume name v] of [platformer v]) = [14]> then\n                glide (1) secs to x: (-122) y: (45)\n                glide (1) secs to x: (-122) y: (39)\n            end\n        end\n        broadcast (Restore Health v)\n        repeat until <not <<([costume name v] of [platformer v]) = [10]> or <([costume name v] of [platformer v]) = [14]>>>\n            hide\n        end\n    else\n        hide\n    end\nend\n\n@AT-ST Raider\n\nwhen flag clicked\ngo to x: (120) y: (38)\nset rotation style [left-right v]\nset size to (80) %\nswitch costume to (dead v)\nhide\nforever\n    if <([costume name v] of [raider health v]) = [Dead]> then\n        hide\n    else\n        if <touching color (#dfc980)?> then\n            repeat until <not <touching color (#dfc980)?>>\n                change y by (1)\n            end\n        end\n        if <not <touching color (#dfc980)?>> then\n            repeat until <touching color (#dfc980)?>\n                change y by (-1)\n            end\n        end\n    end\nend\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    if <([costume name v] of [platformer v]) = [14]> then\n        wait (1) seconds\n        show\n        go to x: (120) y: (38)\n        broadcast (Start Raider v)\n        forever\n            if <([costume name v] of [platformer v]) = [14]> then\n                point towards (mando v)\n                if <([costume name v] of [raider health v]) = [Dead]> then\n                    broadcast (Defeat Raider v)\n                    stop [this script v]\n                end\n            else\n                hide\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (bullet v)?> then\n        wait (0.75) seconds\n        broadcast (Minus Raider Health v)\n    end\nend\n\nwhen I receive [defeat raider v]\nhide\nwait (1) seconds\nbroadcast (Next Level v)\nbroadcast (Reposition v)\n\nwhen flag clicked\nforever\n    repeat until <([costume name v] of [raider health v]) = [Dead]>\n        if <([costume name v] of [platformer v]) = [14]> then\n            wait (4) seconds\n            broadcast (Trooper Shoot v)\n        end\n    end\nend\n\n@Raider Health\n\nwhen flag clicked\nswitch costume to (full health v)\nwait (1) seconds\nhide\nforever\n    if <([costume name v] of [platformer v]) = [14]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [start raider v]\ngo to x: (69) y: (-139)\nshow\n\nwhen I receive [minus raider health v]\nwait (0.1) seconds\nnext costume\n\n@Sound\n\nwhen this sprite clicked\nwait (0.4) seconds\nif <(costume [name v]) = [1]> then\n    switch costume to (2 v)\nelse\n    switch costume to (1 v)\nend\n\nwhen flag clicked\nforever\n    if <(costume [name v]) = [1]> then\n        set volume to (100) %\n    end\n    if <(costume [name v]) = [2]> then\n        set volume to (0) %\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nhide\nswitch costume to (1 v)\nset [ghost v] effect to (40)\ngo to x: (220) y: (-160)\nforever\n    play sound [The Mandalorian Theme v] until done\nend\n\nwhen I receive [start game v]\nshow\n\n@Arrow of Bullet\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\n    go to (mando v)\nend\n\nwhen I receive [mobile attack v]\nwait (0.5) seconds\nset rotation style [all around v]\nif <(Gun Ability) = [1]> then\n    show\n    repeat until <mouse down?>\n        point towards (mouse-pointer v)\n    end\nend\nbroadcast (Shoot Rifle v)\nhide\n\n@Ship Button\n\nwhen flag clicked\nhide\ngo to x: (-39) y: (-140)\ngo to [front v] layer\nforever\n    if <([costume name v] of [platformer v]) = [15]> then\n        show\n        forever\n            if <key (q v) pressed?> then\n                broadcast (Ship Mode v)\n            end\n            if <touching (mouse-pointer v)?> then\n                switch costume to (2 v)\n            else\n                switch costume to (1 v)\n            end\n            if <([costume name v] of [platformer v]) = [16]> then\n                hide\n                \n            end\n        end\n    else\n        hide\n    end\nend\n\nwhen this sprite clicked\nbroadcast (Ship Mode v)\n\n