Unity 2D Platformer for Complete Beginners - #8 IFRAMES

  Рет қаралды 55,034

Pandemonium

Pandemonium

Күн бұрын

In this episode we'll add invulnerability frames to our health system after the player takes damage and fix a couple issues as well.
➤ Starting Project: github.com/nickbota/Unity-Pla...
➤ Complete Project: github.com/nickbota/Unity-Pla...
Consider supporting the channel on Patreon:
➤ Patreon: / pandemonium_games
➤ Discord : / discord
➤ Itch: nickbota.itch.io/​
➤ Instagram: / pandemonium_games
➤ Twitter: / pandemoniumnick​
#pandemonium​ #unity2dplatformer​ #unitybeginner​
Tags: unity 2d platformer for complete beginners,unity 2d platformer,Unity 2D Platformer for Complete Beginners - #8 IFRAMES,unity 2d platformer episode 8,platformer for complete beginners,unity 2d platformer tutorial 2021,unity 2d player movement 2021,unity complete beginner,unity iframes,unity invulnerability frames,unity3d,unity 2d,unity tutorial,unity platformer,unity damage system,unity health,unity 2d animation,iframes,unity health system,pandemonium games
0:00​ Intro
0:07 Fixes
1:29 Creating the Layers
1:51 iFrames
6:20 Tweaking
7:24 Final Result
7:41 Patreon Shoutout

Пікірлер: 98
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Everyone who's having issues with the code, here's the complete script: github.com/nickbota/Unity-Platformer-Episode-8/blob/main/Assets/Scripts/Health/Health.cs
@Jason-ph8pf
@Jason-ph8pf 2 жыл бұрын
I love what you are doing in this series. It is very clear, concise, and relevant.
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Thank you, appreciate the support and glad it's helpful 🙂
@Elijahsing1
@Elijahsing1 2 жыл бұрын
Cant wait for the next video in this series!!!
@subharanjanghoshal5597
@subharanjanghoshal5597 2 жыл бұрын
Wow! I guess this was the last video of this series. It felt so awesome to understand the coding and other technicalities behind a 2D platform game. Thanks a million for taking me on this trip. Now I will try to make my own 2D Platformer from scratch. I wish you make such a series for making a turn based multiplayer 2D game. That would be so amazing!!!
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Not the last one, literally finished the next episode yesterday, dropping it today. There will be 3-4 more episodes for sure until this is a playable game
@subharanjanghoshal5597
@subharanjanghoshal5597 2 жыл бұрын
@@PandemoniumGameDev Oh that's great! I'll be waiting for the coming lessons.
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
@@subharanjanghoshal5597 episode 9 is out. Next ones coming soon too 🙌
@puertoroc4035
@puertoroc4035 2 жыл бұрын
Dude…..thank you u really made it very easy for a beginner like myself to understand, I still have ways to go but you gave me a great first step 👍
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Great to hear that, thanks! Next episode is done and dropping today too
@AO-wj4ie
@AO-wj4ie Жыл бұрын
For those of you who are unable to find the IEnumerator interface in Unity, if it's showing red line in the code, it's possible that you may have forgotten to include the System.Collections namespace in your script. IEnumerator is a part of the System.Collections namespace, so in order to use it, you need to ensure that your script has access to that namespace. So just write "Using System.Collections" at the top of your script.
@KieranCrown
@KieranCrown 2 жыл бұрын
New here, very inspired by your series. Was gutted after Brackeys had gone, you sir are a legand.
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Thanks a lot for the support and very glad that I can help :)
@iccengel1762
@iccengel1762 2 жыл бұрын
your codes are amazing thank you for good video
@dani3lH
@dani3lH 2 жыл бұрын
Just finished all of the current episodes very cool
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Thanks a lot! next one coming in a couple day
@niewinskipiotr1993
@niewinskipiotr1993 Жыл бұрын
Thank you so much!
@shashanksharma1773
@shashanksharma1773 2 жыл бұрын
Keep on making this video's you really gave us important lesson which is hard to find anywhere else
@SarahPlaysVideoGames
@SarahPlaysVideoGames 10 ай бұрын
Heads up for people like me who couldn't get the invulnerability to work: Make sure the player and the enemy/trap are on the correct layers in the Inspector.
@Razzzor79
@Razzzor79 2 жыл бұрын
Very cool, keep up the good work👍
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Thanks! Definitely will 🙌
@lukke6720
@lukke6720 2 жыл бұрын
Keep uploading i bet ur videos will explode someday! i just now finished 2#
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Certainly hope so :) good luck with it and let me know if you have issues
@lukke6720
@lukke6720 2 жыл бұрын
@@PandemoniumGameDev i think im fine now but kinda hard to understand what code does what but i think its bcz my English
@insane6782
@insane6782 2 жыл бұрын
less goo finnaly
@maykel4027
@maykel4027 2 жыл бұрын
Hello What if I have multiple body parts like legs, weapons, accessories and I also want them to have blinking effects when the player is damaged? Everything works just fine for me but the effect only affects the body and not the body parts I've mentioned. Thanks for the help:)
@mxtrem3
@mxtrem3 2 жыл бұрын
Man youre tutorials really got me off the ground, you have a skill for teaching it straight to the point
@charleskelvinamacanin8197
@charleskelvinamacanin8197 8 ай бұрын
Hi, the code is working fine for me, but eveytime iFrames activates the animations deactivates, the anims for walking and firing, I can only loop back to normal animations when I jump. is there something I did wrong?
@ADEEGANTENGG
@ADEEGANTENGG 2 жыл бұрын
Thanks!!!
@mashanikolaeva3030
@mashanikolaeva3030 2 жыл бұрын
Спасибо!
@gameprogramming6550
@gameprogramming6550 2 жыл бұрын
waiting for a new video of this series!
@pythonwithdp8373
@pythonwithdp8373 2 жыл бұрын
rEAlly really good content
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Thank you!
@mashanikolaeva3030
@mashanikolaeva3030 2 жыл бұрын
Такая замечательная серия видео. Я в восторге
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Спасибо!
@kiranmajid4209
@kiranmajid4209 2 жыл бұрын
Not sure if you have a chance to read this comment, but I got everything working up until the saw so far, but whenever my character touches it, the die animation plays instead of the hurt animation, checked to make sure they are all in the right place & walked through everything a few times so a little confused.
@greylampix6345
@greylampix6345 2 жыл бұрын
So, this is the paradise
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Can't figure out if this is a compliment or not :D
@MrMikhaelJackson
@MrMikhaelJackson 2 жыл бұрын
I have a question. If I take damage with s and pause game (I made pause menu) and go back to menu and start again I don't take damage plz help
@ThatOneRobloxDev
@ThatOneRobloxDev 2 жыл бұрын
2:55 I also added a [SerializeField] private bool trigger; so I can enable and disable the iFrames
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Good idea, if you set the duration to 0 it's going to virtually disable it but a trigger does the job too.
@user-uf7vl3od4t
@user-uf7vl3od4t 10 ай бұрын
Tried all your code and they match perfect, player still not receiving damage from the saw and hurting/dying, any thoughts as to why this may be the case and any help would be greatly appreciated. Thanks
@dr.mechanicus7081
@dr.mechanicus7081 2 ай бұрын
The Autocolmplete (Double tab) in Visual studio doesn't work for me but the code itself works just fine amazing videos!
@tzyoggah2898
@tzyoggah2898 2 жыл бұрын
Out of all things that could happen, the changing of the sprite color doesn't work for me. I am not sure why. The for loop works and the enumerator works as well. I checked everything with Debug.Log and it all seems fine. It's like the animations are more dominant and will not allow a color change. (And I am not changing any colors in the animations). The only difference is that I am using my own sprites. Do I maybe need to go with a certain setting for the sprites?
@timetomeditate8129
@timetomeditate8129 Жыл бұрын
Having the same issue and I'm using the same sprites as Pandemonium.
@saftmoonlight
@saftmoonlight 2 жыл бұрын
the player gets hit 2 times (once because the enemy attacks him and the second time because of the damage of collision wich you showed in eps 10) so he loses 2 lives before the Invincibility starts how can i fix that
@deveshsharma6609
@deveshsharma6609 2 жыл бұрын
Hi ,amezing work buddy .can you make one tutorial on how to swim under water or how to create water in unity 2d
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
I'll add it the list, but not in this series
@SarahPlaysVideoGames
@SarahPlaysVideoGames 10 ай бұрын
Okay, I have to ask you for some extra help again. So, I implemented the s code and it works as it should... with one exception. If the player is hit with two different things at the same time (which is most noticeable if you're standing on spikes and the saw when your s run out), you take damage from both of them at the same time. I would like to change it so that you only take damage from the strongest single hit you took if two things hit you at the exact same time. I understand the chances of getting hit twice in a single frame is exceptionally low, but I still want to ensure it can't combo out the player needlessly.
@SNOZ562
@SNOZ562 6 ай бұрын
Make a bool flag called something like "IsProcessingHit" or something. Set this true in the collision detection whenever the collision event fires. Now, at the top of your collision event have a conditional that checks if this flag is true, and if so, return out of the collision event and dont process any of the collision logic. Then set IsProcessingHit to false at the end of your Ienumerator once it is done with the invincibility time. Collision events (as well as any Unity API) runs on the main thread. This means they are all synchronous. Which means if a flag gets set to true in one collision event, by the time it gets to next collision event it will already be true and you will be able to essentially back out of the collision event. If you want to be able to process only the highest damage, you will have to do some additional work. The best thing to do is setup a data structure system that captures all damage processed by separate collision events and dont process the damage immediately in the collision event. Instead, inside of your update method have some logic checking this datastructure to see if has anything contained within it, then process the highest damage stored in that collection and throw away the rest. Collisions occur before any Update methods in the unity event order of execution, so you can basically delay the damage processing until you get to your update. This isn't technically the "best" way to handle it, but it is the easiest and will get the job done. Other methods would require much more explanation than I am able to provide in a single youtube comment.
@LearnAndEarnTV
@LearnAndEarnTV 2 жыл бұрын
Man I got a problem. all things are working except that my player can only get hurt once and after that it became invulnerable the saw cant hurt it anymore. please help
@carlmoreau4377
@carlmoreau4377 2 жыл бұрын
I really enjoy your contents even tho im new i already enjoy some of your videos, keep on. But i cant find your video game(Dive) on play store, thats sad, cause i wanted to support
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Thanks for the support 🙏 here it is: play.google.com/store/apps/details?id=com.PandemoniumGames.DiveFinal It's not bringing in almost any revenue though, so if you like my videos just keep watching them, that helps more 😁
@Carricx
@Carricx Жыл бұрын
Hi, i tried this video and it worked very well, except for the fact that when i respawn, i'm invulnerable forever. Help?
@SweetTaLe
@SweetTaLe 2 жыл бұрын
I'm using your code, but it seems my character still keeps taking consecutive damage. Here in the video it seems to work, but in my game the player character can be hit back to back every time it collides with an enemy or a projectile. The only thing that works are the flashes. For an example, I created an enemy that shoots three bullets in rapid succession. All of these bullets can collide with the player and the player dies instantly. Three bullets, three HP. Same happens if I walk into a trap, walk out of it and quickly walk back into it. Interestingly if you stand on top of a trap the player doesn't take further damage as long as you don't move out of it. I wonder what's causing this? I'm using your code for health, enemies, taking damage and these i-frames.
@lukspie
@lukspie Жыл бұрын
Ye, same problem here
@gabormolnar7125
@gabormolnar7125 Жыл бұрын
@@lukspie Check, the Enemy and the player is in the same layer as in the video
@SweetTaLe
@SweetTaLe Жыл бұрын
@@minhnhathuynh5190 Ahh, that makes sense! Thank you, this info is valuable.
@sts_e3k022
@sts_e3k022 Жыл бұрын
Still don't work for me. All layers are the same as in the video, i even copied the github script and the error "NullReferenceException: Object reference not set to an instance of an object" comes up in unity
@Kopellis
@Kopellis 2 жыл бұрын
any fix for not all codes return to value . for the ienumerator
@arminghorbani6887
@arminghorbani6887 Жыл бұрын
@@AhmetBabagil. didnt work
@Eledime
@Eledime 3 ай бұрын
I cant get my player to flash when taking damage. Help?
@izeckx
@izeckx 2 жыл бұрын
How would I do the flashing if my character is made from more than one sprite?
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
You'll need to create an array that holds all the sprite renderers, than use a loop to flash all of them
@izeckx
@izeckx 2 жыл бұрын
@@PandemoniumGameDev not sure I know how to do that, but at least now I have an idea of what try. Thank you.
@Thydus.
@Thydus. 2 жыл бұрын
@@izeckx I personally used EntityRenderer instead of the SpriteRenderer class and it seemed to do the trick.
@vrzcc
@vrzcc 2 жыл бұрын
PLEASE Tell Me how to import projects, I got stuck at lvl 3 and I cant import it!
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Go to the GitHub link of the episode you want to download and just download the zip archive. Unzip it and open it in UnityHub, should be simple. DM me on discord if you can't make it work
@KINGGAMES-qd8sn
@KINGGAMES-qd8sn Жыл бұрын
i delet my minacamra but i do not how back my camre
@nguyenducanh03
@nguyenducanh03 Жыл бұрын
hey, 2seconds / 3 * 2 = 1,33. --> iFramesDuration / numberOfFlashes / 2 not iFramesDuration / numberOfFlashes * 2
@reapindemon
@reapindemon 2 жыл бұрын
the sprite changes happened but still not invulnerable. I copied your entire code to see if that works but no invulnerability.
@mertincesu7097
@mertincesu7097 Жыл бұрын
same here
@the1sanash
@the1sanash 2 жыл бұрын
Start coroutine my brain: "NO NOOOOOOOOOOOOOOO NOT AGAIN"
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Why? You find it hard to understand coroutines?
@hemmikotlin2589
@hemmikotlin2589 Жыл бұрын
hi, great job, but I don't understand how to make it so that when the lives are full, they don't rise, they don't replenish
@hemmikotlin2589
@hemmikotlin2589 Жыл бұрын
I would be very grateful if you could help me
@blockido2151
@blockido2151 2 жыл бұрын
Can you make a game over tutorial?
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Yes sure. I plan to make this a complete game
@thomascoker3967
@thomascoker3967 Жыл бұрын
Has anyone had any issues where after adding sorting layers, and going through the previous tutorials your player jumping and attacking animations won't play?
@azimeulker
@azimeulker 10 ай бұрын
I have the same issue. Did you solve the problem?
@canylm
@canylm 9 ай бұрын
I have the same problem
@cricketo2001
@cricketo2001 6 ай бұрын
I have same problem
@UrMyNiece
@UrMyNiece 2 ай бұрын
Have you solved it yet i have the same problem
@jefferrr7376
@jefferrr7376 2 жыл бұрын
Please make tutorial if the enemy not see the player than the enemy shut patrol.. But if the enemy is see the player than the enemy is jump and jump.. :)
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
I understood that you want a patrol behavior for the enemies, but could you explain this: "than the enemy is jump and jump"?
@jefferrr7376
@jefferrr7376 2 жыл бұрын
@@PandemoniumGameDev something like that
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
@@jefferrr7376 like what? :D
@jefferrr7376
@jefferrr7376 2 жыл бұрын
@@PandemoniumGameDev like if the enemy see the player and the enemy shut jump and jump but if not the enemy shut patrol
@anthonylewis3804
@anthonylewis3804 2 жыл бұрын
@@jefferrr7376 ?
@solo8968
@solo8968 2 жыл бұрын
Можно какой ни будь урок по созданию игры типа Alien Shooter на пк
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Давно в планах сделать что-то такое, попробую успеть в следующие 2-3 месяца.
@solo8968
@solo8968 2 жыл бұрын
@@PandemoniumGameDev было бы круто запилить 3д шутер с атмосферной локацией. И загрузить его в стим. Готов тебе заплатить если доведёшь меня до конечного результата. Я веб разработчик, но сейчас что-то заинтересовал геймдев
@arniguarded3697
@arniguarded3697 2 жыл бұрын
Please make a tutorial on how to collect money Unity SHOP SYSTEM Tutorial - KZbin
@solo8968
@solo8968 2 жыл бұрын
Когда будет урок на русском ?
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Сорри, не думаю что вообше будет. Большинство моих сабсов не знают русский.
@PandemoniumGameDev
@PandemoniumGameDev 2 жыл бұрын
Как ты вообше узнал что я говорю на русском? :D
@solo8968
@solo8968 2 жыл бұрын
@@PandemoniumGameDev акцент чувствуется ))
@CorinJK
@CorinJK Жыл бұрын
@@PandemoniumGameDev а я то думаю почему на русском почти нет дельных видосов по созданию игр 😂 нашлась пропажа
Unity 2D Platformer for Complete Beginners - #9 TRAPS
41:45
Pandemonium
Рет қаралды 81 М.
He said I Couldn't Make a 3D Game... So I Made One!
10:29
Dani
Рет қаралды 9 МЛН
Did you find it?! 🤔✨✍️ #funnyart
00:11
Artistomg
Рет қаралды 78 МЛН
ОДИН ДОМА #shorts
00:34
Паша Осадчий
Рет қаралды 6 МЛН
Mojang just changed Pistons forever. And people hate it.
4:06
Phoenix SC
Рет қаралды 598 М.
Unity 2D Platformer for Complete Beginners - #1 PLAYER MOVEMENT
15:38
How to make a Video Game - Godot Beginner Tutorial
1:17:12
Brackeys
Рет қаралды 740 М.
Unity 2D Platformer for Complete Beginners - #7 HEALTH SYSTEM
23:17
Unity 2D Platformer for Complete Beginners - #10 ENEMIES
52:05
Pandemonium
Рет қаралды 139 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 670 М.
The Making of Karlson 2D (Game)
11:41
Dani
Рет қаралды 6 МЛН
Unity Player Health and Health bar Tutorial
10:52
MoreBBlakeyyy
Рет қаралды 14 М.
A Great Way To Setup POWERUPS In Your Unity Game
13:43
Frog Prince Rush With Herobrine and Entity
0:32
Realistic Craft
Рет қаралды 43 МЛН
BRONZE TO GRANDMASTER SKILL IN REAL lIFE
0:17
FRN PLAYER 444
Рет қаралды 67 МЛН
Stu Mutation gone WRONG☠️ #brawlstars #shorts
0:14
HB Nico Zockt
Рет қаралды 3,9 МЛН
ВЕРИТ ЛИ ТИГРА БУЛЛИ?
0:32
Pimpochka Games
Рет қаралды 2,4 МЛН
СКРАФТИТЬ БЕДРОК - ЛЕГКО✅
0:32
ВЛАДУС
Рет қаралды 2,7 МЛН