Unity 2D Platformer for Complete Beginners - #8 IFRAMES

Поділитися
Вставка
  • Опубліковано 29 лис 2024

КОМЕНТАРІ • 111

  • @PandemoniumGameDev
    @PandemoniumGameDev  3 роки тому +7

    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
    ● Support the channel on Patreon or UA-cam: www.patreon.com/pandemonium_games
    ua-cam.com/channels/pkMj5b5kl2_YApDvgUCVQQ.htmljoin
    ● Subscribe to the Weekly Pandemonium Newsletter: www.pandemonium-games.com/#:~:text=About%20Me-,Weekly%20Pandemonium,-Subscribe%20to%20our

  • @AO-wj4ie
    @AO-wj4ie Рік тому +4

    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.

  • @Jason-ph8pf
    @Jason-ph8pf 3 роки тому +4

    I love what you are doing in this series. It is very clear, concise, and relevant.

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому +1

      Thank you, appreciate the support and glad it's helpful 🙂

  • @subharanjanghoshal5597
    @subharanjanghoshal5597 3 роки тому +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  3 роки тому +3

      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 3 роки тому

      @@PandemoniumGameDev Oh that's great! I'll be waiting for the coming lessons.

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому +2

      @@subharanjanghoshal5597 episode 9 is out. Next ones coming soon too 🙌

  • @micahburnside2281
    @micahburnside2281 4 місяці тому +1

    For anyone else that loses the jump and attack animations around 7:24, it's because of the layers. When we set Player and Enemy to 10 / 11,the layers get screwed up in Player Movement Script. If you click on Player, look in the inspector and scroll to the Player Movement Script. Where it says Ground and Wall, make sure Ground Layer = Player, and Wall Layer = Enemy.

  • @Elijahsing1
    @Elijahsing1 3 роки тому

    Cant wait for the next video in this series!!!

  • @puertoroc4035
    @puertoroc4035 3 роки тому +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  3 роки тому

      Great to hear that, thanks! Next episode is done and dropping today too

  • @KieranCrown
    @KieranCrown 3 роки тому

    New here, very inspired by your series. Was gutted after Brackeys had gone, you sir are a legand.

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому +2

      Thanks a lot for the support and very glad that I can help :)

  • @SarahPlaysVideoGames
    @SarahPlaysVideoGames Рік тому +1

    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.

  • @dani3lH
    @dani3lH 3 роки тому

    Just finished all of the current episodes very cool

  • @ThatOneRobloxDev
    @ThatOneRobloxDev 2 роки тому +1

    2:55 I also added a [SerializeField] private bool trigger; so I can enable and disable the iFrames

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 роки тому +1

      Good idea, if you set the duration to 0 it's going to virtually disable it but a trigger does the job too.

  • @lukke6720
    @lukke6720 3 роки тому

    Keep uploading i bet ur videos will explode someday!
    i just now finished 2#

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому +1

      Certainly hope so :) good luck with it and let me know if you have issues

    • @lukke6720
      @lukke6720 3 роки тому

      @@PandemoniumGameDev i think im fine now but kinda hard to understand what code does what but i think its bcz my English

  • @SarahPlaysVideoGames
    @SarahPlaysVideoGames Рік тому

    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 Рік тому

      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.

  • @shashanksharma1773
    @shashanksharma1773 3 роки тому +1

    Keep on making this video's you really gave us important lesson which is hard to find anywhere else

  • @maykel4027
    @maykel4027 2 роки тому +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:)

  • @kiranmajid4209
    @kiranmajid4209 3 роки тому +1

    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.

  • @mashanikolaeva3030
    @mashanikolaeva3030 2 роки тому +2

    Такая замечательная серия видео. Я в восторге

  • @Hinarukun
    @Hinarukun 2 роки тому

    Man youre tutorials really got me off the ground, you have a skill for teaching it straight to the point

  • @charleskelvinamacanin8197
    @charleskelvinamacanin8197 Рік тому +1

    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?

  • @greylampix6345
    @greylampix6345 3 роки тому +1

    So, this is the paradise

  • @Razzzor79
    @Razzzor79 3 роки тому

    Very cool, keep up the good work👍

  • @tzyoggah2898
    @tzyoggah2898 2 роки тому +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 2 роки тому

      Having the same issue and I'm using the same sprites as Pandemonium.

  • @hadiamer6511
    @hadiamer6511 15 днів тому

    for those who ran into a problem where the game freezes when player hits saw..... make sure you used IEnumerator and not IEnumerable at 3:22

  • @LearnAndEarnTV
    @LearnAndEarnTV 2 роки тому +1

    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

  • @SweetTaLe
    @SweetTaLe 2 роки тому +5

    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 2 роки тому +1

      Ye, same problem here

    • @gabormolnar7125
      @gabormolnar7125 2 роки тому +1

      @@lukspie Check, the Enemy and the player is in the same layer as in the video

    • @SweetTaLe
      @SweetTaLe 2 роки тому

      @@minhnhathuynh5190 Ahh, that makes sense! Thank you, this info is valuable.

    • @sts_e3k022
      @sts_e3k022 2 роки тому +1

      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

  • @MrMikhaelJackson
    @MrMikhaelJackson 2 роки тому +1

    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

  • @iccengel1762
    @iccengel1762 2 роки тому

    your codes are amazing thank you for good video

  • @gameprogramming6550
    @gameprogramming6550 3 роки тому

    waiting for a new video of this series!

  • @silverrebi
    @silverrebi 5 місяців тому

    love this series! is there a way to make it so health auto regenerates after a certain amount of time instead of when getting collectables?

    • @PandemoniumGameDev
      @PandemoniumGameDev  5 місяців тому

      A basic timer will do the trick. Make a time variable somewhere, increase it by Time.deltaTime in the Update and when it becomes higher than X(let's say 120 seconds) increase the health and reset the timer.

  • @niewinskipiotr1993
    @niewinskipiotr1993 2 роки тому

    Thank you so much!

  • @louiscristofaro708
    @louiscristofaro708 5 місяців тому

    Hi there,
    Everything works well, but one issue. I can't figure out what the exact trigger for that is, but while and after iFrames, while moving through the shown enemy, my player falls through the ground.
    Hope you'll read my issue and help ...

    • @louiscristofaro708
      @louiscristofaro708 5 місяців тому

      Correction: Figured out the problem are not the iFrames. It has something to do with the Enemy itself. I glitch through a point behind his body. What's the problem?

  • @insane6782
    @insane6782 3 роки тому

    less goo finnaly

  • @saftmoonlight
    @saftmoonlight 3 роки тому

    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

  • @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?

  • @SophieThomson-i6g
    @SophieThomson-i6g Рік тому

    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 8 місяців тому

    The Autocolmplete (Double tab) in Visual studio doesn't work for me but the code itself works just fine amazing videos!

  • @siyovushdodojanov9344
    @siyovushdodojanov9344 4 місяці тому

    Thank you Man My First Donation goes to you after my first income Thank you Man

  • @SakiDeira
    @SakiDeira 2 роки тому +1

    the sprite changes happened but still not invulnerable. I copied your entire code to see if that works but no invulnerability.

  • @Eledime
    @Eledime 9 місяців тому

    I cant get my player to flash when taking damage. Help?

  • @nguyenducanh03
    @nguyenducanh03 Рік тому

    hey, 2seconds / 3 * 2 = 1,33.
    --> iFramesDuration / numberOfFlashes / 2
    not iFramesDuration / numberOfFlashes * 2

  • @mashanikolaeva3030
    @mashanikolaeva3030 2 роки тому

    Спасибо!

  • @ADEEGANTENGG
    @ADEEGANTENGG 2 роки тому

    Thanks!!!

  • @hemmikotlin2589
    @hemmikotlin2589 2 роки тому

    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 2 роки тому

      I would be very grateful if you could help me

  • @Kopellis
    @Kopellis 2 роки тому

    any fix for not all codes return to value . for the ienumerator

  • @thomascoker3967
    @thomascoker3967 Рік тому +1

    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 Рік тому +1

      I have the same issue. Did you solve the problem?

    • @canylm
      @canylm Рік тому +1

      I have the same problem

    • @hornyhoney69
      @hornyhoney69 Рік тому +1

      I have same problem

    • @UrMyNiece
      @UrMyNiece 9 місяців тому +1

      Have you solved it yet i have the same problem

    • @micahburnside2281
      @micahburnside2281 4 місяці тому

      I have the same exact problem

  • @pythonwithdp8373
    @pythonwithdp8373 3 роки тому

    rEAlly really good content

  • @KINGGAMES-qd8sn
    @KINGGAMES-qd8sn 2 роки тому

    i delet my minacamra but i do not how back my camre

  • @deveshsharma6609
    @deveshsharma6609 3 роки тому

    Hi ,amezing work buddy .can you make one tutorial on how to swim under water or how to create water in unity 2d

  • @izeckx
    @izeckx 3 роки тому

    How would I do the flashing if my character is made from more than one sprite?

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому +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 3 роки тому

      @@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 роки тому +1

      @@izeckx I personally used EntityRenderer instead of the SpriteRenderer class and it seemed to do the trick.

  • @blockido2151
    @blockido2151 3 роки тому +1

    Can you make a game over tutorial?

  • @vrzcc
    @vrzcc 3 роки тому

    PLEASE Tell Me how to import projects, I got stuck at lvl 3 and I cant import it!

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому

      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

  • @the1sanash
    @the1sanash 3 роки тому

    Start coroutine my brain:
    "NO NOOOOOOOOOOOOOOO NOT AGAIN"

  • @carlmoreau4377
    @carlmoreau4377 3 роки тому

    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  3 роки тому +1

      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 😁

  • @jefferrr7376
    @jefferrr7376 3 роки тому +1

    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  3 роки тому +1

      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 3 роки тому

      @@PandemoniumGameDev something like that

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому

      @@jefferrr7376 like what? :D

    • @jefferrr7376
      @jefferrr7376 3 роки тому

      @@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 3 роки тому

    Можно какой ни будь урок по созданию игры типа Alien Shooter на пк

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому +1

      Давно в планах сделать что-то такое, попробую успеть в следующие 2-3 месяца.

    • @solo8968
      @solo8968 3 роки тому

      @@PandemoniumGameDev было бы круто запилить 3д шутер с атмосферной локацией. И загрузить его в стим. Готов тебе заплатить если доведёшь меня до конечного результата. Я веб разработчик, но сейчас что-то заинтересовал геймдев

  • @arniguarded3697
    @arniguarded3697 3 роки тому

    Please make a tutorial on how to collect money Unity SHOP SYSTEM Tutorial - UA-cam

  • @solo8968
    @solo8968 3 роки тому +1

    Когда будет урок на русском ?

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому

      Сорри, не думаю что вообше будет. Большинство моих сабсов не знают русский.

    • @PandemoniumGameDev
      @PandemoniumGameDev  3 роки тому

      Как ты вообше узнал что я говорю на русском? :D

    • @solo8968
      @solo8968 3 роки тому

      @@PandemoniumGameDev акцент чувствуется ))

    • @CorinJK
      @CorinJK Рік тому

      @@PandemoniumGameDev а я то думаю почему на русском почти нет дельных видосов по созданию игр 😂 нашлась пропажа