Shoot and Destroy Enemy with Bullets in Unity (with sounds!) | Game Dev Tutorial

  Рет қаралды 21,635

Lost Relic Games

Lost Relic Games

Күн бұрын

Пікірлер: 120
@LostRelicGames
@LostRelicGames 4 жыл бұрын
Start Making Platformers with my new Unity Asset Kit - u3d.as/2eYe
@alexmurillo2541
@alexmurillo2541 4 жыл бұрын
Glad to see John Wick became a game developer after he retired.
@nipanderus
@nipanderus 4 жыл бұрын
I still don't know why but the tutorials you make are always easier to understand than most others
@hhcdghjjgsdrt235
@hhcdghjjgsdrt235 4 жыл бұрын
yeah Brackeys are just overrated.
@floatingchimney
@floatingchimney 4 жыл бұрын
@Rizumu, because his tutorials are way longer. How often do you see tutorials 40 minutes long? There are plenty of similar tutorials that are 10 minutes long on the same topic. I'm not saying a tutorial being 40 minutes long is a good thing - it's as bad as it can be good.
@davidzechowy
@davidzechowy 4 жыл бұрын
​@@floatingchimney but brackeys uses 5 videos to explain 1 thing
@floatingchimney
@floatingchimney 4 жыл бұрын
David Zechowy No he doesnt.
@Crypticlazr
@Crypticlazr 4 жыл бұрын
Never apologize for showing us the details. I'm the type of person that literally needs that step by step explication. Thank you so very much for putting these up. Brackeys ONLY uses pre-built scripts which literally teaches me nothing.
@mikaelhollsten247
@mikaelhollsten247 4 жыл бұрын
EXACTLY! NEVER ever apologize for explaining beginner stuff in a video for beginners!
@dragomirpetrov5600
@dragomirpetrov5600 4 жыл бұрын
I started game development in Jan this year. I've been attending a game dev course since July of this year. In 40min I've learned more, and feel more comfortable with coding from this channel, than the "pro" that is "teaching" the class.... Thank you John! Thank you for creating this channel! I've already spread the word to 40 other beginners.
@4F6D
@4F6D 4 жыл бұрын
If you want to destroy the bullets when they move out of screen(which is much cleaner), just add: void OnBecameInvisible() { Destroy(gameObject); } to the bulletscript
@LostRelicGames
@LostRelicGames 4 жыл бұрын
Great tip Rene! It's a good day when you learn something new
@4F6D
@4F6D 4 жыл бұрын
@@LostRelicGames Thanks man, your videos really helped me a lot to better understand the Unity Eco System. It is really really great that you explain everything even if it seems trivial.
@first_pixel
@first_pixel 4 жыл бұрын
This is awesome! Your work is invaluable!!! Creating professional and stuffed tutorials totally for free? either you are up to something or you are an angel game dev. giant thumb for you!
@blank2303
@blank2303 4 жыл бұрын
zgadzam się :D
@LostRelicGames
@LostRelicGames 4 жыл бұрын
Haha thanks Pawel! When I started game dev I was fortunate enough to meet some people who really helped me to learn. Their time and generosity changed the course of my life. I suppose I'm trying to replicate that process and bring game dev into people's lives, hopefully improving it for the better. To be honest, the tutorials have compromised my own game work significantly, but I hope in time somehow It will all converge in some positive and meaningful way. We will see! Thanks for the comment:)
@VideoGameAnimationStudy
@VideoGameAnimationStudy 4 жыл бұрын
Hmm, my character just continues to shoot whether I'm pressing fire or not....I'm trying to look and see if I can work it out myself, but I may need some helpies!
@LostRelicGames
@LostRelicGames 4 жыл бұрын
How did you go mate? Shoot me your script file and I'll take a look! john@lostrelicgames.com
@matejobbagyi4249
@matejobbagyi4249 3 жыл бұрын
Have you untick the Loop Time option?
@linzenmeyer
@linzenmeyer 3 жыл бұрын
I suggest using Layers and sort Orders to get your objects on the planes you want and if you change the gravity scale of the bullet to 0 you won't have to freeze Y. If you get into the habit of changing the Z axis order, you will run into problems later with using Vector3. If you don't specify the Z axis in Vector3 it assumes 0!
@deliriousmansano3556
@deliriousmansano3556 4 жыл бұрын
OMG IM AMAZE WHEN THE BULLET POP UP OR INSTANTIATED! I THINK I WILL DO NOW MY OLD PROJECT TO FINISH IT AND MAKE A 2D GAME LIKE THIS. THANK YOU FOR THIS TUTORIAL
@LostRelicGames
@LostRelicGames 4 жыл бұрын
haha awesome! I hope you finish it! :)
@deliriousmansano3556
@deliriousmansano3556 4 жыл бұрын
@@LostRelicGames Thanks! God Bless You!
@ponytailjones
@ponytailjones 3 жыл бұрын
Hi, these are some of the best tutorials I've come across! One problem I'm having though is that I'm trying to add on to the controller script from your Mega Man running & jumping tutorial, using the shooting info on this one, and I think something about the grounded scripting is interfering with the shoot animation. If I'm not touching ground, the animation works as described here, but if I'm touching the ground, it rapidly transitions between shooting and idle...
@randyladyka6720
@randyladyka6720 4 жыл бұрын
So I'm trying to apply this logic to the Mega Man sprite and the shooting animation is playing way too quick and going back to idle. Even after changing the sample rates it still has the same effect. Any advice on this?
@colincruickshank7679
@colincruickshank7679 4 жыл бұрын
i have the exact same issue - megaman is too exited! :D
@toovuil
@toovuil 4 жыл бұрын
@@colincruickshank7679 have you guys found a fix?
@mikestrayer5517
@mikestrayer5517 3 жыл бұрын
@@toovuil did you find fix
@hishaammunsoor1076
@hishaammunsoor1076 3 жыл бұрын
Any solutions yet???
@randyladyka6720
@randyladyka6720 3 жыл бұрын
No solutions. I haven't tried this since this time as I've been busy with other projects.
@SanelaMehinovic
@SanelaMehinovic 4 жыл бұрын
U are the best tutorial maker i have ever seen
@xahmedxgamer7414
@xahmedxgamer7414 2 жыл бұрын
Thank you for starting to make a game, but I had a problem with shoot and you solved it, thanks.
@muhammedalshameri801
@muhammedalshameri801 4 жыл бұрын
I'm sooooo glad I found your channel, why doesn't you tube recommends your videos earlier!!?
@kinqivan7
@kinqivan7 3 жыл бұрын
So I was following along and I decided to make all my own assets. I made an arrow and noticed that the arrow would shoot the correct way but the image was facing the wrong way. I thought it would flip with this coding but with his image its hard to tell if its being flipped with the coding. With my 0 experience in coding and understanding like 5% of what is going on I found out how to flip your bullet. You are just adding transform.localScale = new Vector3(-1, 1, 1); to the "if" statement and adding transform.localScale = new Vector3(1, 1, 1); to the "else" statement idk if this will work for you but it worked for me public void StartShoot (bool isFacingLeft) { Rigidbody2D rb2d = GetComponent(); if (isFacingLeft) { rb2d.velocity = new Vector2(-speed, 0); transform.localScale = new Vector3(-1, 1, 1); } else { rb2d.velocity = new Vector2(speed, 0); transform.localScale = new Vector3(1, 1, 1); } Destroy(gameObject, timeToDestroy);
@mcnuggers5380
@mcnuggers5380 3 жыл бұрын
How can I change the direction of the bulletspawnpos , so that if my character is facing right or left the direction change along with my character?
@LostRelicGames
@LostRelicGames 4 жыл бұрын
All likes and comments greatly appreciated, it helps spread this knowledge at a time when people really need it! If you want to chat or need help, come by the friendly discord: discord.gg/yeTuU53
@TheSatcom23
@TheSatcom23 4 жыл бұрын
Hi John i love your videos! Thanks for being so informative in your teaching ways. I have a question, I love how you have your visual studio set up, ive been trying so many different options and i cant seem to figure out how to get my vs to populate fields like you do. At first I was using vs code and used some unity extensions to auto complete the functions that are built in, but your set up is amazing. Im not sure what its called but i see that there is fields that populate your methods, so if you type" input.getkeydown(it will give you suggestions of what values to put here) and a definition of the method" Every set up video ive found doesnt seem to have this, I would love to know how you did it, and maybe you could make a video custimizing your IDE so all your subs can find this awesome technique.!
@marius3235
@marius3235 4 жыл бұрын
omg men, you save me from a bad mark from university, i love youuu
@goffredo81
@goffredo81 4 жыл бұрын
Your tutorials are clean and easy to follow, good job! the only thing that might be developed in a different way would be splitting those big classes in smaller scripts, but i suppose you already know this, being an experienced game dev. Thank you for sharing your knowledge with the rest of the world!
@LostRelicGames
@LostRelicGames 4 жыл бұрын
hey Mate! I definitely encourage modular script approaches. Although for some of these beginner tutorials about a specific mechanic, I often keep less modular for convenience and so beginners can follow along. I actually addressed this topic in a video! :) kzbin.info/www/bejne/lafNYnp3iLiCb7c Thanks for the comment mate, appreciated!
@sneeky_09
@sneeky_09 4 жыл бұрын
You mentioned it isn't a good way to manage sound for a polished game. Do you have a video in the works for a method that would be? Appreciate all your videos so far, they've been a massive help.
@nekokna
@nekokna 3 жыл бұрын
Love the thumbnail!and the info is awesome too!
@Kira-og5mf
@Kira-og5mf 4 жыл бұрын
Nice man! It was very easy when you explaining it rather than other KZbinr. Btw how to increase the damage on bullets? Pew pew pew
@alexmurillo2541
@alexmurillo2541 4 жыл бұрын
my bullet isnt symetrical, so when it shoots left, the sprite render is unflipped. i tried adding "spriteRenderer.flipX = true;" to the bullet script but it shoots once and never again. what should i do?
@brucelee7782
@brucelee7782 4 жыл бұрын
Thanks keanu reeves this tutorial is great
@ScilexGuitar
@ScilexGuitar 4 жыл бұрын
How do I load this scene at the point where you start? I triped opening the scene directly but its all empty and Idk what I should do
@nicobrentatinon5236
@nicobrentatinon5236 4 жыл бұрын
Thanks a lot! Helped me big time. Please don't stop making more tutorials.
@superconsole118
@superconsole118 3 жыл бұрын
For some reason my bulletspawnpoint doesn’t flip left with the character? So it comes out the wrong area
@mango8648
@mango8648 2 жыл бұрын
If you used "spriteRenderer.flipX" then that's probably the cause. That method just flips the sprite so all of it's children like the bulletspawnpoint don't flip. An alternative could be to use: transform.localscale = new Vector3(-1, 1, 1) for if the player if facing left and transform.localscale = new Vector3(1, 1, 1) if he's facing right
@adobetest2214
@adobetest2214 2 жыл бұрын
Thank you so much for this! If I had to implement this in 3D, how would I make the bullet follow my waypoint path upon shooting until it collides?
@jayd1os400
@jayd1os400 4 жыл бұрын
I do apologize if i have a lot of questions but i just need quick answer to this in my game's case the projectile is a knife/dagger the the shooting works just fine and is really cool but when i rotate the player left the projectile flyes the right way but the projectile sprite does not rotate so the knife i basicly going backwards when throw it left i would quess this is a very simple fix but i can't figure out how to do it???
@LostRelicGames
@LostRelicGames 4 жыл бұрын
hey mate, in the BulletScript StartShoot() function. Simply write a condition if(isFacingLeft) { GetComponent().flipX = true; }
@dreadzitodev488
@dreadzitodev488 4 жыл бұрын
i have a problem. The BulletSpawnPos don't update the position when player turns to left, any idea? i was thinking that too much
@friga2742
@friga2742 3 жыл бұрын
When I shoot left the bullet just stay on mid air, How can I fix this?
@poseidon5602
@poseidon5602 4 жыл бұрын
Can you make a video on switching player like when player has sword it can slash and when player has weapon it can shoot. Sorry for bad english
@AC-cb1oe
@AC-cb1oe 4 жыл бұрын
I have just started learning. i cant figure out how to have my player shoot left using the script from your mega man shooting tutorial. I have tried to experiment with a few things and sought out answers from the community but everyone writes scripts so differently. any suggestions?
@georgethomson8756
@georgethomson8756 4 жыл бұрын
I know this is a month late but how would I flip the bullet image with code when the player flips as its always facing right?
@LostRelicGames
@LostRelicGames 4 жыл бұрын
hey, you can flip the sprite tenderer of the bullet. using spriterenderer.flipX, docs.unity3d.com/ScriptReference/SpriteRenderer-flipX.html
@jaxonbmx2699
@jaxonbmx2699 4 жыл бұрын
i followed along but my bullets still went through the enemy by the end :( private bool
@LostRelicGames
@LostRelicGames 4 жыл бұрын
I accept not your sad face ;) Check colliders and check layers are assigned on for the bullet
@jaxonbmx2699
@jaxonbmx2699 4 жыл бұрын
@@LostRelicGames ok thank you i will take a look and see if that fixes it. Still the best tutorial on youtube.
@klaravyletalova2204
@klaravyletalova2204 4 жыл бұрын
Great video ! I would ask you, when I shooting, then bullet is pushing my character. It happening only on one side. I tried to put bullet to other layer and also I tried change bulletSpawnPos x, but none of them seems to be working.. I am not sure, what I doing wrong.. Thank you
@klaravyletalova2204
@klaravyletalova2204 4 жыл бұрын
its fixed
@LostRelicGames
@LostRelicGames 4 жыл бұрын
@@klaravyletalova2204 was it an isTrigger issue? Good work fixing it
@klaravyletalova2204
@klaravyletalova2204 4 жыл бұрын
@@LostRelicGames yes, it was. I am sure, that I did it correct in first place, but maybe I didnt... :-)
@mumtazthebest4460
@mumtazthebest4460 4 жыл бұрын
My character doesn't make a sound at all even though I have given the script for the audio
@snorlaxgamedev419
@snorlaxgamedev419 3 жыл бұрын
How to set the damage to bulletDamage
@maxwiser
@maxwiser 4 жыл бұрын
Another great tutorial! How could I add knockback to the hits?
@uba754
@uba754 4 жыл бұрын
Great tutorial! Do you know how I could adapt this to make the "gun" aim at the mouse pointer?
@LostRelicGames
@LostRelicGames 4 жыл бұрын
hey that sounds a like a good variation to the tutorial. I'll try work something out, in the meantime, check the unity docs for "RotateTowards()" it will rotate any object (like an arm with gun) towards another point! :)
@uba754
@uba754 4 жыл бұрын
@@LostRelicGames Awesome, thank you! I will look into that rotatetowards function and see if I can figure it out :)
@omerpasa3328
@omerpasa3328 3 жыл бұрын
dude my health system isn't working :(
@InsanepoolYT
@InsanepoolYT 4 жыл бұрын
can i use this code in IEnumerator if yes please help
@LostRelicGames
@LostRelicGames 4 жыл бұрын
Yes you could. Come by the discord if you like, we can discuss your code more easily there discord.gg/yeTuU53
@4F6D
@4F6D 4 жыл бұрын
OMG the first one to explain all the shit he does without assuming you already know trivial stuff.
@mikaelhollsten247
@mikaelhollsten247 4 жыл бұрын
Right?! Im so sick of "beginners tutorials" that just dont explain the... BEGINNER STUFF!
@yangkaihor4251
@yangkaihor4251 4 жыл бұрын
Finally a tutorial. It's useful for me
@LostRelicGames
@LostRelicGames 4 жыл бұрын
Glad to hear it :)
@kerandonovan7255
@kerandonovan7255 4 жыл бұрын
Glad i found upon this channel thanks reddit
@kasparclay3290
@kasparclay3290 4 жыл бұрын
Very informative stuff man :) thanks.
@LostRelicGames
@LostRelicGames 4 жыл бұрын
Thanks dude, glad you like it!
@harshraj9608
@harshraj9608 4 жыл бұрын
can u share ur codes pls....i m new to programming
@sebastiancastro5686
@sebastiancastro5686 4 жыл бұрын
Excellent tutorial, i'm pretty new to this and you explain them beautifuly. They've been helping me make my Run 'n Gun 2D Platformer, but I'm having a problem which I would appreciate your help. I used a Tilemap, with a Tilemap Collider 2D, which help me to auto draw the collision, buuuuuut... given the use of the Tilemap Collider, what are supposed to be the walls, are recognized as "ground" which allows my player to continuously jump up the wall... which I clearly don't want to. I have been following your tutorial, hence using your code and I wouldn't know how to implement a different code. If my english is a little funny is because I'm from Chile, so my first language is Spanish jajaja...so, Saludos desde Chile, and I hope you can help me.
@granpatriarca3726
@granpatriarca3726 4 жыл бұрын
Thanks Keanu.
@ibrahemrafee2397
@ibrahemrafee2397 4 жыл бұрын
nice video can you make A mega man like (charge shot) tutorial
@altf4968
@altf4968 4 жыл бұрын
I dont know how but in every your tutorial I understand all and you dont even explain too much but I get it. Thx a lot and it would be good that you make some RPG tutorials, inventory etc... but on the same way you do it now. It is like i am doing it together with you hahah 👍👍👍 I am having this problem knowing on which object should i put script. Lets say you have player, creature, doors... you kill the creature and doors unlock... now the script of doors geting unlock or destroyed, should you put it on creature or doors or whatever... it would be awsome that you make some examples and explain what is best and right to do.
@BattleDrumz
@BattleDrumz 4 жыл бұрын
How does the bullet instantiate know to spawn at bulletSpawnPos?!?! I’m losing my mind trying to figure this out
@LostRelicGames
@LostRelicGames 4 жыл бұрын
Hey mate, the position is specified through the transform.position at kzbin.info/www/bejne/hp6WpJawmtZmodU H
@BattleDrumz
@BattleDrumz 4 жыл бұрын
Ok cool! Thanks for the explanation... I’m trying really hard to understand how/why things are happening. At first, it all seems like magic 😆
@BattleDrumz
@BattleDrumz 4 жыл бұрын
Lost Relic Games if you had initialized a second transform.position variable (for some other purpose), how would you tell the bullet to instantiate at the correct one?
@blank2303
@blank2303 4 жыл бұрын
Great tutorial, as always :D
@LostRelicGames
@LostRelicGames 4 жыл бұрын
thank you!
@linusilbratt7548
@linusilbratt7548 4 жыл бұрын
Awesome tutorial again and everything works great! I got one problem though, I've added my own spell instead of a bullet. I want my spell image or prefab to rotate when I cast while moving left. I tried to do the samething as with my player to add spriteRenderer.flipX = true; but that didnt work (Im very very new to coding) Sorry if my explanation is abit fuzzy :P
@batuyilman2533
@batuyilman2533 4 жыл бұрын
Thank you man
@elithevil
@elithevil 4 жыл бұрын
Oh god, ive been trying to make my character shoot left for the last 5 or so days without success. ty!
@ibrahimsharckas8929
@ibrahimsharckas8929 4 жыл бұрын
thank you im learning alot from you
@LostRelicGames
@LostRelicGames 4 жыл бұрын
Thanks Ibrahim, cool new tutorial coming tomorrow!
@ibrahimsharckas8929
@ibrahimsharckas8929 4 жыл бұрын
@@LostRelicGames thank you ill be waiting ♥️
@CrepsDelic
@CrepsDelic 4 жыл бұрын
Best Tutorials ever! 🤩💪 Keep Up the good Work!! 💪💪💪💪
@DwaykeTubes
@DwaykeTubes 3 жыл бұрын
John Wick is teaching game development ?!?
@insideoutthailand6995
@insideoutthailand6995 4 жыл бұрын
So easy so cool .far from Thailand,
@LostRelicGames
@LostRelicGames 4 жыл бұрын
awesome!
@kevinoh7707
@kevinoh7707 4 жыл бұрын
if you need to create sound effects at the fly you can use a program called sfxr: www.drpetter.se/project_sfxr.html this is the link to download it
@simonaantonova1861
@simonaantonova1861 4 жыл бұрын
thank you man uwu
@ghaznavipc
@ghaznavipc 3 жыл бұрын
29:51 John Wick is shooting
@indiajackson5959
@indiajackson5959 4 жыл бұрын
Can you please do a video for climbing ladders in 2D! I'm dying over here lol
@kadubarbalho
@kadubarbalho 4 жыл бұрын
nice tutorial, put a fart sound when destroy the enemy hahahahaha
@lacrimosa5610
@lacrimosa5610 Жыл бұрын
Oh my god! Keanu Reaves coding
@kipanitin6061
@kipanitin6061 4 жыл бұрын
John Wick???
@silverhand4468
@silverhand4468 4 жыл бұрын
I like you man
@Crypticlazr
@Crypticlazr 4 жыл бұрын
Morty!
@maxalex5539
@maxalex5539 3 жыл бұрын
лучший
@alraisi500ma
@alraisi500ma 2 жыл бұрын
pew pew pew
@danisal4245
@danisal4245 2 жыл бұрын
Thumbs up for pew pew pew and arrgh.
@Adkinsy85
@Adkinsy85 4 жыл бұрын
Those bullets looks like CCP virus LoL
@phambaoha170
@phambaoha170 3 жыл бұрын
Thanks man
Fix RigidBody Jitter in One Click - Unity Quick Tips
4:46
Lost Relic Games
Рет қаралды 83 М.
The BlackthornProd GameDev Challenge Controversy - My Response
8:04
Lost Relic Games
Рет қаралды 68 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,3 МЛН
How I learned Unity without following tutorials (Developing 1)
18:11
Game Maker's Toolkit
Рет қаралды 2,1 МЛН
I Wish I Had Known This Before I Started Unity Game Development...
11:11
Breaking up Code in Unity (Important game dev tips for beginners)
18:36
Lost Relic Games
Рет қаралды 128 М.
What does a Game Engine actually do?
16:45
Ellie Rasmussen
Рет қаралды 173 М.
2D Enemy Shooting Unity Tutorial
12:52
MoreBBlakeyyy
Рет қаралды 62 М.
I made a full GAME in 400 HOURS - this is how - in 19 minutes!
19:00
Making a Game About Weak Points
21:27
Emis
Рет қаралды 568 М.
4 Ways to Code 2D Player Movement in Unity (You SHOULD know these!)
16:24
Lost Relic Games
Рет қаралды 172 М.