POWER UPS in Unity

  Рет қаралды 306,590

Brackeys

Brackeys

Күн бұрын

Пікірлер: 431
@iProgramInCpp
@iProgramInCpp 7 жыл бұрын
If you want to have different powerups we can create an enum outside the PowerUp class. For example: public enum PowerUpsAvailable { Grow, HealthBoost } Then we can add an object in the class. public PowerUpsAvailable powerUpType; And in the Inspector window we shall see the combo box with the Grow and Health Boost elements. And then you can add this to your Pickup function: switch (powerUpType) { case PowerUpsAvailable.Grow: //Do something break; //We don't want errors! case PowerUpsAvailable.HealthBoost: //Do something else break; default: Debug.Log("The type is invalid"); break; }
@dragami1607
@dragami1607 4 жыл бұрын
How would you assign a specific power up to an outcome? Say I wanted one power up to give me health, and another to give me speed, how would I do that?
@watchmarley9268
@watchmarley9268 4 жыл бұрын
@@dragami1607 Assign different scripts to different powerups based on what you want to alter.
@toluyole
@toluyole 2 жыл бұрын
This is a good method, but it would use scriptable objects
@AlexanderLoaizaGameDev
@AlexanderLoaizaGameDev 3 жыл бұрын
If the player is not interacting with the power-up in 2D when touching it try "void OnTriggerEnter2D (Collider2D other)" instead of "void OnTriggerEnter (Collider other) ".
@Svadis
@Svadis 2 жыл бұрын
THANK YOU
@Save_my_arches
@Save_my_arches 2 жыл бұрын
This helped me so much thank you!
@dorintoader1443
@dorintoader1443 Жыл бұрын
love you
@AlexanderLoaizaGameDev
@AlexanderLoaizaGameDev Жыл бұрын
@zssllayers1946 Probably something to do with the z axis not really existing in 2D and everything appearing to have the same z position.
@whiteferrari3529
@whiteferrari3529 Жыл бұрын
actually love u
@MrSpiffykai
@MrSpiffykai 6 жыл бұрын
I downloaded it a few days ago and I was struggling to find a good tutorial. Thanks for making an awesome tutorial as usual!
@__u.nknow.n___yb4149
@__u.nknow.n___yb4149 4 жыл бұрын
P000009090000099990099099 9 9000099090 0 99990p0009 9 990p000 00 9 0 009000 poopoop00999999 0090o 990p000 90p9 p9900000 0 00 9 90 90p9 0 9p 0 90pop99th0099 9 990p000
@__u.nknow.n___yb4149
@__u.nknow.n___yb4149 4 жыл бұрын
pop 9 9 90999099909999 o 90p9 9999999999999
@ananttiwari1337
@ananttiwari1337 4 жыл бұрын
@@__u.nknow.n___yb4149 what
@layf.
@layf. 4 жыл бұрын
Ey big smoke, wanna eat some number nines?
@themaydayman
@themaydayman 3 жыл бұрын
For people just here for the timer: Make a function with return type IEnumerator. Put what you want to happen for a certain amount of time in the function. Below it, type "yield return new WaitForSeconds(seconds);" without the quotes. Write the after timer code below it. When calling the function, do: "StartCoroutine(Function());" without the quotes.
@kal0rd597
@kal0rd597 6 жыл бұрын
First comes step 1, then step 3, then step 2. GENIUS!!!
@goodgamershow6505
@goodgamershow6505 3 жыл бұрын
The commends above are spam bots. I meet comments like this everyday
@odaghast
@odaghast 7 жыл бұрын
steps to build games : step 1 : make stuff step 3 : add effects step 2 : make stuff do stuff
@aaporras9776
@aaporras9776 4 жыл бұрын
Forgot 1 4. Allow the player to do stuff
@puranjayd1450
@puranjayd1450 4 жыл бұрын
AA Porras forgot another, 5: rage quit and realise that games are very hard to make
@lovablepsychopaths8260
@lovablepsychopaths8260 4 жыл бұрын
Step 4: Go visit Brackeys channel to see what you did wrong.
@mannou38
@mannou38 4 жыл бұрын
step 9: add grappling guns
@xemnaskeen1892
@xemnaskeen1892 4 жыл бұрын
Step 11: regequit when brackets has no errors
@lAcedUpLiss
@lAcedUpLiss 3 жыл бұрын
So helpful!!! I'm a first year programmer/game dev at Uni and this was really easy to follow.
@yoshihasascended
@yoshihasascended Жыл бұрын
A message to all future game devs: Don't give up even though it may look very hard and you think that youre maybe not smart enough or you arent cut out for this, just keep watching these kinds of tutorials but instead of just copying the code, try to understand how it works and how you can change it to do various things be creative.
@franklinsena2843
@franklinsena2843 11 ай бұрын
thanks for this comment!.
@eqanmustafa3925
@eqanmustafa3925 4 ай бұрын
😓😓😭
@vladyslavhukovskyi9669
@vladyslavhukovskyi9669 Жыл бұрын
For anyone who also has a problem with looping of effect. When you download Unity Particle Pack and put some random effect to the script, this effect starts again and again after triggering. You can fix it by doing next actions: 1. Click on the effect in the bottom assets panel. 2. In the Inspector on the right side find the "Looping" option inside the Particle System component and disable this option. 3 (Optional). If you still have looping effect, double click on effect in the bottom Assets panel and then you can see all children of this effect inside the hierarchy on the right. Just repeat step 2 for each child.
@sofoniyas8666
@sofoniyas8666 Жыл бұрын
I’m having problems picking up the power ups
@PayalSingh-bs1em
@PayalSingh-bs1em Жыл бұрын
Wow bro you're a life saver
@twooty2148
@twooty2148 10 ай бұрын
Thank u dude
@jadonut249
@jadonut249 7 жыл бұрын
Your tutorials are very professional, they only get better :D
@Grompula
@Grompula 7 жыл бұрын
Crysis was the very first game to use Ambient Occlusion. It is now a part of almost every physically based rendering engine! It's amazing. Such a simple technique, yet so effective.
@codinginflow
@codinginflow 3 жыл бұрын
what about using Invoke with a delay instead of the coroutine?
@pagoda_dimensionale9761
@pagoda_dimensionale9761 3 жыл бұрын
You can do it, but Invoke is very limited in comparison to Coroutine. So is better to undestand and use Coroutine bacause tomorrow you will use it all the time :)
@reno82
@reno82 3 жыл бұрын
You could do it with a delayed invoke to disable the power up. That would require you just an extra function.
@TheStigChristensen
@TheStigChristensen 7 жыл бұрын
Hi Brackeys! Since BALL WARS is already touching the subject, I figured I'd ask for a video or two on local splitscreen? There's very few resources out there and a lot og subjects to wrap your head around. • Having several players but only 1 player tag? • 2-4 controllers active at the same time • Dynamic screensize/camera changes, depending on amount of players • And much more... Thank you for your videos :)
@tomaxplosion2446
@tomaxplosion2446 4 жыл бұрын
you saved my life, I hope you the best and I hope you continue doing videos like this too
@pom69
@pom69 4 жыл бұрын
thank you brackeys you are a life saver, and im still so sad to see you go
@Emanuel-sla-h5i
@Emanuel-sla-h5i 7 жыл бұрын
Or even better the IEnumerator coroutine can stay on the player script and the powerup can destroy itself safely without worrying about stopping the time out effect. It's also closer to how we perceive powerups to actually work in games: the powerup passes the buff to the player. Anyways, amazing quality as always! :D
@VisserStudio
@VisserStudio 5 жыл бұрын
Another great tutorial, and the first tutorial where I knew enough where I could easily customize the script, I'm learning! I found that the prefab particle system wouldn't go away in the hierarchy after the powerup was destroyed so I added a destroy for the particle system to the script, but you can't destroy prefabs so I added a child particle system to the powerup object, but that one played on awake as soon as the scene opened in play mode, so I set it inactive and added a 'set active' in the code and a 'destroy after 2 seconds' behind that. Now that works all cleanly. And I also added a maxHealth so that the multiplier does both health and maxhealth, but when reverting them after the set duration it sets the health to the (max)maxhealth if it is greater than that, this should prevent a damaged player from reverting below the max health after the powerup health goes away.
@ryanwilmink9531
@ryanwilmink9531 7 жыл бұрын
Love all of your videos, they've been extremely informative and have helped me really start getting into using Unity. In this video though there is one small issue that I see and that's that when you divide the player's health by the multiplier after the powerup runs out, if the player lost any HP, that loss will be reflected in the division of the HP stat(i.e: if the player gets the powerup and loses 50 HP, setting their HP to 90. Once the powerup fades, their HP will drop to 64). I'd recommend instead of dividing the multiplier you write an if statement like: if (stats.health > 100) {stats.health = 100;} and don't modify the HP at all if it's lower than 100 after powerup fades. Keep up the great work! Your tutorials are an excellent resource and I look forward to binge watching them as I develop my games ^_^
@justinwr092
@justinwr092 6 жыл бұрын
Your videos are packed full of wholesome goodness.
@SlasherTheMod
@SlasherTheMod 6 жыл бұрын
Managed to figure this out. Doing a Space Shooter and originally I wanted to do a Double Shot Powerup where the bolts fired spawn 2 of them instead of one. Instead I made it do Rapid Fire for 10 seconds instead. Its still progress. Thanks again for this tutorial.
@Chiaros
@Chiaros 6 жыл бұрын
Hey there, so... I also tried working on a space shooter following this tutorial and I can't, for the love of god, manage to get the collider to react to the onTriggerEnter2d. Powerup collider is a trigger, ship has a polygon collider which is not a trigger. Nothing happens when they touch and I have the same code as brackeys (but with 2D after OnTriggerEnter and Collider(2D).other. Any help, please?
@MrNsaysHi
@MrNsaysHi 7 жыл бұрын
As a CS student who just studied function prototyping, invoking, parameters and signatures on C++ this video is PERFECTLY timed! Also yeah, I study C++ and C# at the same time :D
@n8twj
@n8twj 7 жыл бұрын
This is a great starting point for a power up system... However, in a larger game, one may consider pulling the Player Stats out into its own singleton class, but that gets quite advanced very quickly.
@Zetrox.36
@Zetrox.36 3 жыл бұрын
wow dude i am new to coding (started yesterday)and brackeys are really helping me to create an awesome game VERY COOL
@zoriox8667
@zoriox8667 3 жыл бұрын
Yep. Its a shame he and the team left to do other things, but this man was literally the only way i couldve started making games. Good luck to you and your projects pal
@chxry9670
@chxry9670 7 жыл бұрын
This is so clearly explained, I love it!
@nishantmaggirwar
@nishantmaggirwar 3 жыл бұрын
for those who are getting this error Library\PackageCache\com.unity.postprocessing@2.0.3-preview\PostProcessing\Runtime\PostProcessManager.cs(424,66): error CS0117: 'EditorSceneManager' does not contain a definition for 'IsGameObjectInScene' update the package manager by going in Package Manager -> "In Project" and in that select Post Processing and then update it to the latest version
@Brai-niac
@Brai-niac Жыл бұрын
Well done bro. I now have my powerup working. 💥💥💥
@wijione8083
@wijione8083 6 жыл бұрын
so 100hp * 1.4 = 140 / 1.4 = 100 Great, but what if you take damage?!?!? Lets say you get your health up to 140 and than you take 40 damage and after the power up expires you end up with 71hp instead of 100. Is there a better way to do that?!
@konartis7
@konartis7 5 жыл бұрын
you would need to use a maximum health as well. after the duration reduce the max health back and if current health is > than max reduce current to max
@Dymangel
@Dymangel 5 жыл бұрын
before make changes on health, make a variable in the coroutine float healthbeforechanges = health; after you can modify like *1.4 after the effect is done, just change current health with the variable healthbeforechanges
@lissethponcedeleon3816
@lissethponcedeleon3816 4 жыл бұрын
The health is only multiplied once so it would only be multiplied by 1.4 when you touch the power up, when you take damage it isn’t touch a power up so you don’t multiply
@ДенисМаксименко-м9ц
@ДенисМаксименко-м9ц 4 жыл бұрын
@@Dymangel This obly works if no other powerups were picked up during that time.
@CampersBread
@CampersBread 4 жыл бұрын
@@ДенисМаксименко-м9ц you could just store the difference in HP between the unmodified value and the value after multiplying it. and after the duration subtract the diff if it doesnt kill you/go lower than a fixed min value
@arsenymun2028
@arsenymun2028 7 жыл бұрын
Thanks! Do you have any plans on making a video about touch controls?
@abdoudjam6846
@abdoudjam6846 7 жыл бұрын
Same wish !
@seifmustafa2004
@seifmustafa2004 7 жыл бұрын
+1
@nelsongabriel8574
@nelsongabriel8574 7 жыл бұрын
Yeah he should totally do that
@LegendaryWizardPS
@LegendaryWizardPS 7 жыл бұрын
Touch control is simple, just look up the unity docs for "Input"
@treasuredoasis4783
@treasuredoasis4783 5 жыл бұрын
Absolutely awesome! Simple instructions and even has a bit more advanced coding in there to help keep you progressing in your game development! So cool!
@DoubleDYouTube
@DoubleDYouTube 7 жыл бұрын
I love the way you explain things, looking forward to supporting you on Patreon as soon as I get my first job :D
@user-mc6eq7hz6q
@user-mc6eq7hz6q 7 жыл бұрын
Great videos! I have just finished watching all the videos in this playlist without even a break!!
@davestomper3428
@davestomper3428 2 жыл бұрын
Wow I miss Brackys videos they were so easy to understand
@wilsonward9217
@wilsonward9217 7 жыл бұрын
Love your videos, they have helped me come so far as a programmer and game designer. I'm not sure if you take suggestions for videos, but i would love to see a tutorial which covers water/shaders/ripple&splash effects/swimming. The character could walk through the water and leave little ripples as they walk/ then a swimming & diving mechanic for when the water is deep enough. Keep up the great work!
@colinbarnette0
@colinbarnette0 4 жыл бұрын
Just a curiosity: Why can the PowerUp GameObject not be destroyed immediately? Since the effect has... taken effect, shouldn't the GameObject be moot at this point? Thanks!
@magicamecil
@magicamecil 3 жыл бұрын
Trank you gor this amazing Tutorial!
@bakaky0
@bakaky0 7 жыл бұрын
You could also control the power ups in a PowerUpScript inside the player. It would have a function that receives from the power up object the information about the variable to change, the amount and the duration and the PowerUpScript will take care of applying and controlling the duration. This way you can destroy the power up gameobject instantly.
@felipegodoy8177
@felipegodoy8177 7 жыл бұрын
This channel is the best.
@aleksp8768
@aleksp8768 4 жыл бұрын
Is there a difference from if (other.gameObject.tag == "Player") And If (other.CompareTag("Player"))?
@hammythehamster5111
@hammythehamster5111 4 жыл бұрын
nah
@aleksp8768
@aleksp8768 4 жыл бұрын
@@hammythehamster5111 ok
@alingupta9410
@alingupta9410 4 жыл бұрын
There is. one is longer :)
@jmarkellos
@jmarkellos 5 жыл бұрын
I think it would be fun to have the power-up collider be a little larger than the pickup and on enter pull the power-up towards the player. Obviously it just depends what you're going for, but thought I'd share.
@ApexPredatorM82
@ApexPredatorM82 3 жыл бұрын
thank you man you are the best explainer ever Love you brother
@darkomengaming
@darkomengaming 3 жыл бұрын
Great video ^^ But i have one question. What do i do if i want to make a double jump power up?
@panickal
@panickal 3 жыл бұрын
The particle effect loops even though Looping is turned off in the effect prefab. Help?
@kinqivan7
@kinqivan7 3 жыл бұрын
If you in 2D public class PowerUp : MonoBehaviour { void OnTriggerEnter2D (Collider2D other) { if (other.CompareTag("Player")) { Pickup(); } } void Pickup() { Debug.Log("Power up Picked up"); } }
@Easyriderr
@Easyriderr 2 жыл бұрын
Why does this keep getting me error msges Instantiate(pickupEffect, transform.position);
@HaydenTheEeeeeeeeevilEukaryote
@HaydenTheEeeeeeeeevilEukaryote 7 жыл бұрын
“Please don’t make fun of it” I love your videos
@warlord336
@warlord336 5 жыл бұрын
This tutorial helped me a lot. But the Particle pack did not go over well with my project, right after importing my project was unusable. So without the particle pack great tutorial :D
@Mgreat
@Mgreat 7 жыл бұрын
Quick dumb question, what method did you use to make the model (whether in blender or unity), so that you could quickly apply two materials as you did to the powerup at 0:45?
@Mgreat
@Mgreat 7 жыл бұрын
Awesome, thank you.
@Semaj0z
@Semaj0z 4 жыл бұрын
@@Mgreat umm... Who r u talking to?
@Mgreat
@Mgreat 4 жыл бұрын
@@Semaj0z This is so old, I have no idea. Maybe their reply got deleted? idk.
@verybigman8610
@verybigman8610 7 жыл бұрын
can you do a video on making a multiplayer (slpit screen, one keyboard or controllers) game kinda like this game
@pilly3815
@pilly3815 4 жыл бұрын
Man ily Brackeys(no homo) you made everything seem so easy
@Yirfinity
@Yirfinity 4 жыл бұрын
Thanks, i was searching for a timer of power up and you appear 😃👍
@CoolJosh3k
@CoolJosh3k 7 жыл бұрын
It would be great if you did a quick tutorial on object pools. Don't want too many people thinking Instantiate and Destroy are good for a final build.
@cheesecakenl1980
@cheesecakenl1980 7 жыл бұрын
Again great content. Good quality and explaining several ways to use the power up!
@synoxgames1207
@synoxgames1207 7 жыл бұрын
Hey could you do a tutorial on how to spawn randomly on a terrain? Even if it’s got hills
@MrKraignos
@MrKraignos 7 жыл бұрын
1) Generate a random X and Z, set Y very high 2) Raycast downwards. 3) Get the Raycast Hit, it will contain a point from which you can extract Y 4) Instantiate at X, Y, Z
@synoxgames1207
@synoxgames1207 7 жыл бұрын
Mr.K thank you my dude
@MrKraignos
@MrKraignos 7 жыл бұрын
You're welcome. Also note that there are a lot of ways to handle this. For example if you generate the terrain from a heightmap, you could read the elevation coordinates and completely discard the Raycast computation, and so on... Depends heavily on what you already got on your game.
@Destravoxii
@Destravoxii 4 жыл бұрын
Hi Brackeys! I love your videos and this is a great one for the class I'm currently in. I have one question though. when I types out "PlayerStats stats" stats is greyed out and in stats.speed I am getting red lines. speed is in our player stats script I was wondering what I could do to fix this
@lhorbrum1818
@lhorbrum1818 7 жыл бұрын
You can't go wrong with Brackeys :) Thank you for all you've done!
@ВсеволодИскаков-в3ж
@ВсеволодИскаков-в3ж 7 жыл бұрын
Simple and beautiful.
@rayanra945
@rayanra945 4 жыл бұрын
When removing the effect can't i just make a new function called normal and reverse the effect in it And in the pickup method i just add invoke and the amout of seconds i want ?
@albarnie1168
@albarnie1168 7 жыл бұрын
This is nice, but a little simple. Personally, I would handle the effects in the player class, and have an enum in the power up class that defines buff types. The power up would pass the enum value as an int, along with the multiplier into a coroutine on the player. Keep up the good work, but maybe elaborate a bit more next time, because I can see people taking this the wrong way, and having a separate class for each power up, encouraging bad habits and increasing compile times. Thanks!
@gmabber
@gmabber 7 жыл бұрын
Great tut! Thanks! You make it look almost too easy!
@prosamis
@prosamis 4 жыл бұрын
The problem with the reversion of the power up here is that it's proportional to the /current/ health rather than the amount gained at the time of taking the power up. That could be intentional, but wouldn't it be better to store the amount of health gained by the power up in a variable then subtract the player's health by that number once the duration ends?
@DexterDLopez
@DexterDLopez 7 жыл бұрын
This is super simple but very useful! And well organized!
@philiphanhurst2655
@philiphanhurst2655 6 жыл бұрын
Your videos are amazing! If I had any money, I would donate to your Patreon. Thanks for inspiring me to learn more about game design, I was about to give up on trying to develop games before I found your channel!
@SpiffyCheese2
@SpiffyCheese2 4 жыл бұрын
[CRUCIAL] If you're working in 2D make sure it's: void OnTriggerEnter2D(Collider2D other)
@tenderbender
@tenderbender 4 жыл бұрын
YOU ARE SUCH A LIFE SAVIOR
@broderickortiz4162
@broderickortiz4162 3 жыл бұрын
Thank you :3
@brunohnq
@brunohnq 6 жыл бұрын
Best thing I've made was to subscribe to this channel Keep going man!
@456panos
@456panos 7 жыл бұрын
I'm pretty sure you can run the power up reverse functions in a different thread so you can instantly destroy the game object when it is picked up and avoid disabling its components which I don't think is good practice.
@JumpsterMan
@JumpsterMan 7 жыл бұрын
Oh My God! This tutorial is so awesome and insanely packed with useful informations that I love you more than ever, thanks for your work!
@Avidi
@Avidi 7 жыл бұрын
absolutely beautiful! in my mobile game I also have power ups but the effects you put on yours really opened my mind man thank you! would love any thought on my indie mobile survival game if anyone has free time!
@wisp6916
@wisp6916 7 жыл бұрын
Avidi what’s ur game called
@Avidi
@Avidi 7 жыл бұрын
Days End
@storybookstone7318
@storybookstone7318 7 жыл бұрын
I'm looking for it but I can't find it. Is it on the google play store, or is it only for iPhone?
@Avidi
@Avidi 7 жыл бұрын
Oh im sorry! its not shipped yet, its on my channel tho
@storybookstone7318
@storybookstone7318 7 жыл бұрын
Oh I gotcha! I'll check it out!
@RandommmUserrr
@RandommmUserrr 7 жыл бұрын
love ur vids i will show u what i made u are the one who got me yo do unity
@brokenstudiotv
@brokenstudiotv 7 жыл бұрын
I love that Thumbnail!
@vigghencubing1912
@vigghencubing1912 5 жыл бұрын
If i have a runner style game and I want to add a powerup to it should I even bother with adding an effect when the player picks it up?
@FaresTabet
@FaresTabet 5 жыл бұрын
You legit explain well, thanks man
@marcelqayoom-taylor9948
@marcelqayoom-taylor9948 7 жыл бұрын
Amazing videos will donate when saved up a little more
@BlackBatA8T
@BlackBatA8T 4 жыл бұрын
Please help when i try to multiply or divide it says you can not convert a float to a int if you find a fix please help
@TheBabji
@TheBabji 7 жыл бұрын
Hi. Every time you code you do instantiate and destroy. Is there any other method to do , coz when destroy go unity takes a junk memory ....
@Potatomouse24
@Potatomouse24 3 жыл бұрын
i get a problem with my triggerenter function it wont work until i put the new functon in and then since it is new it wont be able to take in the variables from the other class PLEASE HELP ;-;
@josephromines6057
@josephromines6057 7 жыл бұрын
Love the tutorial! But I have one question about your scripting. If you're playing against other people, and they damage you while you have your health *1.4%, but then after 4 seconds it goes down /1.4%, wouldn't the health lost be less than that of the health gained from it? Example: you're at 100 health then you gain 40, but say you're down to 90 health, then you only lose 36. How would you account for making this the same 40 in the script, rather than a percentage?
@Chronosv2
@Chronosv2 7 жыл бұрын
The easiest way to do this would actually be just to forgo using multiplication entirely and set a fixed bonus, then use add and subtract. So you'd have your powerupValue be 40, and in the code instead of * powerupValue you'd use + powerupValue. Then when the powerup is supposed to fade you subtract the 40 that you gave.
@sixaintnine
@sixaintnine 7 жыл бұрын
But you should also code in: if (stats.health < 1) { stats.health = 1;} after the wait duration so that the player wouldn't die when the power up runs out .
@WaveTreader
@WaveTreader 7 жыл бұрын
just use an exact amount to add or subtract instead of multiplying...
@manankpatel2759
@manankpatel2759 6 жыл бұрын
or you can use a logic that checks if the health is greater than 100 then set it to hundred otherwise keep it as it is. Because this is not the kind of powerup that should lose its effect. if you are boosting attack power then you have to add a power down coding
@pierreg9664
@pierreg9664 6 жыл бұрын
It's game design related. Most games say the powerup will "increase your max life by 40% for 4 seconds" which means it multiplies with a factor, and not adds a value. And do the reverse when it goes down. So yes the health loss from debuff will be less than from the buff if you take damage. Same goes if you took damage before: If you are at 50/100 life it powerups to 70/140. Then if you heal to 140/140, you will return to 100/100 (and not 120/100 if it was additive). This is the way most games behave and what is commonly expected by players.
@LucinskiApps
@LucinskiApps 7 жыл бұрын
Great Tutorial! Just a quick note, you shouldnt be using a multiplier for something like health... if you have 140 health with the power up and lose 40 health during the effect.. you will end up with 100 and that gets divided by 1.4 the so you end up with much less health... you should compare if your hralth is higher than 100, then set it to 100. Else just leave it as it is :) thats how in my opinion is how its supposed to be in Games. Ofc that has nothing really to do with the tutorial, was just a quick note for game design ^^
@albarnie1168
@albarnie1168 7 жыл бұрын
FlexXx the health value he is modifying is most likely the max health. Current health would be stored in the main player class, or a game manager
@LucinskiApps
@LucinskiApps 7 жыл бұрын
Albarnie that makes it even worse :D ahen he loses health during.the powerup his max health gets very small afterwards
@albarnie1168
@albarnie1168 7 жыл бұрын
huh? just make it so on power down, if health is above max health, set it to max health. i dont see any problems with that
@LucinskiApps
@LucinskiApps 7 жыл бұрын
Albarnie well thats exactly what i explained ? Did you even read what i wrote xD?
@albarnie1168
@albarnie1168 7 жыл бұрын
I did, ive just come back to the issue after, like 3 hours. what you said is right, just maybe replace 100 with the max health variable for toggleability
@MrBaiShile
@MrBaiShile 4 жыл бұрын
How can you extend the time of power up boost if you pickup the same one twice while the effect of the first one is still active ?
@sanyadev97
@sanyadev97 5 жыл бұрын
Gish I had soooo many issues with that partice effect pack. I tought I fucked up something so I always started over when I saw the "Library\PackageCache\com.unity.postprocessing@2.0.3-preview\PostProcessing\Runtime\PostProcessManager.cs(425,66): error CS0117: 'EditorSceneManager' does not contain a definition for 'IsGameObjectInMainScenes' " error. Turned out that I had to update the Post Processing stuff inside the package manager. Dunno if anyone else had similar issues but gotta leave this here.
@prodbywadda
@prodbywadda 4 жыл бұрын
I did! You need to go under Window/PackageManager and then find Post Processing and make sure it's fully up to date. If not just hit update
@yassindridi
@yassindridi 7 жыл бұрын
You are rock too with these awesome videos !
@Das_Jonny
@Das_Jonny 7 жыл бұрын
I got a question: You are always using IEnumerators for things that shall happen after a time. As far as I know Unity has the function invoke(MethodName,TimeToWait) where you can call a method after some time. Is there a specific reason not to use Invoke mit IEnumerators?
@Yasin4880
@Yasin4880 6 жыл бұрын
what if i want my power up has spawn duration so if the player does not collide with it, the power up will disappear after period of time?
@argmentum22
@argmentum22 4 жыл бұрын
has the syntax for if (other.CompareTag("player")) changed since this video was made? I can confirm the collider is hitting with another debug but it wont compare and pass through to the pickup function. any help would be great
@dcry1003
@dcry1003 3 жыл бұрын
how do you do this to apply a speed power up? *i dont know the code for it help*
@MaZyYTube
@MaZyYTube 7 жыл бұрын
Brackeys way is very simplified way( like most time and its ok). This one is for prototyping ok. But you should let player script apply changes. Example: Player.GivePowerUp(PowerTypes.HealthBoost) Player.LosePowerUp(PowerTypes.HealthBoost).
@SR-ir2ex
@SR-ir2ex 7 жыл бұрын
MaZy At more complex games it would mess up the player script
@SunsetRacer
@SunsetRacer 6 жыл бұрын
Very nice scene! where i can find the powerupeffect in the unity particle pack ?
@XxxNikGaxxX
@XxxNikGaxxX 3 жыл бұрын
HHAHAHAHHAHAAH YES OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO first ever script i feel comfortable on modifying, the improvement hypes me up so much!!!!!
@harlow2thesecond325
@harlow2thesecond325 2 жыл бұрын
Yo, How Do I Change The Sprite Itself Or The Entire Character Without Messing Any Previous Character Follow Or Respawn?
@zaid.1271
@zaid.1271 7 жыл бұрын
Hey brackeys love your videos and i love the insight that you give I hope you can make make a video about setting an instance it a very common error that arrises atleast for me. For example i would be writing a script for rounds and in another script i want to go to the function inside the rounds script and set a new round with a function but when i do it the way i usually do it it gives me an instance error.
@justice_7_7_7
@justice_7_7_7 Жыл бұрын
You wouldn't have to deal with the Mesh & Collider enabling if you handled the collision on the player instead of the powerup. It's also most logical, since only a player can affect a powerup and no other world object.
@Lost1nTranslation
@Lost1nTranslation 7 жыл бұрын
When should you use a Coroutine vs update method? It seems that the delay can be done in either (similar to how you did it in your grenade video). Is it preference or is there a reason for the IEnumerator/Coroutine? Thanks!
@Albileon
@Albileon 7 жыл бұрын
May I ask why you didn't use the IEventSystemHandler for applying the effect?
@theradioactivemonkey
@theradioactivemonkey 7 жыл бұрын
Follow the steps carefully, step 1.. step 3... step 2.... ;-P Only teasing. As always, great tutorials fella, thanks for sharing :-)
@jonathanmndjani6228
@jonathanmndjani6228 7 жыл бұрын
Always subliminal with the tutorials man. I have a request though. I am working on 2D game in unity. Sample code below! The problem is that sometimes the delay time in the Invoke method gets skipped. The inconsistencies in the Invoke line of code is bugging. Please help. Sample code below! Thanks. public GameObject[] points = new GameObject[6]; void Update(){ if(Input.GetKey(KeyCode.A)){ PointPlay(points); } } void DelayMethod(){ } void PointPlay(GameObject[] theArray){ int start_x = 1f; int start_y = 1f; for(int i = 0; i < theArray){ theArray[i].transform.position = new Vector3(start_x, start_y, 0f); start_x += 2f; start_y += 2f; } Invoke("DelayMethod", 2.5f); }
@sandyfirmansyah9786
@sandyfirmansyah9786 4 жыл бұрын
How about to change player speed instead of getting bigger? What parameters in unity to change player speed??
@abelgroen7934
@abelgroen7934 5 жыл бұрын
I write the same text but somehow i managed to get it not working. It does not show Any debug or something. Does anybody know how to fix this or help me try to figure it out.
@HealthyWC-2
@HealthyWC-2 5 жыл бұрын
How can we help you if you didn't show us any code?
@DragonwingZify
@DragonwingZify 5 жыл бұрын
I needed a Rigidbody on my PowerUp for it to work, maybe that's your problem?
@Lucifer-ss4mz
@Lucifer-ss4mz 7 жыл бұрын
What is the difference between and ???
@diptarkadas5193
@diptarkadas5193 7 жыл бұрын
So, we need to keep the powerup object in memory until the duration runs out. It is possible to create a thread (co-routine) in gamemaster object to reverse the effect, then destroy the pickup object? Or is that over complication?
@crimsonshadow1140
@crimsonshadow1140 5 жыл бұрын
this is really cool and quite simple, I’m creating a simple local multiplayer vehicular combat game similar to twisted metal and vigilante 8 and I’m wanting to implement a random weapon pickup to the game similar to mario kart where it gives the player a random weapon when collided with pickup. the weapons are attached to a weapon holder parent object and I want to enable a random weapon (child object) from the weapon holder index. how can I implement this using this method as a base?
@iDopeShot
@iDopeShot 4 жыл бұрын
my particle effect is looping again and again pls help what to do?
@AllRetroGames
@AllRetroGames 7 жыл бұрын
Hey Brackeys, Can you make a video about creating a game similar to Worms Blast ?
@narainkarthic.n.s7835
@narainkarthic.n.s7835 4 жыл бұрын
Can we apply these 3D effects to 2D also??
LIGHTING in Unity
16:13
Brackeys
Рет қаралды 1,2 МЛН
PirateSoftware is right, this needs to stop
15:14
Theo - t3․gg
Рет қаралды 489 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
How I learned Unity without following tutorials (Developing 1)
18:11
Game Maker's Toolkit
Рет қаралды 2,1 МЛН
TILEMAPS in Unity
13:45
Brackeys
Рет қаралды 1,8 МЛН
3 Months of Learning Game Development
10:48
Byte of Michael
Рет қаралды 973 М.
Better Jumping in Unity With Four Lines of Code
12:47
Board To Bits Games
Рет қаралды 825 М.
TOP DOWN SHOOTING in Unity
19:52
Brackeys
Рет қаралды 873 М.
How to Start Gamedev in 2024
10:28
Sasquatch B Studios
Рет қаралды 635 М.
So I made every block act differently..
11:41
Element X
Рет қаралды 343 М.
How to MAKE YOUR GAME LOOK GOOD!
13:02
Brackeys
Рет қаралды 601 М.
TOUCH CONTROLS in Unity!
16:09
Brackeys
Рет қаралды 1,3 МЛН
Dust Effect when Running & Jumping in Unity [Particle Effect]
5:55
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН