2D Shooting in Unity (Tutorial)

  Рет қаралды 1,271,457

Brackeys

Brackeys

Күн бұрын

Let's learn how to shoot enemies!
● Get the The Complete C# Masterclass for only $9,99: bit.ly/2xfXE6J
● Instagram: / brackeysteam
● Download the Project: github.com/Brackeys/2D-Shooting
● Get the 2D Sprites: bit.ly/2p6VcvH
❤️ Donate: www.paypal.com/donate/?hosted...
····················································································
♥ Subscribe: bit.ly/1kMekJV
● Website: brackeys.com/
● Facebook: / brackeys
● Twitter: / brackeystweet
········································­­·······································­·­····
► All content by Brackeys is 100% free. We believe that education should be available for everyone.
❤️ Donate: www.paypal.com/donate/?hosted...
········································­­·······································­·­····
♪ Local Forecast - Elevator Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0 License
creativecommons.org/licenses/b...
♪ "ES_Dress Code_Black - oomiee" by Epidemic Sound

Пікірлер: 1 500
@christiang.9198
@christiang.9198 5 жыл бұрын
10:54 "Then we want to die" - Brackeys 2018
@jaqenhghar5794
@jaqenhghar5794 4 жыл бұрын
"well then we want to..., Die" ftfy
@kianhunter7767
@kianhunter7767 4 жыл бұрын
Story of my life
@igorthelight
@igorthelight 4 жыл бұрын
And then: "I live... again!"
@johndobersworth4224
@johndobersworth4224 4 жыл бұрын
@@igorthelight Then off in the distance: "CRUDUX CRUO!"
@igorthelight
@igorthelight 4 жыл бұрын
@@johndobersworth4224 Right :-)
@glow_upacademy
@glow_upacademy 5 жыл бұрын
Not gonna lie but he is better at speaking then my teachers, he inspires people to do stuff, he makes people positive by his smile dude, i just love watching him
@Brackeys
@Brackeys 5 жыл бұрын
Thanks man, really appreciate the kind words! :D
@glow_upacademy
@glow_upacademy 5 жыл бұрын
No man, thank you! Thank you for connecting with your viewers even tough you have 570,000 subscribers. It really shows that you're one of those rare youtubers who actually interact with their viewers which makes me feel happy and exited every time I watch your videos!
@Swagsy
@Swagsy 5 жыл бұрын
Yeah, exactly! I became a game developer because of him! Thank you for everything!
@kingding9542
@kingding9542 5 жыл бұрын
To be honest, he's definitely the person I'm gonna go to whenever I get started with unity. The videos seem so helpful A different kind of helpful, like I'd actually learn from them
@LINK1V4N
@LINK1V4N 5 жыл бұрын
Gay
@sykoo
@sykoo 5 жыл бұрын
Glad to see both of the methods covered! :D I'm personally a prefab-guy, because screw performance lol
@SadSmileGames
@SadSmileGames 5 жыл бұрын
Object Pooling my dude.
@ankurbanerjee6607
@ankurbanerjee6607 5 жыл бұрын
really?? performance is my top priority than anything else, like MY GAWD!!
@ankurbanerjee6607
@ankurbanerjee6607 5 жыл бұрын
yea, its the real sykoo, so what??
@ankurbanerjee6607
@ankurbanerjee6607 5 жыл бұрын
no! friend
@vaskedagame880
@vaskedagame880 5 жыл бұрын
Screw performance? Well not like you are making anything performance intensive like triple a titles.
@Aztek2401
@Aztek2401 5 жыл бұрын
Your tutorials are so easy to follow, and really fun. They are really positive, and user friendly too. You have helped me so much, as a beginner game dev. Thanks Asbjorn! :)
@dampee6
@dampee6 4 жыл бұрын
If it seems like even after you edit the CharacterController2D script your FirePoint doesn't flip on the y-axis, click on your Local/Global button at the top of the editor. The FirePoint is flipping, but if you have one of those on and not the other, it will appear as if it's not. Regardless, as long as you've inserted the code as instructed, the bullet will come out of the FirePoint in the correct direction no matter if you have Local or Global selected.
@andreaagate6775
@andreaagate6775 4 жыл бұрын
Thx man, it was driving me crazy xD
@crampribYT
@crampribYT 4 жыл бұрын
Made my day. This comment should be pinned up.
@user-cu5ky8qz2n
@user-cu5ky8qz2n 4 жыл бұрын
Сябос из Украины, чел)))
@lukeyoungblood5233
@lukeyoungblood5233 4 жыл бұрын
Thank you so much
@sarahr.4890
@sarahr.4890 4 жыл бұрын
Saved me and my project. Thank you man!
@BDilloughery
@BDilloughery 5 жыл бұрын
Dude, I teach an intro to game design class and these 2D videos are the perfect start to the school year. Keep it going!
@JarJarBinkz68
@JarJarBinkz68 3 жыл бұрын
after 20 + years of playing video games I finally understand how they are made :)
@func_e
@func_e 2 жыл бұрын
:D
@Kanibulus
@Kanibulus Жыл бұрын
:]
@fyxtheinferno149
@fyxtheinferno149 3 жыл бұрын
really loving these unity tutorials! it's always nice to see how to make a game from the perspective of an experienced game dev
@dynamite1779
@dynamite1779 2 жыл бұрын
For those who cant get the Firing Point to flip with the sprite, copy lines 114-124 which can be seen seen at 2:47, this ties in with the lines at the bottom.
@binarybeanie6443
@binarybeanie6443 Жыл бұрын
OMG thanks dude. I’ve been trying to fix it in my game but this totally helps. 👍
@russianvideovlogguy
@russianvideovlogguy 10 ай бұрын
Interesting, I could not figure this out and somehow managed to get the bullets to switch direction when the player turns but the firepoint is still fixed. So basically it's still broken, I will look into your suggestion. Thank you!!
@niutah
@niutah 5 жыл бұрын
I just love your tutorials. Even If I don't really need that at this moment it's so useful and helpful for further struggles. Always find what I was looking for and even more. And you do always smile and make it all interesting. Just great job, thank you :D.
@cgillis3989
@cgillis3989 3 ай бұрын
I'm seven minutes in and you're already providing a lot of clarity to my shooting script. Other tutorials works but their rather overly complicated and don't explain much- you fix both issues. Very good job :D
@adam-n-modi
@adam-n-modi 2 жыл бұрын
Perfect tutorial, right to the point and within 20min I've seen a lot on this topics that takes hours to explain the same idea
@miceonvenus647
@miceonvenus647 5 жыл бұрын
I legit cracked up when the cameraman shot Brackeys. Great video as always, man, thank you! How about a stealth themed video?
@ankurbanerjee6607
@ankurbanerjee6607 5 жыл бұрын
Hey Asbjorn, I am really happy that you returned to the coding part as u were just showcasing stuff earlier. WooHoo!!!
@NHGeneral
@NHGeneral 2 жыл бұрын
@CHUA RUI FENG Moe me too, because he's a legend
@andrewhouth3299
@andrewhouth3299 3 жыл бұрын
You SAVED me life. I've been trying for 2 hours to figure how to get the bullet to shoot across. (Using other tutorials) This one nailed it step by step. Thanks!!!!
@kazimashiatsumaira1684
@kazimashiatsumaira1684 3 жыл бұрын
Amazing, all your tutorials are dope, easy to understand and simply the best unity tutorials. Please provide us with more awesome tutorials like these. Looking forward. Much love😊
@taurdenga
@taurdenga 5 жыл бұрын
For people using the Prefab approach, please do remember to utilize object pooling in order to maximize performance. I believe Brackeys has a video set up for this.
@abdullahdief1491
@abdullahdief1491 5 жыл бұрын
Can you make a tutorial about melee weapons BTW love you videos
@louislemur
@louislemur 4 жыл бұрын
he has one
@osazuwauzebu2999
@osazuwauzebu2999 4 жыл бұрын
LouisLemur he might have one now as this comment was made a year ago
@Rydn
@Rydn 5 жыл бұрын
Dude the way you approach your videos is so positive. You emit good vibes
@lukeblaker5625
@lukeblaker5625 4 жыл бұрын
I know this is an old video so I don't know if you'll see this but this helped me so much. I was at a dead end with my game and it was really disheartening. I felt like I couldn't progress if I hadn't got this part sorted and even though it's not exactly the type of shooting I wanted, I was lucky to find this and I'm glad I switched it out to shooting just along the X axis. Thank you!!
@andeheri
@andeheri 4 жыл бұрын
I bought the masterclass; so far I´m loving it!
@gentleasp6589
@gentleasp6589 Жыл бұрын
Idk if you still use this account but did it work? Also is it still up even?
@zahhym
@zahhym 4 жыл бұрын
Thank you so much, this helped me more than anything ive seen yet (not saying much since this is the second video ive watched but still Its good)
@huntserston3579
@huntserston3579 5 жыл бұрын
Man love your tutorials ever since I'm learning from ya I want to add a Easter egg of you in one of my games because you deserve one!!
@makke2170
@makke2170 5 жыл бұрын
Im so glad I found this video :D super easy to understand, and exactly what I was looking for. Thank you!
@linshu6141
@linshu6141 4 жыл бұрын
If u want that the bullet disappears after leaving the camera screen use: public class Bullet : MonoBehaviour { public float speed = 20f; public int damage = 20; public Rigidbody2D rb; public GameObject impactEffect; // Start is called before the first frame update void Start() { rb.velocity = transform.right * speed; } private void OnTriggerEnter2D(Collider2D hitInfo) { Enemy enemy = hitInfo.GetComponent(); if (enemy != null) { enemy.TakeDamage(damage); } Destroy(gameObject); } void OnBecameInvisible() { enabled = false; Destroy(gameObject); } } It's important for the level design i think.
@beardeddragon8988
@beardeddragon8988 4 жыл бұрын
Thank you
@kzh-music1999
@kzh-music1999 3 жыл бұрын
Very helpful tip man! Works perfectly!!!
@missingno.5024
@missingno.5024 3 жыл бұрын
Thank you!
@nidhinmathew2925
@nidhinmathew2925 2 жыл бұрын
Thankzzz Man
@scythur1341
@scythur1341 2 жыл бұрын
thanks g
@Stevepegamer
@Stevepegamer 4 жыл бұрын
If anyone had an issue with the animation not disappearing after it's end, the solution is to add a script to the gameobject that is animated by it (in that case, impactEffect and destroyEffect) that has a function that destroys the gameobject. Than all you've gotta do is to add an extra frame to the animation and place an animation event that will trigger the destroy function
@mrmiyagi5398
@mrmiyagi5398 2 жыл бұрын
i have exactly that problem but i cant even solve it with your description :(
@shwk77
@shwk77 2 жыл бұрын
@@mrmiyagi5398 yeah I added an event and still cannot add a function to it.. it just doesn't come up in the options under functions.
@sako4802
@sako4802 2 жыл бұрын
@@shwk77 Hey, don't know if you were able to fix it or not, but here is what I did. Since we are instantiating a impact/hit effect prefab rather than changing the animation state, you need to attach a script to the hit/impact effect prefab and create a public function which the destroys the gameObject, this function would be called after the final frame of impact effects using the animation event.
@SDSFDSF631
@SDSFDSF631 2 жыл бұрын
Can u create the script and paste it as a comment it would really help
@robinzhang8877
@robinzhang8877 Жыл бұрын
@@SDSFDSF631 What I did (a pretty dumb way) is created a script in the destroyEffect prefab in the Start frame like "Destroy(GameObject, 0.5f)" which makes it looks like that destroyEffect dissapeared right after it finished animation, but you can change the time to whatever you feel is right.
@Garlicbread3419
@Garlicbread3419 5 жыл бұрын
Brackeys is back at it again with the amazing 2d tutorials
@Yemto
@Yemto 2 жыл бұрын
Thank you so much, I just started with Unity and wasn't sure how to create objects that kept the same components. Because of this video I learnt what a Prefab was, which solved my issue.
@PTGuy
@PTGuy 5 жыл бұрын
Could you go over the controller script in an upcoming video? It would be really helpful to understand what's happening in it step-by-step so when we start our own projects we don't have to rely on other people's scripts
@ashtonvaleroso5911
@ashtonvaleroso5911 5 жыл бұрын
Can you do a tutorial on making particle clouds pls. I need help for making one in my game. I don’t want to use a skybox by the way.
@Vaulcul
@Vaulcul 5 жыл бұрын
Sir, this, like all of your other tutorials are INCREDIBLE and AWESOME! Thank you for sharing your genius with the rest of us. I think it would be awesome to see a tutorial on how to create a map for 2D games like we see in Metroidvania games like Metroid, Symphony of the Night, Shadow Complex, etc. (tutorials on this subject on the internet are lacking as a whole). Thanks! :)
@snosibsnob3930
@snosibsnob3930 5 жыл бұрын
Thank you for this. You have been a great help for all of my projects.
@toreole2993
@toreole2993 5 жыл бұрын
OH NO... The udemy ads are spreading from before the videos to INSIDE the videos. ABORT MISSION
@ZatriX_ZA
@ZatriX_ZA 5 жыл бұрын
my sentiment exactly... (((
@owendorsey5866
@owendorsey5866 5 жыл бұрын
Lol
@vaishnav_mallya
@vaishnav_mallya 5 жыл бұрын
Coding your own games is easier than you think...you know..you should take this online unity course on Udemy.
@nanda_gamedev
@nanda_gamedev 5 жыл бұрын
I'm already paying for a freaking game dev college I DONT WANT UDEMY STAAAHP
@ZatriX_ZA
@ZatriX_ZA 5 жыл бұрын
loooooooooool )) and while you're at it, check out that shader development course, too ))
@enragekoala3868
@enragekoala3868 5 жыл бұрын
hey Brackeys can you do a 2D tutorial on ledge grabbing and wall jumping?
@juhakeranen
@juhakeranen 5 жыл бұрын
While you wait, there are some cool tutorials about this subject already! :) Here's one: kzbin.info/www/bejne/e4C2m5mIqs1qrpY. This stuff also really helped me a lot: juhakeranen.com/dev-mistakes-pdf/
@rpgtogether7022
@rpgtogether7022 5 жыл бұрын
I want AR tutorial..
@humphred4912
@humphred4912 5 жыл бұрын
that would be pretty cool.
@anshayaramim898
@anshayaramim898 2 жыл бұрын
kzbin.info/www/bejne/lYaloZ6agNF9sKc
@gachastorys5129
@gachastorys5129 Жыл бұрын
Hes gone now sadly...
@aoao1044
@aoao1044 2 ай бұрын
It might be a little late to mention, but if your effect can't dissapear after it finished playing, try these steps: 1. Go to the animation tab of your effect and add an event on frame n+1(3rd block on the right of 'Samples') 2. Create a destroy script and add it under your effect prefab 3. Go to the inspector of the animation event you just added, type 'Destroy' into the function column, no brackets And that shall do the work. My script looks like below: public class DestroyGameObject : MonoBehaviour { public void Destroy() { Destroy(gameObject); } } I got this solution from chat-GPT and it worked like magic. Hope it helps :)
@goldman3990
@goldman3990 2 ай бұрын
Got it working thanks!
@lilgary5114
@lilgary5114 4 жыл бұрын
Dude I absolutely love your videos, and this helped a lot. I would not be using unity if it was not for you! Keep making AWESOME content!!!!
@elijah2208
@elijah2208 3 жыл бұрын
Alright if anyone is wondering how they can get their character to shoot while crouching here's how: 1. Make another firepoint for the crouching position 2. go into the weapon script and change it to this: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Weapon : MonoBehaviour { public Transform firePoint; public GameObject bulletPrefab; public Transform firePointcrouch; // Update is called once per frame private void Update() { if ((Input.GetButton("Crouch") == true && Input.GetButtonDown("Fire1"))) { CrouchShot(); } else if (Input.GetButtonDown("Fire1")) { Shoot(); } void CrouchShot() { Instantiate(bulletPrefab, firePointcrouch.position, firePointcrouch.rotation); } void Shoot() { Instantiate(bulletPrefab, firePoint.position, firePoint.rotation); } } } 3. back into unity, place the crouching firepoint into the new firepoint slot on the weapon component That should make it so you can crouch and shoot.
@revan5535
@revan5535 3 жыл бұрын
Ty bro
@microwave911
@microwave911 2 жыл бұрын
actual legend
@beastmasterbg
@beastmasterbg 2 жыл бұрын
this is actually genius
@marcusik178
@marcusik178 Жыл бұрын
or just move the firepoint with the animation of crouching
@damsen978
@damsen978 4 жыл бұрын
Can you make a video on how to do 360 degree aiming on a 2D platform game like the one shown here? Making the character's arm and head rotate depending on where your mouse cursor is positioning.
@dharmeshkumar2763
@dharmeshkumar2763 5 жыл бұрын
You are a very good teacher. You know how to explain a complicated things in a simple way. I like this tutorial 😊. Keep making such tutorials.
@darkwyvern9796
@darkwyvern9796 5 жыл бұрын
BEST shooting tutorial for 2D out there, thank you! I got a question tho and I really hope you'll answer, how did you turn the impact animation into a useable prefab? I'm banging my head over this and it should'nt be so hard haha
@Noob-nc5jq
@Noob-nc5jq 5 жыл бұрын
Man, I can’t sleep without hearing your voice lol, so soothing and professional
@wreckcars
@wreckcars 5 жыл бұрын
Really an amazing tutorial! Love from Pakistan
@ivanalbertti3447
@ivanalbertti3447 5 жыл бұрын
im a big fan of your videos. i've seen all your videos so far! and learned almost EVERYTHING of unity with you. Can you make a tutorial for a turn based combat like final fantasy or any rpg turn based?
@NathanSifuGaming
@NathanSifuGaming 4 жыл бұрын
You guys are helping me an amazing game 😄 can’t thank you guys enough for this
@septiawanrizky1013
@septiawanrizky1013 5 жыл бұрын
Brackeys, your video is make me to learn about Unity. Please make 2D Melee Attack in Unity. Thank you.
@Strategic.
@Strategic. Жыл бұрын
If you have a problem with the animation not disappearing after it's over, the solution is to add a script to the Object "DeathEffect" that has a function that destroys the gameobject after a bit of time (the time the animation takes). This Code worked for me : using System.Collections; using System.Collections.Generic; using UnityEngine; public class DeathEffect : MonoBehaviour { void Start() { Invoke("EndEffect", 0.5f); } void EndEffect() { Destroy(gameObject); } }
@RhinoCringe
@RhinoCringe Жыл бұрын
I love you so much : ) thank you
@Strategic.
@Strategic. Жыл бұрын
@@RhinoCringe Anytime 😊
@papuz5854
@papuz5854 Жыл бұрын
It works!
@1wntv
@1wntv 8 ай бұрын
It worked like a charm, thank you so much! :D
@frostymug3123
@frostymug3123 5 жыл бұрын
Awesome video's! Newbie to Unity really appreciate your thorough explanations.
@lopus312
@lopus312 5 жыл бұрын
this video came out just when i needed it, thanks
@paz7058
@paz7058 4 жыл бұрын
Who else is just trying to be like Dani
@fabianchelba1831
@fabianchelba1831 4 жыл бұрын
Same... But kinda THICK
@paz7058
@paz7058 4 жыл бұрын
X Gamer X Really THICCCCC
@TheEm2clarkson
@TheEm2clarkson Жыл бұрын
Me
@TheEm2clarkson
@TheEm2clarkson Жыл бұрын
But is it just me or is the gun locking kinda THICK
@Push-ups_Each_Day
@Push-ups_Each_Day 10 ай бұрын
Is it me or is this comment lookin kinda THICK?
@andrewkerr9438
@andrewkerr9438 5 жыл бұрын
I just made a AR app in unity, I feel so accomplished in life!
@romerpagaduan3067
@romerpagaduan3067 5 жыл бұрын
Cool!!!!
@MaThMaTa1000
@MaThMaTa1000 5 жыл бұрын
Name of the app so we can spam 5 stars? :D
@andrewkerr9438
@andrewkerr9438 5 жыл бұрын
@@MaThMaTa1000 hey thanks man, but it's just a fun little project I made, it isnt on the app store.
@WTRMLN-zu6ob
@WTRMLN-zu6ob 5 жыл бұрын
Dj Khaled (andrew) suffering from success
@vincebilotti8301
@vincebilotti8301 2 жыл бұрын
This video has so much value, keep up the good content!!
@ashish1162
@ashish1162 5 жыл бұрын
Extremely helpful videos man...Keep it up good work!
@MrDona5
@MrDona5 3 жыл бұрын
If anyone has a problem when shoot to right or left and bullet doesn't appear try to modify the position Z = 0 on the FirePoint, it's because bullet spawns out of the camera. PD: Hope this solve your problem :)
@janstachu7744
@janstachu7744 3 жыл бұрын
Dude I love you
@nlproducoes9745
@nlproducoes9745 Жыл бұрын
MAN I FUCKING LOVE YOUUUU
@reubenmathew3112
@reubenmathew3112 Жыл бұрын
Yooooo finally, you some hella legend😭😭😭
@albarnie1168
@albarnie1168 5 жыл бұрын
Using colliders on the bulletsbis quite inefficient. It is much better to do a linecast from the bullet's last position to it's current one. This also means you can make bullets that can go through walls and find the out point.
@Swirlstudios
@Swirlstudios 5 жыл бұрын
This method also solves the problem of collision detection not resolving a hit when the bullet is moving too fast.
@MrCooldude4172
@MrCooldude4172 5 жыл бұрын
Could you elaborate please?
@Swirlstudios
@Swirlstudios 5 жыл бұрын
On your bullet script, you have a variable that keeps track of the last position it was in. Every frame you do a linecast from the last position, to the current position. If the bullet collided with something during that last frame of movement, the linecast will pass through what the bullet hit. This solves the collision system not resolving a hit, because no matter how far the bullet travels in that one frame, the linecast will still pass through whatever the bullet hit. Regarding the wall part, if you want penetration, when you do the linecast, you can check if the linecast passed through a wall. If it did, you can use vector math to figure out where the bullet came out of the wall and at what angle.
@MrCooldude4172
@MrCooldude4172 5 жыл бұрын
@@Swirlstudios thanks dude! Any idea whether we can do this on gamemaker?
@Swirlstudios
@Swirlstudios 5 жыл бұрын
@cooldude 4172 I don't have any experience with that engine, but a quick google search brought up the collision_line method which may help you docs.yoyogames.com/source/dadiospice/002_reference/movement%20and%20collisions/collisions/collision_line.html
@MysticAnimations
@MysticAnimations 5 жыл бұрын
FINALLY! I have been looking for AGES!
@simoncodrington
@simoncodrington 5 жыл бұрын
Always great videos man, only wish other KZbin videos had this level of polish :)
@loot6
@loot6 4 жыл бұрын
13:17 for the raycast based shooting.
@npmeyer77
@npmeyer77 5 жыл бұрын
"Let's not jump the gun on this one" - Dad Joke level 100
@pixelparadeart
@pixelparadeart 4 жыл бұрын
Love this video! I finally understand movement and shooting
@seifmustafa2004
@seifmustafa2004 5 жыл бұрын
Please , aiming tutorial next :) have been flipping my head over this for weeks
@KarlooAudi
@KarlooAudi 5 жыл бұрын
Brackeys. I know this request might be pointless, but could you please, I beg you, make tutorial with shader graph related to rain ripples and rainy window drops and if you find time, character that looks like a ghost, but shaped like character :)
@AmantePatata
@AmantePatata 5 жыл бұрын
You could make a ghost by making a character transparent, ramping up its emission + using an bloom aftereffect to blur the edges
@KarlooAudi
@KarlooAudi 5 жыл бұрын
I want the ghost that looks like in call of duty black ops 4 kzbin.info/www/bejne/npDJfKWwbZqibqs 10:46 skip
@nikkytek4552
@nikkytek4552 5 жыл бұрын
How do you make it wait time before next fire???(very important)
@Evan-ri4yd
@Evan-ri4yd 5 жыл бұрын
Try using this public class Gun : MonoBehaviour { public Transform firePoint; public GameObject bulletPrefab; public float Cooldown1 = 0f; // Update is called once per frame void Update() { Cooldown1 -= Time.deltaTime; if (Input.GetButtonDown("Fire1")) { if (Cooldown1
@marcusmorrow3900
@marcusmorrow3900 4 жыл бұрын
thanks again. this stuffs already hard to learn. without your channel id really be lost whenever I get in front of the computer.
@VIMES_
@VIMES_ 4 жыл бұрын
Great tutorial. Helped me a lot! Thank you.
@alexflim
@alexflim 5 жыл бұрын
I really hope to see "shooting as particle system" guide in some future, cause alot of prefabs hit ur frame rate pretty hard
@toddholford2239
@toddholford2239 5 жыл бұрын
Has anyone else had an issue where your impactEffect prefab plays through it's animation and then doesn't go away?
@arjunakula2624
@arjunakula2624 5 жыл бұрын
make sure the animation isn't looping
@billynewcomb2485
@billynewcomb2485 5 жыл бұрын
I have the same problem. The animation will play and then stop, but the impact is sticking to the wall. The animation loop is off.
@duskmoth
@duskmoth 5 жыл бұрын
I had the same problem, i downloaded an empty png then add it to end of the impact animation and enemy death animation it fixed mine but im sure there is much better solution
@massimogrilli6467
@massimogrilli6467 5 жыл бұрын
Mee too. Has anyone solved it?
@billynewcomb2485
@billynewcomb2485 5 жыл бұрын
You need to put an empty frame at the end of the animation. I also had to create a destroy object script for it to delete it from the hierarchy.
@reviewonunboxinggames17
@reviewonunboxinggames17 2 жыл бұрын
thanks, I have been struggling to make my player fire but this tutorial helped me a lot
@noahschulz1269
@noahschulz1269 5 жыл бұрын
Big fan of your channel. Could you make a playlist so it is easier to follow from start to finish
@linshu6141
@linshu6141 4 жыл бұрын
If ur enemy doesn't disappear if it's health goes under 0 health just delete the line "Instantiate(deathEffect, transform.position, Quaternion.identity);" in the enemy script.
@emirkucuk7972
@emirkucuk7972 8 ай бұрын
Thank you man, saved my day!
@guigondi7671
@guigondi7671 5 жыл бұрын
@Brackeys Please, do a 2D tutorial on how to make melee atacks and combos. I'd really like to try to make a 2D Devil May Cry
@bigfan6936
@bigfan6936 5 жыл бұрын
Gui G Dias yeah thats a good idea
@phirewind
@phirewind 5 жыл бұрын
In your animations, attach a collider trigger and animate it to follow the weapon, then apply damage with that collider similar to how the bullet detects impacting an enemy
@guigondi7671
@guigondi7671 5 жыл бұрын
that's a good start but how should i go about balancing the weight of my enemies and forces of each attack to allow for things like juggle combos, launchers, wall bounce, these kinds of things?
@Dejin1
@Dejin1 5 жыл бұрын
Hey I saw your comment on making a 2d devil may cry i'm interested in helping if you want some help?
@Epicvampire800
@Epicvampire800 5 жыл бұрын
@@guigondi7671 well you could make it that when you perform a launching attack it moves the enemy up a certain distance, and that when you when you attack an enemy they enter a stagger animation that keeps them from attacking. Each hit could move the enemy up a certain distance to keep them in the air, or each hit could freeze them in place for a split second so you can continue your combo. Then make the last hit of your combo a finisher that launches the enemy far away so that you can't do zero to death combos. Understanding basic physics equations like the kinematic equations, and work will help you precisely control the physics of the combo system to make it feel the way you want.
@ZeroCrits
@ZeroCrits 3 жыл бұрын
Too bad I just found out about this pretty epic channel now. But I'm very glad that he made it, thanks for the epic tutorials
@tamaskisely9122
@tamaskisely9122 5 жыл бұрын
Love your videos! Keep it on! ;) Question: Is there any pre video for this shooter game?
@kirill5437
@kirill5437 4 жыл бұрын
7:19 just my bookmark
@JUPEETERREXE
@JUPEETERREXE 3 жыл бұрын
Hi! Can someone help me? I've been trying to add an animation when my character is shooting but I can't find a way to make it work... Either the character stays stuck at the end of the animation or the animation straight up doesn't play ;^; I've tried animation events and pretty much everything else...
@alexle1484
@alexle1484 3 жыл бұрын
for the "the character stays stuck at the end of the animation " problem, destroy the character animation when it's done and instantiate the origional object
@dacracking5768
@dacracking5768 5 жыл бұрын
I like how you did it with different assets, coz then if we wish to essentially follow, we have to redo everything with the new asset. And so it helps us Rerember and stuff. Pretty meet idea.
@VlogwithKing
@VlogwithKing 5 жыл бұрын
Haha the look on your face when the handgun showed up. Amazing. 😂
@juhakeranen
@juhakeranen 5 жыл бұрын
Haha
@CamoB-ub9my
@CamoB-ub9my 4 жыл бұрын
i ran into an issue where my bullet wasnt moving at all, i had to re-assign the rigidbody in the inspector, in case this helps anyone
@zacharylamar7997
@zacharylamar7997 4 жыл бұрын
I ran into the same bug, but it didn't work. What do you mean by re-assign
@CamoB-ub9my
@CamoB-ub9my 4 жыл бұрын
Zachary Lamar so if you click on it in the inspector, then drag it into the slot where it is on the script
@thesasquatch1238
@thesasquatch1238 2 жыл бұрын
Hi, If someone could help me, I am doing the prefab method but whenever I shoot the bullet just stops in front of the enemy and doesn't destroy or print Enemy(or "Frog" in my case) in the console.
@turtle6414
@turtle6414 2 жыл бұрын
I DON'T HAVE A SOLUTION BUT IM BOOSTING THE COMMENT SO MORE PEOPLE CAN SEE IT AND MAYBE ONE OF THEM CAN HELP YOU
@moldy9041
@moldy9041 2 жыл бұрын
do you have isTrigger enabled under your bullet's box collider ?
@noahwattel4226
@noahwattel4226 2 жыл бұрын
Same and if I turn on isTrigger it just phases through Nevermind: Solution: I wrote OntriggerEnter2D instead of OnTriggerEnter2D
@URORONG
@URORONG 3 жыл бұрын
Dude, you are such an inspiration to me. Thanks a lot.
@jaimealbaruiz7570
@jaimealbaruiz7570 Ай бұрын
huge thanks dude, my shooting just skyrocketed thanks to you
@amircool2529
@amircool2529 5 жыл бұрын
*Can you make a video about C# tutorial please?*
@demonicious_
@demonicious_ 5 жыл бұрын
kzbin.info/www/bejne/poTMenubZ9qNaNk
@WaltherEvans95
@WaltherEvans95 5 жыл бұрын
12:11 "Super coal" XD
@daniinkidar99
@daniinkidar99 Жыл бұрын
Im such a noob at unity yet you made this very clear! Good job you get a sub
@gxishk15
@gxishk15 5 жыл бұрын
It's awesome!!!Thank you Brackeys!!
@eddiemuff0371
@eddiemuff0371 4 жыл бұрын
I have run into a problem, for both the enemy and the projectile the last frame of the deathEffect/impactEffect lingers on screen permanently. Can some one help please?
@bomber_g
@bomber_g 3 жыл бұрын
same here!, did you find a solution?
@ozmega
@ozmega 3 жыл бұрын
@@bomber_g in the video the effect never "dies" he just added an extra animation frame where it goes invisible, but they are still there.
@Stalkie
@Stalkie 3 жыл бұрын
@ozmega do you know how to add empty keyframes? I can't seem to make it happen
@santoshparihar6820
@santoshparihar6820 5 жыл бұрын
Thanks bro. Just one request from me - you can leave it if you don't find it worth teaching. Can you make video on a game where we hit the api to send data to server and then again hit the get api to receive the data back from server... It could be a series of tutorials where first we login through social media and save our email and pswd to server and then save the details of user like coins,win%,powerups,loose% etc. What do you think ?
@Sakros
@Sakros 5 жыл бұрын
Thumbs Up.
@eduardovalentin2727
@eduardovalentin2727 4 жыл бұрын
Man, i really love your content. New sub
@oren7404
@oren7404 5 жыл бұрын
Glad to see both of the methods covered! :D I'm personally a RayCast-guy, because Vector performance lol but I use ; Ray ray = new Ray(transform.position , transform.left); RaycastHit Block ; if(Physics.Raycast(ray , out Block , 6f)) { Enemy enemy= Block.transform.GetComponent(); if(enemy != null) { enemy.TakeDamage(10); } }
@tudormuntean3299
@tudormuntean3299 3 жыл бұрын
Why is KZbin showing me this exactly after he left ?
@DayMoniakkEdits
@DayMoniakkEdits 5 жыл бұрын
Don't forget to destroy the impacts effects after a few seconds because of performance issues
@thewiitard5515
@thewiitard5515 5 жыл бұрын
How do you do that?
@DayMoniakkEdits
@DayMoniakkEdits 5 жыл бұрын
@@thewiitard5515 Destroy (gameObject, lifetime);
@thewiitard5515
@thewiitard5515 5 жыл бұрын
@@DayMoniakkEdits It says that lifetime is an error
@DayMoniakkEdits
@DayMoniakkEdits 5 жыл бұрын
The Wiitard lol don't write "lifetime", put the amount of time in seconds, for example "3f" to destroy the bullet after 3 secs :)
@thewiitard5515
@thewiitard5515 5 жыл бұрын
@@DayMoniakkEdits my problem is that the animation doesn't delete when its done it just stays at the last frame of animation
@yoctometric
@yoctometric 5 жыл бұрын
Very highly polished tutorial!
@Yoshi_green
@Yoshi_green 5 жыл бұрын
19:50 if you want to wait for exactly 1 frame, then imo it's more accurate to use yield return Time.deltaTime because that's the length of the last frame. of course it's not 100% accurate because of varying frame lengths but it should be closer than 0.02 seconds
@Haywirezen
@Haywirezen 5 жыл бұрын
Great video can you make a tutorial on touch screen controls for an app?
@juhakeranen
@juhakeranen 5 жыл бұрын
You know, while they're making their videos, there are quite a few of these out there. Also depends on what type of controls you want. This one is good for most use cases: kzbin.info/www/bejne/pHi8gJWln9KehZY. Also, this stuff really helped me out: juhakeranen.com/dev-mistakes-pdf/
@GameDevAraz
@GameDevAraz 5 жыл бұрын
3 ways to do it... Using ray-cast but spawning a prefab to follow from birth to end of ray cast! Making it more realistic and good! And you can easily adjust speed of following or reduce or what ever lol! Its very effective, stable and great way to make a battlefield 4 like shooter! (Realistic) the key between the two lol
@DanianDL
@DanianDL 5 жыл бұрын
I was really hoping he would show this method, thank you for confirming it's existence!
@GameDevAraz
@GameDevAraz 5 жыл бұрын
Danian D. No problemo! But i havent tested it yet, i see no reason this wiuldnt work, infact the first point he said which was the one i used in my 2d game and believe me... that was messy lol...specially with my inability to understand a good approach to coding! But his method i believe is closer to the perfection that is real life physics!
@hyperindigo4924
@hyperindigo4924 5 жыл бұрын
Lol, that’s just the same as using a prefab. The only difference is the mode of travel for the prefab. Real life physics also have bullet drop, so that method alone wouldn’t make anything more realistic.
@DanianDL
@DanianDL 5 жыл бұрын
I think he meant more stable because the hit calculation doesn't rely on an actual prefab flying towards the target. Knowing some of the weird glitches with physics in game engines, raycast seems like the safer alternative. Also let's you do whatever you want with the now-only visual bullet prefab.
@GameDevAraz
@GameDevAraz 5 жыл бұрын
Danian D. Yes, also you can tell your ray-cast to fall towards gravity over distance with some coding ways... Making it stable AND realistic.
@joshlovesfood
@joshlovesfood 4 жыл бұрын
This guy is great! Thanks for all the help!
@spiritos2216
@spiritos2216 5 жыл бұрын
This is the happiest man on youtube (Machalla)
@Kai-pu2gh
@Kai-pu2gh 5 жыл бұрын
How do I kill / destroy the impact effect?
@ChupachuGames
@ChupachuGames 5 жыл бұрын
You could put a script on it that checks if the animator is no longer animating, and if it isn't, destroy the game object
@jonathanerock
@jonathanerock 5 жыл бұрын
Put a script as a component on the ImpactEffect object. Brackeys shows us how to in the second half of this video: kzbin.info/www/bejne/Z3zHhGOHr96beck
@goldengamer8510
@goldengamer8510 5 жыл бұрын
Great tutorial, but one personal problem I'm having is that my bullets like to be invisible. Now I understand their new to the world, but I kind of don't like it when their invisible...
@coachmcguirk8277
@coachmcguirk8277 5 жыл бұрын
Check the bullet prefabs Sorting Layer / Order in layer, it's probably layered behind stuff.
@nicholascarson2554
@nicholascarson2554 4 жыл бұрын
It's either too low on the sorting layers or your FirePoint is too close to your Player
@hoxorious
@hoxorious 5 жыл бұрын
Like always, perfect! 👍👍
@emerykj1830
@emerykj1830 3 жыл бұрын
For anyone trying to get their bullet to shoot forward instead of right, use forward in place of right, or if that doesnt work, use up. You 2D game might be oriented so that forward to your camera view is actually the green axis, or up.
MAKE ORGANIC LEVELS!! Unity Sprite Shape
11:58
Brackeys
Рет қаралды 351 М.
How to program in Godot - GDScript Tutorial
58:10
Brackeys
Рет қаралды 164 М.
The magical amulet of the cross! #clown #小丑 #shorts
00:54
好人小丑
Рет қаралды 21 МЛН
[Vowel]물고기는 물에서 살아야 해🐟🤣Fish have to live in the water #funny
00:53
Can You Draw The PERFECT Circle?
00:57
Stokes Twins
Рет қаралды 59 МЛН
Kitten has a slime in her diaper?! 🙀 #cat #kitten #cute
00:28
The Making of Karlson 2D (Game)
11:41
Dani
Рет қаралды 6 МЛН
Unity: 2D Shooting
4:17
Root Games
Рет қаралды 45 М.
Brackeys Game Jam 2020.2 - BEST GAMES!
11:31
Brackeys
Рет қаралды 538 М.
How to make a HEALTH BAR in Unity!
21:06
Brackeys
Рет қаралды 1,1 МЛН
How to make a Video Game - Godot Beginner Tutorial
1:17:12
Brackeys
Рет қаралды 722 М.
9 DEVS Make a GAME without COMMUNICATING (Where did it go Wrong?)
21:33
Blackthornprod
Рет қаралды 1,1 МЛН
How to make 2D GLOW in Unity!
15:56
Brackeys
Рет қаралды 578 М.
The Future of Game Development
8:58
Brackeys
Рет қаралды 1 МЛН
How to MAKE YOUR GAME LOOK GOOD!
13:02
Brackeys
Рет қаралды 582 М.
The magical amulet of the cross! #clown #小丑 #shorts
00:54
好人小丑
Рет қаралды 21 МЛН