2D Top Down Shooting POINT & CLICK Unity Tutorial

In this Unity Tutorial we're building off what we did last tutorial in setting up our 2D Top Down Movement project and expanding it to now include 2D Top down shooting mechanics.
There are a few different User Experiences for handling shooting from a top down perspective, in this tutorial we focus on a point and shoot approach which is driven by aiming with the mouse and firing with left mouse button.
By the end of the tutorial you'll have the structure of firing projectiles in any direction down, but I challenge you to expand upon it and figure out how to flesh out the weapon and bullet scripts to be more interesting in your own games.
If you have any PROBLEMS or want to share PROGRESS / Talk ideas, think about joining the new community discord!! (linked below)
There is a problem-solving discord channel where you can post any errors you're getting and the community will help you out.
➤WATCH PART 1 - 2D Topdown Movement Tutorial: • 2D Top Down Movement U...
✨Want to support the channel?
Buy me a coffee ☕: ko-fi.com/bmoli
➤Join the new DISCORD SERVER: / discord
➤Want to make video games? Start with my tutorial Playlist: • Epic Unity Tutorials
➤5 Minute Tutorial Series: • 5 Minute Games
➤Don't forget to SUBSCRIBE for all the upcoming content.
THANK YOU!
#bmo #unity #tutorial

Пікірлер: 92

  • @eileeng2492
    @eileeng24923 жыл бұрын

    This is a really great vid man.

  • @thomasedwardking7286
    @thomasedwardking7286 Жыл бұрын

    So clear and accessible. So much learnt here. Thankyou

  • @revmatch6r
    @revmatch6r4 жыл бұрын

    Love it. That would have taken me so much longer to figure out than 13 minutes

  • @BMoDev

    @BMoDev

    4 жыл бұрын

    Appreciate it!

  • @EchoYoutube
    @EchoYoutube3 жыл бұрын

    If your having a problem with the "NullReferenceException: Object reference not set to an instance of an object" error, roughly around when you make the player shoot for the first time, heres how to fix it. This error means that something outside of the code is not being referenced. Usually, when there is an error with the code it wont allow the game to run. If the game is going, but you only get the error when you shoot, that means the reference hasnt been set OUTSIDE of the code. Simply put, just go to your player(or whatever is making the error) and make sure everything is synced up with your scripts.

  • @jayd1os400

    @jayd1os400

    3 жыл бұрын

    I get this error but what do you mean by synced up with your scripts???

  • @carmenjuliarodriguez3221

    @carmenjuliarodriguez3221

    3 жыл бұрын

    Thank you so much. I needed that.

  • @sea-jae6237

    @sea-jae6237

    3 жыл бұрын

    THANK YOU!!!!!!

  • @stryc.

    @stryc.

    Жыл бұрын

    Thank you!

  • @TurningTrix42

    @TurningTrix42

    Жыл бұрын

    I love you and want to marry you. Thank you.

  • @stalkerdeb900
    @stalkerdeb9004 жыл бұрын

    Are you planning on making a Video about Enemie Interactions and Health usw? That would be great! Your tutorials are super great btw! Have a good Day, Byeeee!

  • @BMoDev

    @BMoDev

    4 жыл бұрын

    Yup, that's definitely going to get covered soon!

  • @salimmoughrabi603
    @salimmoughrabi6033 жыл бұрын

    very nice vid man . can you plz make a tutorial where you combine this mechanic and the 8d movement (in your 8d animation vid) so that we get mechanics just like enter the gungeon. im still new to coding and liked your content easy to understand keep it up .

  • @l8j951
    @l8j9514 жыл бұрын

    Nice

  • @BMoDev

    @BMoDev

    4 жыл бұрын

    Very nice

  • @jimmyljr95
    @jimmyljr954 жыл бұрын

    Nice tutorial! I was wondering how this would work for a mobile game? What are your thoughts on this, can you show us? Thanks again!

  • @BMoDev

    @BMoDev

    4 жыл бұрын

    It'd be pretty easy, instead of checking if you're pressing the mouse button, you could detect tapping on the screen, record the position and register it as a "mouse click". Unity comes with mobile integration, but I probably won't cover it for a bit... eventually tho

  • @mattthebanana
    @mattthebanana4 жыл бұрын

    Please do a top-down melee tutorial

  • @BMoDev

    @BMoDev

    4 жыл бұрын

    that is definitely in my backlog!

  • @flukeycups4502
    @flukeycups4502 Жыл бұрын

    How to get the particle system 12:56 (the one that you dragged into the ImpactEffect). Do we need to download from outside source? And do we need to set up anything on it?

  • @nickvullings8728
    @nickvullings87283 жыл бұрын

    Is there a way to add delay between each shot so my pistol doesnt shoot a beam of bullets when i hold m1

  • @Kai-ss8ke
    @Kai-ss8ke2 жыл бұрын

    Could you show me how to use the particles you used?

  • @wandevv
    @wandevv Жыл бұрын

    The VS code theme you are using is amazing, what is the name?

  • @darkflame2848
    @darkflame28483 жыл бұрын

    Plz help id doenot rotate properly it rotates half than it auto rotate to its place help

  • @domenzigart50
    @domenzigart502 жыл бұрын

    for some reason my rb.rotation = aimAngle; doesn't work, It says "=" and ";" are used incorrectly, can you please help

  • @henrrypoop7570
    @henrrypoop75704 жыл бұрын

    wow

  • @Great-Dao-of-Elegance
    @Great-Dao-of-Elegance8 ай бұрын

    How can I have a different gameobject rotate instead of the player and shoot as well

  • @MitchIcarus
    @MitchIcarus3 жыл бұрын

    at 7:13 I get the following error in my console: NullReferenceException: Object reference not set to an instance of an object PlayerController.ProcessInputs () (at Assets/PlayerController.cs:33) PlayerController.Update () (at Assets/PlayerController.cs:18) line 33 is my weapon.Fire(); code, line 18 is ProcessInputs(); any help?

  • @MitchIcarus

    @MitchIcarus

    3 жыл бұрын

    UPDATE: I fixed it I guess? I clicked on my player, and then dragged my weapon in the weapon slot under Player Controller (Script). Is that how I was suppose to fix it?

  • @pugbread2873

    @pugbread2873

    3 жыл бұрын

    @@MitchIcarus thank you! had the same problem and this worked

  • @aquamoko0664

    @aquamoko0664

    3 жыл бұрын

    Tysm i sas stuck with this problem for a whole day t’y (:

  • @neatelf9913

    @neatelf9913

    2 жыл бұрын

    @@MitchIcarus This worked. This FUCKING worked. If someone who's reading this is using a private GameObject for Weapon instead of public, just use [SerializeField] above/before the object declaration and it will show up in the Inspector. e.g: [SerializeField] private Weapon weapon;

  • @Yovry
    @Yovry2 жыл бұрын

    Damn. I'm trying to find a tutorial JUST LIKE THIS for ue4 lol

  • @oshimaboyd1919
    @oshimaboyd19192 жыл бұрын

    Could you make a tutorial on Top Down shooting using arrow keys instead of mouse?

  • @tirilmariepedersen6956

    @tirilmariepedersen6956

    Жыл бұрын

    Yeeeeees, would love that!!!! C:

  • @thenoglinman
    @thenoglinman2 жыл бұрын

    Hi, any thoughts on making a melee version of this. That would really help!

  • @AlexGorskov

    @AlexGorskov

    2 жыл бұрын

    yeah

  • @cardario5323

    @cardario5323

    2 жыл бұрын

    brackeys has a viedo about it you can check it out!

  • @Bignose_Dev
    @Bignose_Dev3 жыл бұрын

    my player didint have collision why ?

  • @homosexualitymydearwatson4109
    @homosexualitymydearwatson41093 жыл бұрын

    Thank you so much I have adhd and learning from KZread is really hard for me but your videos are easier to learn from, could you Maybe do a video series teaching certain essentials of coding with unity? I’m currently learning (and have experience in Python from my last semester course) C++ in my college class so most of it is familiar to me , but I’d really love to see you explain a little more in depth with the code?

  • @decentanims
    @decentanims Жыл бұрын

    Help! There was a error that said "Assets\PlayerController.cs(10,12): error CS0246: The type or namespace name 'Weapon' could not be found (are you missing a using directive or an assembly reference?)", it errored at my script " public Weapon weapon;" any help?

  • @soapypenguin631

    @soapypenguin631

    Жыл бұрын

    you need to assign the script to it in the editor, as well as making sure your script is named "Weapon"

  • @l.1263
    @l.12633 жыл бұрын

    When I move my mouse why does my character move in like massive circles

  • @billdam7298
    @billdam72989 ай бұрын

    How do I make something other than the player rotate and move along with the player (E.g. a blaster of sorts)?

  • @actualartificer223

    @actualartificer223

    6 ай бұрын

    make it a child of the player and it should work

  • @vvcephie113
    @vvcephie1133 жыл бұрын

    is ther anything wrong with this, It says Missing ";" } } void OnTriggerEnter2D(Collider2D other){ if(other.CompareTag("Player")); or if(other.CompareTag("Walls")); { DestroyProjectile(); } }

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    yup, compare your if statement to the one in the video

  • @vvcephie113

    @vvcephie113

    3 жыл бұрын

    @@BMoDev Thanks!

  • @vvcephie113

    @vvcephie113

    3 жыл бұрын

    Could You make a vid about the enemy heath scrip??? I am just learning unity and code. If you could that would be great!

  • @gusevgp1417
    @gusevgp14173 жыл бұрын

    it says that the mousePosition doesnt exist even if I did the correct code (mousePosition = sceneCamera.ScreenToWorldPoint(Input.mousePosition);) how can I fix this/ can someone send me a copy, cuz I can't get this to work for the life of me

  • @BMoDev

    @BMoDev

    3 жыл бұрын

    looks like the semicolon has to be outside of both )), like (mousePosition = sceneCamera.ScreenToWorldPoint(Input.mousePosition));

  • @gusevgp1417

    @gusevgp1417

    3 жыл бұрын

    @@BMoDev I added a second bracket as in "hi, I'm jim (jim jones), nice to meet you."

  • @rido3753
    @rido37534 ай бұрын

    seeing the left side of your screen would have been helpful

  • @crashcode2401
    @crashcode24013 жыл бұрын

    WHERE IS PART ONE? Still looking for the first Video part ... XD

  • @minecraftwithjpizza9929
    @minecraftwithjpizza99292 жыл бұрын

    My bullet goes up not forwards

  • @ashako506
    @ashako5062 жыл бұрын

    my bullet just goes to the right of the gun how do i fix this?

  • @Wittlson

    @Wittlson

    Жыл бұрын

    make sure you do -90 at aimAngle

  • @providedmoney4722
    @providedmoney47223 жыл бұрын

    I try the movement but my cube just move very weird. Can you help me?

  • @moolayenstudios

    @moolayenstudios

    2 жыл бұрын

    Is your character only rotating toward one spot in the center of your camera?

  • @nameisian

    @nameisian

    2 жыл бұрын

    @@moolayenstudios yes plz help

  • @mischa8517
    @mischa85172 жыл бұрын

    so why do you have to do -90 at the aim angle

  • @Lps-bx7ck

    @Lps-bx7ck

    2 жыл бұрын

    Because if you don't, he will shoot to his right (polar angle 0). When you subtract 90 degrees, it is rotating the cube clockwise, which means the top of the cube is the shooting direction. Then it corrects to the mouse position.

  • @jmbrjmbr2397

    @jmbrjmbr2397

    2 жыл бұрын

    I don't get it too, I'm confused

  • @GGG-hh5jo
    @GGG-hh5jo3 жыл бұрын

    I did all your tutorials but stuck at 6:34 I click the Right button it won't Help!

  • @carmenjuliarodriguez3221

    @carmenjuliarodriguez3221

    3 жыл бұрын

    Me too.

  • @user-mp4bu5rd6b
    @user-mp4bu5rd6b Жыл бұрын

    How can i make the camera follow the player

  • @BMoDev

    @BMoDev

    Жыл бұрын

    Theres quite a few ways but checkout my Cinemachine tutorial

  • @user-mp4bu5rd6b

    @user-mp4bu5rd6b

    Жыл бұрын

    @@BMoDev alr thank you

  • @darshnagdeve4021
    @darshnagdeve40213 жыл бұрын

    what should i do when the bullet is not moving

  • @darshnagdeve4021

    @darshnagdeve4021

    3 жыл бұрын

    what should i do if the bullet is going up

  • @maxxxxiors

    @maxxxxiors

    3 жыл бұрын

    what should i do if the bullet is falling down

  • @DeadeyeOutdoorman
    @DeadeyeOutdoorman2 жыл бұрын

    Is anyone else having issues with the OnTriggerEnter2d not triggering?

  • @BMoDev

    @BMoDev

    2 жыл бұрын

    Make sure spelling/capitalizations correct. Make sure IsTrigger is checked in inspector on your Collider2D component

  • @DeadeyeOutdoorman

    @DeadeyeOutdoorman

    2 жыл бұрын

    @@BMoDev I'm using visual studio code and simply needed to add the Unity Code Snippets Extension, thank you.

  • @ciaranmccallion8264
    @ciaranmccallion8264 Жыл бұрын

    me thinking i was smart making the player the cameras parents so the camera follows me around only to have that fuck up the rotation

  • @umanathification
    @umanathification4 жыл бұрын

    Why aren't we funding this?

  • @DertyDub
    @DertyDub2 жыл бұрын

    3:49

  • @DertyDub
    @DertyDub2 жыл бұрын

    7:36

  • @DertyDub
    @DertyDub2 жыл бұрын

    6:01