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
This is a really great vid man.
So clear and accessible. So much learnt here. Thankyou
Love it. That would have taken me so much longer to figure out than 13 minutes
@BMoDev
4 жыл бұрын
Appreciate it!
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
3 жыл бұрын
I get this error but what do you mean by synced up with your scripts???
@carmenjuliarodriguez3221
3 жыл бұрын
Thank you so much. I needed that.
@sea-jae6237
3 жыл бұрын
THANK YOU!!!!!!
@stryc.
Жыл бұрын
Thank you!
@TurningTrix42
Жыл бұрын
I love you and want to marry you. Thank you.
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
4 жыл бұрын
Yup, that's definitely going to get covered soon!
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 .
Nice
@BMoDev
4 жыл бұрын
Very nice
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
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
Please do a top-down melee tutorial
@BMoDev
4 жыл бұрын
that is definitely in my backlog!
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?
Is there a way to add delay between each shot so my pistol doesnt shoot a beam of bullets when i hold m1
Could you show me how to use the particles you used?
The VS code theme you are using is amazing, what is the name?
Plz help id doenot rotate properly it rotates half than it auto rotate to its place help
for some reason my rb.rotation = aimAngle; doesn't work, It says "=" and ";" are used incorrectly, can you please help
wow
How can I have a different gameobject rotate instead of the player and shoot as well
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
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
3 жыл бұрын
@@MitchIcarus thank you! had the same problem and this worked
@aquamoko0664
3 жыл бұрын
Tysm i sas stuck with this problem for a whole day t’y (:
@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;
Damn. I'm trying to find a tutorial JUST LIKE THIS for ue4 lol
Could you make a tutorial on Top Down shooting using arrow keys instead of mouse?
@tirilmariepedersen6956
Жыл бұрын
Yeeeeees, would love that!!!! C:
Hi, any thoughts on making a melee version of this. That would really help!
@AlexGorskov
2 жыл бұрын
yeah
@cardario5323
2 жыл бұрын
brackeys has a viedo about it you can check it out!
my player didint have collision why ?
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?
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
Жыл бұрын
you need to assign the script to it in the editor, as well as making sure your script is named "Weapon"
When I move my mouse why does my character move in like massive circles
How do I make something other than the player rotate and move along with the player (E.g. a blaster of sorts)?
@actualartificer223
6 ай бұрын
make it a child of the player and it should work
is ther anything wrong with this, It says Missing ";" } } void OnTriggerEnter2D(Collider2D other){ if(other.CompareTag("Player")); or if(other.CompareTag("Walls")); { DestroyProjectile(); } }
@BMoDev
3 жыл бұрын
yup, compare your if statement to the one in the video
@vvcephie113
3 жыл бұрын
@@BMoDev Thanks!
@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!
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
3 жыл бұрын
looks like the semicolon has to be outside of both )), like (mousePosition = sceneCamera.ScreenToWorldPoint(Input.mousePosition));
@gusevgp1417
3 жыл бұрын
@@BMoDev I added a second bracket as in "hi, I'm jim (jim jones), nice to meet you."
seeing the left side of your screen would have been helpful
WHERE IS PART ONE? Still looking for the first Video part ... XD
My bullet goes up not forwards
my bullet just goes to the right of the gun how do i fix this?
@Wittlson
Жыл бұрын
make sure you do -90 at aimAngle
I try the movement but my cube just move very weird. Can you help me?
@moolayenstudios
2 жыл бұрын
Is your character only rotating toward one spot in the center of your camera?
@nameisian
2 жыл бұрын
@@moolayenstudios yes plz help
so why do you have to do -90 at the aim angle
@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
2 жыл бұрын
I don't get it too, I'm confused
I did all your tutorials but stuck at 6:34 I click the Right button it won't Help!
@carmenjuliarodriguez3221
3 жыл бұрын
Me too.
How can i make the camera follow the player
@BMoDev
Жыл бұрын
Theres quite a few ways but checkout my Cinemachine tutorial
@user-mp4bu5rd6b
Жыл бұрын
@@BMoDev alr thank you
what should i do when the bullet is not moving
@darshnagdeve4021
3 жыл бұрын
what should i do if the bullet is going up
@maxxxxiors
3 жыл бұрын
what should i do if the bullet is falling down
Is anyone else having issues with the OnTriggerEnter2d not triggering?
@BMoDev
2 жыл бұрын
Make sure spelling/capitalizations correct. Make sure IsTrigger is checked in inspector on your Collider2D component
@DeadeyeOutdoorman
2 жыл бұрын
@@BMoDev I'm using visual studio code and simply needed to add the Unity Code Snippets Extension, thank you.
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
Why aren't we funding this?
3:49
7:36
6:01