Item Drops (2D Unity Tutorial)

  Рет қаралды 6,064

Night Run Studio

Night Run Studio

Күн бұрын

Пікірлер: 36
@totallyoffgrid3008
@totallyoffgrid3008 Ай бұрын
This is the video I was looking for to understand how to attach a specific item to a specific enemy. Now I get it.
@LOLFactory05
@LOLFactory05 5 сағат бұрын
you can explain things SOOO GOOD i understood everything directly thank you mate!!!!
@NightRunStudio
@NightRunStudio 5 сағат бұрын
Glad to hear it! Thanks for taking the time to comment.
@cozmo_Comet
@cozmo_Comet 8 ай бұрын
This is probably the best unity tutorial ive ever watched. The definitions and thorough explanations didnt just help me do this, but i also genuinely learnt a lot. Thank you!
@NightRunStudio
@NightRunStudio 8 ай бұрын
Wow... that's high praise. Thanks for sharing, and good luck with your project!
@DayvonR64
@DayvonR64 2 жыл бұрын
I really like the animation of the enemy, it's definitely a unique design. Yet another amazing tutorial!
@NightRunStudio
@NightRunStudio 2 жыл бұрын
Thanks! I’m really happy with how this mech has turned out so far.
@outcreep7337
@outcreep7337 2 жыл бұрын
I very recently switched from Roblox to Godot so I can't actually follow along with the tutorial. But absolutely love how you're actually explaining what each line of code is doing and not just telling the viewer to do what you're doing. There aren't many tutorials like this. I almost wish I was using Unity because of how clear this tutorial is!
@NightRunStudio
@NightRunStudio 2 жыл бұрын
Thanks for that! This is the best kind of encouragement. It’s so helpful to know that people are appreciating the explanations. Thanks, again!
@outcreep7337
@outcreep7337 2 жыл бұрын
@@NightRunStudio Np! I look forward to more content from you!
@georgewashingtonjuniord1290
@georgewashingtonjuniord1290 2 жыл бұрын
OKAY, i mean it, really, and im someone really looking in depth to stuff and like to have detailed and precise explanations with visuals. YOU my friend (yes we are friends now, sorry mate) have the best tutorials out there. Props on the making and like the visuals, the pace, the intonations, the pauses... really well done. (btw im a teacher, so i dont say that lightly) :)
@NightRunStudio
@NightRunStudio 2 жыл бұрын
Haha! Thanks so much (my new bestie!). I so appreciate the positive, specific feedback (as a fellow teacher, I love the teacherly encouragement)! Cheers!
@mcgamer4209
@mcgamer4209 11 ай бұрын
1 year and it still helped me out alot tyyy so much
@NightRunStudio
@NightRunStudio 11 ай бұрын
Glad to hear it! Good luck with your latest project.
@YouVSYouInspiration
@YouVSYouInspiration 6 ай бұрын
Wow! Such an excellent tutorial! Learned a lot from this and you are great at explaining the why as you work through the code. I am trying to implement this as a system for enemies dropping health but wouldn't want them to drop every time. What would you suggest adding to the code for random drop based on a percentage? 🤔
@NightRunStudio
@NightRunStudio 6 ай бұрын
Have you ever worked with random.Range? You could create an integer called randomNum, set it using random.Range(1, 100) would get an integer out of 100, and then use an if statement so if the number is less than 50 it drops (if you want 50% chance). Hope that helps point you in the right direction!
@mysticowlgames
@mysticowlgames 9 ай бұрын
How do I manage the quantity of the drops? For example I want 5x Item1 and 1x Item2, then how do I set that up? Also how do I make the the loot to have force of sideways too like hollow knight?
@NightRunStudio
@NightRunStudio 9 ай бұрын
The way this one is set up, you would just have to drag multiple copies of the item into the array (so drag 3 potions in if you want it to drop 3 potions). As for having the item move to the side, you would just want to change the itemDrop scripts direction. Right now it uses Vector2.up, but you would want to change that to something like: new Vector2(1,1) (which would send it up and to the right). You could also randomize the x value to something like: new Vector2(Random.Range(-.5f, .5f), 1) * dropForce, which would give it a random horizontal value. Hope that helps!
@LavenderIV
@LavenderIV Жыл бұрын
Great video! How would I make the item a collectable item that adds to a score counter?
@NightRunStudio
@NightRunStudio Жыл бұрын
I don't have a video on that exact topic. That said, I have one on keeping score based on destroying enemies, which is more or less the same concept. You could pretty easily adapt this as most of the code would be the same. Let me know if you have any questions! kzbin.info/www/bejne/fYmtfp2Nh6aYg7ssi=Cd1MhBF9X2iihSqk
@totallyoffgrid3008
@totallyoffgrid3008 14 күн бұрын
Could I use this same idea to have my enemy create a tower every time another tower is destroyed in the area? Using instantiate. Ie: if total towers is less than 3, instantiate enemy tower build. Then hopefully the enemy builds the tower and moves on with his patrol.
@NightRunStudio
@NightRunStudio 14 күн бұрын
That should work. Though you'd have to make sure it's instantiating in the correct position.
@smithjones6144
@smithjones6144 2 жыл бұрын
Graphics are nice
@NightRunStudio
@NightRunStudio 2 жыл бұрын
Awww... thanks!
@matthew5210
@matthew5210 Жыл бұрын
You're saving my uni work right now, but how would I make it so the each item drops in random directions?
@NightRunStudio
@NightRunStudio Жыл бұрын
Haha! Glad to hear the videos are going to good use :) At the moment, the code is set up to drop the items at the precise location of the enemy. If you wanted things to drop to one side, you would need to alter that line in the instantiate code. Instead of transform.position for the location, you would need something like transform.position + new Vector2(1, 0) this would set a location 1 unit to the right of the enemy. Depending on how much randomization you want, you could try a couple of things: 1) you roll a random number: int randomNumber = Random.Range(1,2); this would give you a random number from 1-2 (including 1 and 2). Now, you could have different spawns happen depending on which number comes up. For example, if you roll a 1, then you run an Instantiate code with a new Vector of 1,0, but if it rolls a 2 you instantiate with a new Vector added of -1, 0 I hope that helps. Good luck with you course!
@nikolozmetreveli2462
@nikolozmetreveli2462 7 ай бұрын
For some reason public gameObject itemDrops doesn’t work on my game
@NightRunStudio
@NightRunStudio 7 ай бұрын
Do you have a script called itemDrops? If you don't have a script with that exact name it wont work (capitals and all).
@amoyze6745
@amoyze6745 Жыл бұрын
How to pickup the item?
@NightRunStudio
@NightRunStudio Жыл бұрын
That really depends on what you want to do with the item. Do you already have an inventory system? If you just want the item to immediately do something (like restore health), that's pretty straightforward, but if you want to actually store the item it's pretty complex. I have a series on how to make a really simple inventory, as well as one for a more complex inventory if you are interested: kzbin.info/aero/PLSR2vNOypvs6eIxvTu-rYjw2Eyw57nZrU&si=OkHbl4CaTK9uqqz6 and kzbin.info/www/bejne/nXaqZaV7r5ylsLc
@herdisiswandi892
@herdisiswandi892 11 ай бұрын
In my case the enemy dropped 2 items instead of 1. How to make the enemy drop 1 item, brother? I'am noob 😅😢
@NightRunStudio
@NightRunStudio 11 ай бұрын
How many different items did you put in your array? If you only put one item it should only drop one. If it’s firing twice, then I wonder if maybe you put this script on the object twice? (Sounds like it’s firing twice).
@herdisiswandi892
@herdisiswandi892 11 ай бұрын
as you said apparently I put this script on different objects twice? sorry my bad@@NightRunStudio
@NightRunStudio
@NightRunStudio 11 ай бұрын
Glad we figured it out!
@emehe
@emehe 2 жыл бұрын
Wow
@mrgetrext297
@mrgetrext297 2 жыл бұрын
Woooh
Flexible LOOT SYSTEM in Unity with Random Drop Rates
13:24
Counter-Strike 2 - Новый кс. Cтарый я
13:10
Marmok
Рет қаралды 2,8 МЛН
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,3 МЛН
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 787 М.
Lossless Scaling Deep Dive!
28:18
Jagadhie
Рет қаралды 56 М.
PirateSoftware is right, this needs to stop
15:14
Theo - t3․gg
Рет қаралды 883 М.
So I Reviewed the DOOM 3 Source Code..
31:03
Tariq10x
Рет қаралды 102 М.
What does a Game Engine actually do?
16:45
Ellie Rasmussen
Рет қаралды 177 М.
Enemy AGRO AI System in Unity For Beginners ( 2D Game Dev Tutorial )
23:28
UNITY 2D NPC DIALOGUE SYSTEM TUTORIAL
7:52
diving_squid
Рет қаралды 60 М.
How to Create a RANDOM LOOT TABLE in Unity C#
15:56
gamedev:hq
Рет қаралды 63 М.