Loot - Box System In Unity 2D

In this video we will be making a Loot spawning system which spawn object with a probability / spawnrate which we give to each and every Object. So what we will be doing is that we will give a min and max spawn probability to each and setup those value with the help of the SpawnRate we give to each of the object
You can get the script from here
hatebin.com/wemntuvpbn
or
chronoabi.itch.io/chronoabi-a...
You can also follow me on
Instagram : / chronoabi
KZread: bit.ly/2CReUlQ
Twitter : / chronoabi
Discord : / discord
You can Support this channel on patron to get the latest video as quickly as Possible
Paytron: / chronoabi
Music
Campfire by Scandinavianz
Campfire by Scandinavianz / scandinavianz
Creative Commons - Attribution 3.0 Unported - CC BY 3.0
Free Download / Stream: bit.ly/_campfire
Music promoted by Audio Library • Campfire - Scandinavia...
-----------------------------------------------------------------------------------------------------------------------
Patience - Jay Someday
Track: Patience - Jay Someday [Audio Library Release]
Music provided by Audio Library Plus
Watch: • Patience - Jay Someday...
Free Download / Stream: alplus.io/Patience
--------------------------------------------------------------------------------------------------------------------
"Sappheiros - Dawn"
"Sappheiros - Dawn" is under a Creative Commons license (CC BY 3.0)
Music promoted by BreakingCopyright: bit.ly/2OBe00v

Пікірлер: 22

  • @cameronschiff132
    @cameronschiff1322 жыл бұрын

    The issue here is if you ever wanted to add additional items you'd have to adjust every single other item's spawn rate to make sure it still adds up to exactly 100; plus if you have an array of hundreds of items you're very prone to make an error. Instead of generating a random number between 1 and 100, better to give each item a single float to represent its drop chance, then use a foreach loop to add up the drop chance of all items in the pool. Then generate a random float between 1 and that sum, and use a for() loop to find the item that should spawn. Something to the effect of: Item ChooseItem(Item[] ItemPool) { Item itemToReturn = /* default item here */ float sum = 0; foreach (Item currentItem in ItemPool) { sum += currentItem.spawnChance; } float randomNum = Random.Range(0, sum); foreach (Item currentItem in ItemPool) { float tempSum += currentItem.spawnChance; if (!(tempSum { itemToReturn = currentItem(); break; } } return itemToReturn; }

  • @officialgiovanny4597
    @officialgiovanny45974 жыл бұрын

    Yooo dudee, you’re videos quality are great! Some of your tutorial helped me alot on making games. You should start making like a tutorial series. Ex. 2D Platformer RPG, or maybe bring back horror game tutorial or something that might interested alot of people! Anyway thanks again for your tutorials! Cheerss.

  • @heroalireza90
    @heroalireza904 жыл бұрын

    Great explaining

  • @st.schgbr
    @st.schgbr3 жыл бұрын

    Very good video! I appreciate you putting the code in the video description so i can easily just copy/paste it. Thank you! Also, the code works just perfect... ;-)

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

    Wow I learned a lot

  • @stickybacon3899
    @stickybacon38993 жыл бұрын

    Great vid thx

  • @maximgevel5981
    @maximgevel59813 жыл бұрын

    you helped me

  • @christianbrandon2350
    @christianbrandon23503 жыл бұрын

    Hmm bro can you help me how to add ad drops value when drop, for example : if the loot box is opened/the enemies die drops 1-6 item in random value(and in random position but near the loot came from)

  • @maximgevel5981
    @maximgevel59813 жыл бұрын

    thanks

  • @chronoabi
    @chronoabi3 жыл бұрын

    Hey follow me on Discord. Link is here discord.gg/78q3HFnb69 You can ask for help , post what your working on and get motivated , show your funny bugs and memes and more.

  • @casualshox4972
    @casualshox49723 жыл бұрын

    "error CS0029: Cannot implicitly convert type 'ItemToSpawn' to 'float'" I got this error help pls

  • @finjel1
    @finjel14 жыл бұрын

    YAYYYYY FINNALY ANOTHER VIDEO YOU DISERVE MORE SUBS Edited: Can you pin mehhh ;))))))

  • @finjel1

    @finjel1

    4 жыл бұрын

    Yay ths