Unity 2D Platformer for Complete Beginners - #10 ENEMIES

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ก.ย. 2024

ความคิดเห็น • 340

  • @PandemoniumGameDev
    @PandemoniumGameDev  2 ปีที่แล้ว +26

    Thanks for everyone for the patience, this one was a pain to record, I managed to mess up the video a couple times and had to redo it. Hope everything is clear and let me know if you need help, also check the GitHub project if you need the code: github.com/nickbota/Unity-Platformer-Episode-10
    For everyone who's getting UnassignedReferenceException when your fireballs hit something change this part of the code:
    collision.GetComponent().TakeDamage(damage); to this: collision.GetComponent()?.TakeDamage(damage);
    The ? will check if the object has a Health component before trying to damage it.

    • @CryptoMM1
      @CryptoMM1 2 ปีที่แล้ว

      lovely videos, you are an excellent teacher, thanks for helping us.

    • @sahil8116
      @sahil8116 ปีที่แล้ว

      Hello sir when I hurts my enemy he get die but still moving please sir tell me

    • @PhantomAbyss
      @PhantomAbyss ปีที่แล้ว +1

      Epic video! idk why the channel is underrated I guess no one wants to become and Albert Einstein like you!(im not smart)
      Ahem.. Btw the EnemyFireball is not visible when he the enemy shoots but the invisible fireball still hits the player the sorting layer on the fireballs is set to Foregrounds so idk the problem Please Help dude!

    • @purejaguare
      @purejaguare 8 หลายเดือนก่อน

      I have a problem where the person dies but keeps moving when I move over him.

    • @mashupsbyrens285
      @mashupsbyrens285 6 หลายเดือนก่อน

      Idk if I'm too late; but you can click the + icon in the MeleeEnemy/RangedEnemy script, and select the EnemyPatrol game Obejct in it. It would load up the script in it, and then it would also disable the EnemyPatrol script@@purejaguare

  • @mrsworder
    @mrsworder 2 ปีที่แล้ว +67

    Probably one of the best unity tutorials creator, you dont just make us copy the code( yes doing this we would create a game, but we don't learn nothing about how to make a game by ourself) , but you explain well how the code we just typed works! Sad to see the channel really underrated :(

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว +8

      Really glad to help! Don't worry it's been growing steadily, also I need to be more consistent and put out more stuff

    • @PhantomAbyss
      @PhantomAbyss ปีที่แล้ว

      Yo bro can you help me with the DamagePlayer() Event in Melee Attack in the script it is saying it is unused and in the unity editor its saying its not supported so how do you fix it? pls help
      Epic Tutorial btw Love it!@@PandemoniumGameDev

  • @tapthelvete
    @tapthelvete 2 ปีที่แล้ว +18

    I've been looking for reliable and easy to understand Unity tutorials and I hadn't found one... Until now. Your explanations are wonderfully constructed and I actually feel like I am learning. It's quite sad to see how little subscribers you have, but at least I can contribute by adding one more! Thank you for these videos and I hope you have an amazing 2022!

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว +3

      Thanks a lot! It's been growing steadily, we'll get there

  • @siyovushdodojanov9344
    @siyovushdodojanov9344 2 หลายเดือนก่อน

    Greatest Tutorial With All Details Ever Seen Here in my 1.5 year of learning started from WebDev to Get Understanding of Programing then Android App Development and finally half year ago started unity and that is were i want to stop Shout Out To this Man He is Incredible

  • @RMCMiner
    @RMCMiner 2 ปีที่แล้ว +3

    Ive been waiting for so long, so happy the new one is out!

  • @maxy2479
    @maxy2479 ปีที่แล้ว +1

    Wow... Underrated... Code actually works unlike other codes.

  • @mapkocc
    @mapkocc 3 หลายเดือนก่อน +1

    18:42 little optimization quirk
    Putting in "if(hit.collider != null)" inside the "PlayerInSight()" method to see if it needs to get the health component of the player means it's doing this check every single frame. Plus, it re-assigns "playerHealth" with the same value every frame the player is in range. But the method already returns the result of "hit.collider != null" at the end. The DamagePlayer() method already checks "if(PlayerInSight())" to execute "TakeDamage()", so it's basically doing the same check twice.
    You can just declare the "Raycasthit2D hit" variable as private outside of the method, which means DamagePlayer() will have access to it when it's called. You end up not needing the "playerHealth" variable. So it can just be:
    private void DamagePlayer()
    {
    if(PlayerInSight())
    hit.transform.GetComponent().TakeDamage(damage);
    }
    The only way PlayerInSight() will return true (and therefore run the next line) is if the "hit" variable currently contains the player object it has collided with in the check. Had no issues trying it this way. Saved a single glorious check per frame. Mom would be proud.

  • @アイス-w3m
    @アイス-w3m 2 ปีที่แล้ว +2

    Finally! Thanks so much! Your tutorials are really helpful and well organized.

  • @PokimBarran
    @PokimBarran ปีที่แล้ว +1

    Thank you so much I have been stuck on this for days. Really helped thanks.

  • @waltersattazahn1480
    @waltersattazahn1480 2 ปีที่แล้ว +3

    Another good video. I got everything to work, and was able to solve any issues I had.
    I would like to share that the last issue I had was that my RangedEnemy Firepoint was not changing direction with the RangedEnemy's direction. I found out that the FireballHolder(the empty object that holds the Projectiles) had to have a similar setup as the Player in that it cannot be a child of the RangedEnemy.

  • @ushas3349
    @ushas3349 7 หลายเดือนก่อน

    Thank you so much for the wonderful unity 2D platformer series. I enjoy creating the games along with you. Usha

  • @scorpiusjones5436
    @scorpiusjones5436 ปีที่แล้ว +2

    Great series as always! Quick thing I found at the end of this tut is the EnemyPatrol object can be very specific about what variables are active in it. You have to plug these variables in when we first made it (I think they are "Enemy: Enemy" and "Enemy:Anim". If you add an enemy to the hiarchy that also has EnemyPatrol object, you must plug those variables back in or your enemy won't move/attack/idle. Maybe I just missed something, or maybe there's a workaround, but it's not THAT bad. Just good to keep in mind

  • @anastarek4491
    @anastarek4491 ปีที่แล้ว

    This is the best channel in the world. I learned many things from you and applied them and became good at making games. Thank you.

    • @PandemoniumGameDev
      @PandemoniumGameDev  ปีที่แล้ว

      This is the best thing to hear! Thanks a lot and keep getting better 🔥

  • @prochysolaire9055
    @prochysolaire9055 2 ปีที่แล้ว +6

    I dont know why but i have the code completely same but my RaycastHit2D hit does not trigger when player is inside the red box

    • @sogyshorts5662
      @sogyshorts5662 6 หลายเดือนก่อน

      did u solve it? and if yes, how?

    • @elizabeth16756
      @elizabeth16756 3 หลายเดือนก่อน

      @@sogyshorts5662 Having the same issue as well!

  • @mfspawn1474
    @mfspawn1474 2 ปีที่แล้ว

    Following so far and loving it!

  • @balab1622
    @balab1622 ปีที่แล้ว +1

    i will not give up and finish this series !!!

  • @lachuchacanucha
    @lachuchacanucha ปีที่แล้ว

    Thank you so much for this course, it is really helpful!

  • @patrickkusmajadi4736
    @patrickkusmajadi4736 2 ปีที่แล้ว +1

    thANKS NOW I KNOW HOW TO MAKE A TIMER sorry for capslock im to lazy to change them

  • @Ray-wt2rr
    @Ray-wt2rr 2 ปีที่แล้ว

    Thanks for uploading. after waiting all this time

  • @danieltai6494
    @danieltai6494 4 หลายเดือนก่อน

    If someone's fire ball is shooting without any cooldown, go to animation, and check the transition from ranged attack back to idle and make sure there isn't a trigger(ranged attack) there

    • @user-NguyenQuocDat
      @user-NguyenQuocDat 4 หลายเดือนก่อน

      my meleeAttack animation is called 2 times. How to fix it bro ?

  • @XxmichaelxX321
    @XxmichaelxX321 2 ปีที่แล้ว +1

    Thank you so much for all these videos! Idk where I’d be without it!!
    Do you think you can show us how to make our character go between scenes, like going between levels?

  • @gabssanto
    @gabssanto 2 ปีที่แล้ว

    Awesome videos! Are helping me a lot to learn how to proper use Unity

  • @Majitsu_san
    @Majitsu_san 2 ปีที่แล้ว +2

    I still have a problem when melee enemy patroling the points he doesn't stop to hit me. He goes to the end of the edge and only than makes a hit///

  • @aychar
    @aychar 2 ปีที่แล้ว +4

    Would it not make more sense to make a base Enemy class and then have RangedEnemy and MeleeEnemy inherit from it to prevent copy and pasting your code?

    • @computernerd8157
      @computernerd8157 หลายเดือนก่อน +1

      I think you are correct. I know this is a year old, but its awesome when people who are learning think of optimization. Personally, I am glad he did not do it because it allows people learning room to grow.

  • @malwida1022
    @malwida1022 11 หลายเดือนก่อน +2

    I resolved an issue that bugged me for a long time: whenever the enemy changed direction, all enemy fireballs already in flight suddenly appeared on the other side of the screen, because the Enemy fireball holder changed direction along with the enemy. I couldn't figure out why this is not happening in the tutorial, and why behaviour was different for me. I finally fixed it by disabling the EnemyFireballHolder script (which follows the direction of the enemy) and instead implementing the same logic that is applied to the player fireballs (set direction in the PlayerAttack and Projectile scripts) in the RangedEnemy and EnemyProjectile scripts. Now everything works as expected, maybe this helps others with the same issue.

  • @GeRgOyt
    @GeRgOyt 2 ปีที่แล้ว

    'Guess i'll die' lmao you're the best :D

  • @PavanKumar-hs6qz
    @PavanKumar-hs6qz ปีที่แล้ว +1

    MissingReferenceException: The object of type 'Animator' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.

  • @shashanksharma1773
    @shashanksharma1773 2 ปีที่แล้ว

    thank you just thank you man you are just amazing

  • @StigDesign
    @StigDesign 2 ปีที่แล้ว

    Great Tutorial :D Love it :)

  • @karun7275
    @karun7275 2 ปีที่แล้ว +3

    for some reason i get the red box but when the player walks into the range of the enemy the attack animation does not trigger and the player doesnt even get damaged.
    and i think the root of the problem is the raycast is not detecting the player is there as the animation when the player is in sight to attack is never called.

    • @prochysolaire9055
      @prochysolaire9055 2 ปีที่แล้ว +1

      i have same problem

    • @cosfia2167
      @cosfia2167 2 ปีที่แล้ว +1

      I have the same problem ;;

    • @cosfia2167
      @cosfia2167 2 ปีที่แล้ว

      no idea if this is still relevant, but I had the same problem and its probably not the best way to solve it but I simply put the distance value (5th one) > 0 and that triggered the animation for me
      RaycastHit2D hit =
      Physics2D.BoxCast(boxColl.bounds.center + transform.right * range * transform.localScale.x * colliderDistance,
      new Vector3(boxColl.bounds.size.x * range, boxColl.bounds.size.y, boxColl.bounds.size.z),
      0, Vector2.left, *0.2f* , playerLayer);

    • @sanjanar6218
      @sanjanar6218 2 ปีที่แล้ว

      Did you ever solve it? And if you did, what did you do?

    • @sogyshorts5662
      @sogyshorts5662 6 หลายเดือนก่อน

      same Problem, did u solve it?
      @@sanjanar6218

  • @kieranryan7625
    @kieranryan7625 2 ปีที่แล้ว +3

    Another dumb question, my ranged enemy works perfectly. Except that when he is patrolling he is moving backwards haha. Like he moves right while facing left. He hits the right edge and turns, then he faces right and moves left. I'm using a different sprite but I'm sure it's something I'm overlooking. Thanks.

    • @watchmytvjctechnology8448
      @watchmytvjctechnology8448 ปีที่แล้ว

      I'm not a game engine guy i prefer coding everything , but i think the problem can be resolved by change flip depending on your sprite , if it is face right by default in left controller set it to true then set it back to false in right controller ,else do the opposite.
      Here's an example :
      th-cam.com/video/XIEtt4GH_Mo/w-d-xo.html

  • @PianoGreenGaming
    @PianoGreenGaming 2 ปีที่แล้ว +1

    If you want a different enemy sprite that looks a bit different there is also ninja sprite sheet on the unity asset store by the same creator as the knight one.

  • @MORIARTI27
    @MORIARTI27 6 หลายเดือนก่อน +1

    Hello, can you help? Very necessary!! 1. The enemy continues to hit when he is patrolling and when he killed me. 2. When my character is dying, he continues to move, and when I jump, his image appears, what should I do? Perhaps someone knows...

    • @stxrmx3548
      @stxrmx3548 3 หลายเดือนก่อน

      I have the same issue, did you fix it by any chance?

    • @stxrmx3548
      @stxrmx3548 3 หลายเดือนก่อน +1

      Nevermind, I fixed it. You just need to rewatch this moment - 32:15. The issue was in health script, so just write code more carefully

    • @MORIARTI27
      @MORIARTI27 3 หลายเดือนก่อน

      Okay

    • @user-fj3ok1om2h
      @user-fj3ok1om2h 3 หลายเดือนก่อน

      ​@@stxrmx3548 My enemy hasn't changed, he still beats me when I'm already dead

  • @khnuxsora
    @khnuxsora 2 ปีที่แล้ว +3

    for some reason the animation isnt triggering ..i dont know why..the enemy is just standing on idle....i did the code like you did but the enemy wont attack the player

  • @rorywalker4770
    @rorywalker4770 ปีที่แล้ว +2

    Thanks for your tutorial! Is there a reason why you keep using Vector3 for a 2D game?

  • @endersuit8076
    @endersuit8076 ปีที่แล้ว +2

    i want to congratulate you for you r good tutorial ,but i have a little issue :
    enemy fireballs dont go into the right direction , and even by doing what you have done at minute 41:00 it didn't worked and i don't know how to fix , do you know something to help me?

  • @thesilentwisp
    @thesilentwisp 2 ปีที่แล้ว +1

    Thank you so much for releasing a new tutorial. Been following this series and making my very first platformer! Out of curiosity, why not use the new PlayerInput system for the controls, or the Cinemachine for camera movement?

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว +1

      Hey there, it would've been a bit easier probably but I wanted to start with the basics not use any packages.

  • @brainy3429
    @brainy3429 2 ปีที่แล้ว

    Thanks a lot!

  • @PopcornGoPro
    @PopcornGoPro 2 ปีที่แล้ว

    An easy fix for the firetrap is just to simply change the onTriggerEnter to onTriggerStay =)

  • @PhantomAbyss
    @PhantomAbyss ปีที่แล้ว +1

    the EnemyFireball is not visible when he the enemy shoots but the invisible fireball still hits the player the Sorting layer on the fireballs is set to Foregrounds so idk the problem Please Help someone!

    • @PhantomAbyss
      @PhantomAbyss ปีที่แล้ว +1

      Someone help as soon as possible

  • @gonexhausted
    @gonexhausted 2 ปีที่แล้ว +2

    Solved the problem when enemy patrol , it's not damaging, put
    if (enemyPatrol != null)
    {
    enemyPatrol.enabled = !PlayerInSight();
    }
    instead of
    (enemyPatrol != null)
    enemyPatrol.enabled = !PlayerInSight();
    Hope it will help someone, because it helped me.

    • @khanhquoc8206
      @khanhquoc8206 ปีที่แล้ว

      Thanks
      but my enemy doesn't activate attack animation when I go into his red zone, why?

  • @triplea7260
    @triplea7260 2 ปีที่แล้ว

    Thanks a lot❤️

  • @tominolulino9170
    @tominolulino9170 ปีที่แล้ว +1

    Hello, can I ask why my Enemy dissapears when i turn on the game, he goes somewhere under the ground so I cant see him ?

  • @alexcrush99
    @alexcrush99 2 ปีที่แล้ว

    Ty for the tutorials i love u

  • @pawe7805
    @pawe7805 2 ปีที่แล้ว +3

    Please can you add a boss, it will be very cool

    • @triplea7260
      @triplea7260 2 ปีที่แล้ว

      I agree bro

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว +3

      I'll do my best, but I'm trying to finish off the series in 4-5 episodes, it's been going for 1 year now :D

    • @RelaxMusic-wc8rg
      @RelaxMusic-wc8rg 2 ปีที่แล้ว +1

      @@PandemoniumGameDev I agree with @lolkolxd you can do a BOSS FIGHT AND RESPAWN a player in one episode to finish the game. In general, this is one of the better tutorials on youtube.

  • @valentinkadushkin324
    @valentinkadushkin324 ปีที่แล้ว +1

    One question: Enemy can move while he is attacking ( if i move away from it). Is it some quick fix of that?

  • @micahburnside2281
    @micahburnside2281 หลายเดือนก่อน

    41:28 the EnemyFireballHolder script causes the enemy fireballs to shoot at the enemy when it is facing the left. When it faces right, the fireballs shoot to the right. [EDIT] I solved this. Answer is in the reply.

    • @micahburnside2281
      @micahburnside2281 หลายเดือนก่อน

      I figured out my problem. I had incorrectly set the game object hierarchy and Firepoint was not a child of RangedEnemy. If you are following along, make sure you're checking your game object Child / Parent structures. I was so tired I didn't realize I had overlooked where it was sitting. Interesting how something so small can have such a large effect.

  • @quinnger
    @quinnger ปีที่แล้ว +1

    Where did you fix the error where the enemy continues to swing his sword over your body after you're dead?

  • @trashvideos5317
    @trashvideos5317 ปีที่แล้ว +1

    Hi, I´ve got a question. Where do you got the EnemyProjectile Script???

    • @ignaciogalli343
      @ignaciogalli343 5 หลายเดือนก่อน

      from the traps video

  • @jamieparkin7054
    @jamieparkin7054 ปีที่แล้ว +1

    so my problem is with the patrol and attack of the ranged enemy it moon walks left and right (faces the wrong direction its going) and the range doesn't flip with the enemy, i've downloaded the finished copy of this episode to make sure his is working which it is, so i copy and pasted all the code related the the ranged enemy into my scripts so the codes are the same and cross referenced everything in the inspector so all the positions, scales and script inputs are the same but it still broke ...help!

    • @jamieparkin7054
      @jamieparkin7054 ปีที่แล้ว

      i fixed my problem just by deleting the Ranged Enemy from the Enemy Patrols "enemy" and "enemy animator" functions then putting them back into the Enemy Patrol fixed my problem

  • @novellee9493
    @novellee9493 2 ปีที่แล้ว +2

    Hi love your videos but had a problem in wall jumping tutorial my jumping became infinite again

  • @ryanmondong9835
    @ryanmondong9835 ปีที่แล้ว +2

    First of, I want to say that you have a great tutorial! I have been following ur first until this video for my personal project. Unfortunately, I'm having an issue in Ranged Enemy AI. Specifically in 40:08, I could not get to play in Unity, as I encountered an error message "UnassignedReferenceException: The variable anim of enemyPatrol has not been assigned." I also see that in 39:48-39:50 in your video, which mentions how you do not have the enemyPatrol assigned. I tried following your tutorials and even tried restarting your video to see the issue, but haven't figure out how to solve it yet. What seems to be the problem and how can I solve it?

    • @dezaraogre
      @dezaraogre ปีที่แล้ว +1

      Hi, did you find the problem?

    • @ryanmondong9835
      @ryanmondong9835 ปีที่แล้ว

      @@dezaraogre nvm, its alrdy solved. Thanks for reqching out tho

    • @Animalistoria
      @Animalistoria ปีที่แล้ว

      @@ryanmondong9835 same on me , can u figure out how to solve that ?

    • @ryanmondong9835
      @ryanmondong9835 ปีที่แล้ว

      wht a legend, still liking my comment even tho the it is 2 months ago

    • @CYb3R_Tr0N_
      @CYb3R_Tr0N_ ปีที่แล้ว +1

      Solution. Disable EnemyPatrol., until Pandemonium turns his back on.
      For those looking for the answer.

  • @WildChild343
    @WildChild343 10 หลายเดือนก่อน +2

    If anyone else is having issues detecting player with RaycastHit2D change this part "boxCollider.bounds.size.x * range" to this "boxCollider.bounds.size.x" in the second parameter of the BoxCast function. For example:
    private bool PlayerInSight()
    {
    RaycastHit2D hit = Physics2D.BoxCast(boxCollider.bounds.center + transform.right * offset * transform.localScale.x * colliderDistance,
    new Vector2(boxCollider.bounds.size.x, boxCollider.bounds.size.y),
    0, Vector2.left, 0, playerLayer);
    Debug.Log(hit.collider);
    return hit.collider != null;
    }

  • @b7lee948
    @b7lee948 2 ปีที่แล้ว +2

    i want to ask do you know how can you make character transformation for example like goku from dragon ball love your tutorial btw

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว +1

      Yeah, you have a couple options. 1. Change the entire character sprite or 2. Divide the character into a couple images: hair, chest, arms etc and then change the sprite or color on each individual element like Goku's hair turning yellow.

    • @b7lee948
      @b7lee948 2 ปีที่แล้ว +1

      @@PandemoniumGameDev Does change the sprite effects the animation?

  • @devdog7409
    @devdog7409 ปีที่แล้ว +1

    Can’t you just put a script on the enemy that stores the starting position and the allow distance from start, and then do calculations in update to get the patrol behavior? Like is there a reason we need 4 objects just for 1 enemy? Genuine question.

  • @robertyocum7200
    @robertyocum7200 10 หลายเดือนก่อน

    35:06 just a reference for myself
    12:19
    17:25

  • @mihamajer780
    @mihamajer780 2 ปีที่แล้ว +1

    i have a problem, my ranged enemy only shoots fireballs for 1 frame and then they disappear

    • @hpgg6232
      @hpgg6232 2 ปีที่แล้ว

      Same :/

    • @hpgg6232
      @hpgg6232 2 ปีที่แล้ว

      Still not sure what was causing the issue but deleting RigidBody2D component and setting resetTime to 15 worked for me. Hope this helps :D

  • @Egor-kc2dx
    @Egor-kc2dx ปีที่แล้ว +1

    Where does string create?: №57/№67 - "invulnerable", because it's string just already done on 47:57 min

    • @Egor-kc2dx
      @Egor-kc2dx ปีที่แล้ว

      already see that in 51:17😁

  • @BloodCatters
    @BloodCatters 2 ปีที่แล้ว

    I completely understand what you are explaining but we it comes to coding myself without watching I get stuck :D

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว +1

      It's probably the same for all beginners, it's good to hear that you understand though. Once you make a few games by following tutorials you're gonna feel more comfortable implementing stuff yourself, just give it some time and keep practicing. Good luck!

    • @BloodCatters
      @BloodCatters 2 ปีที่แล้ว

      @@PandemoniumGameDev Thank you! I did do a couple of things differently than you. For example, I did different rooms and put different traps and enemies in different rooms but when I wanted to test an enemy in room 3 and I put the player there but the camera was always starting in room 1. It took me 1.5 hours to write the code which starts the camera in the same room as the player but I was so satisfied since I had done it with what I have learned from your videos. Thank you very much again.

  • @TheTokoshi
    @TheTokoshi 2 ปีที่แล้ว +1

    Great tutorial but I have 1 mistake could you help me?
    When I kill an enemy he moves far away. What should i do my friend.

  • @mashanikolaeva3030
    @mashanikolaeva3030 2 ปีที่แล้ว +1

    Спасибо большое) очень полезно

  • @tomtornados6236
    @tomtornados6236 ปีที่แล้ว +1

    When the enemy changes direction, the active projectile flips to the other side relative to the enemy. Is there a fix for this?

  • @mukundkumar3403
    @mukundkumar3403 2 ปีที่แล้ว +1

    16:32 Hey, this problem is still there in my game and the melee enemy is not working.
    Plz help.

  • @reginaldsavage341
    @reginaldsavage341 2 ปีที่แล้ว +1

    enemy teleports to location of where i did the animation
    edit: i had to apply root motion then it works.
    lmao every time i get a problem that the internet cant fix i post my problem in the comments then after a few minutes i find a fix.
    but i have another problem where the enemy is staying idle when i go inside the box

    • @jimix8575
      @jimix8575 2 ปีที่แล้ว

      You probablly did some animations wrong. And you have to set the right tags on the player as "player" and enemy as "enemy".

  • @marekpuchon4878
    @marekpuchon4878 2 ปีที่แล้ว +1

    This is absolute awesome. I have just one question. When i create event on end of animation die when i kill enemy he stop using those two scripts but he will not disapeare and because of the script enemy damage can still hurt me.

  • @axolon_ronyn3015
    @axolon_ronyn3015 2 ปีที่แล้ว +1

    Hey keep getting this in your damage enemy section,
    NullReferenceException: Object reference not set to an instance of an object

    • @axolon_ronyn3015
      @axolon_ronyn3015 2 ปีที่แล้ว

      Nevermind, apparently I may have installed the right extension for it

  • @oanhtuan4245
    @oanhtuan4245 หลายเดือนก่อน

    Hi, I followed the instruction at around 5:08 , i did exactly what the video shows step by step but first, it shows : "Transition Idle - Attack in state Idle doesn't have an Exit or any condition , transition will be ignored" after i added the attack condition my enemy always doing the attack anim and not idle state, Anyone know how to fix?

  • @marutorii
    @marutorii 2 ปีที่แล้ว +1

    Pandemonium, I have a problem with my game. I've typed the code like yours, but the problem in second 23:16 still occurs. Do you have any idea what should I repair?

    • @freestylerak6655
      @freestylerak6655 2 ปีที่แล้ว

      Having the same problem... Did you get the solution?

    • @marutorii
      @marutorii 2 ปีที่แล้ว

      @@freestylerak6655 no i did not

    • @freestylerak6655
      @freestylerak6655 2 ปีที่แล้ว

      @@marutorii no problem bro, I fixed it

    • @marutorii
      @marutorii 2 ปีที่แล้ว

      @@freestylerak6655 lucky to you

  • @gearsbright4599
    @gearsbright4599 11 หลายเดือนก่อน

    14:54 Is it neccesarry to take existing BoxCollider2D and using its properties make damage area. Is it possible to add second BoxCollider2D component just for that purpose or making damage area? Or would it be less optimized to do so?

  • @Tanabech14
    @Tanabech14 ปีที่แล้ว

    thanks you

  • @aregaznauryan5911
    @aregaznauryan5911 หลายเดือนก่อน

    HELP PLEASE!!!
    why changes in scene don't apply in game mode??

  • @shai8559
    @shai8559 2 ปีที่แล้ว +1

    im on the patrol part and for some reason i dont see the enemy when i start the game, unless i disable the animator and than its working good just without the animations of course... any idea what could happen?

    • @vellansole
      @vellansole ปีที่แล้ว

      switch off trigger in boxcollider2d of character or...

  • @asyhhaz
    @asyhhaz 2 ปีที่แล้ว

    Thank you for uploading. May i ask when u will upload the game over??

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว

      This weekend I'm finishing the audio & music episode, then the game over screen is coming next week probably.

  • @the-man-1520
    @the-man-1520 หลายเดือนก่อน

    When do you add the Enemy Projectile?

  • @moedip7240
    @moedip7240 2 ปีที่แล้ว +1

    My ranged enemy keeps shooting fireballs even when the player is out of sight while he is walking in the opposite direcetion!
    Any reasons for that? thanks for the videos, great tutorials as usual.

  • @vihangabandara4284
    @vihangabandara4284 2 ปีที่แล้ว +1

    45.02 patrolling behavior is not working. If anyone knows how to fix it please tell me.

  • @jeffhodgson2582
    @jeffhodgson2582 2 ปีที่แล้ว +1

    Hey, great videos by the way. I just have a question which i cannot find the answer to, at 33:02 I clicked on the MeleeEnemy and opened my Animator, but all the animator parameters just vanished. I can't find them. the parameters are there, just no buttons are showing up. My die, is gone, moving, melee, ranged and hurt are vanished. any suggestions?

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว +2

      Yeah, it's a common Unity bug. Just restart it and it should go back to normal

  • @The_McLaughlin
    @The_McLaughlin 2 ปีที่แล้ว +1

    I've run into a bug that I can't figure out. So the line of sight was working properly with my melee enemy. However in working on the ranged enemy his line of sight is no longer flipping with him. So it starts off fine in the correct direction he's facing. Though the enemy walks backwards rather than forwards. Then when he gets to the patrol edge he turns around but the field of vision gizmo stays the same direction. so if the player is behind him, it triggers the enemy to fire a fireball. However the fireball still fires forward away from the enemy but is triggered from behind the enemy as his field of vision doesn't change. He also continues to walk backwards if you're out of his "line of sight". I've checked all my scripts to yours but they look fine to me. No errors are compiling in Unity. So I have absolutely no ideas on how to fix this issue. I also tried changing his direction of both the ranged enemy and the ranged enemy holder but this only seems to flip the sprite so he may then walk in the correct direction but his field of view still doesn't change. Same issue if I change just one of the objects direction he starts walking the right direction but his field of view stays behind him.

    • @The_McLaughlin
      @The_McLaughlin 2 ปีที่แล้ว +1

      Well update after playing around with the x position on the ranged enemy and Ranged enemy holder I fixed the walking backwards issue. The enemy now flips but I still cant get enemy field of vision box collider/gizmo to flip. So the enemy walks forwards and heading one direction his line of sight is in front of him but the other direction the box is behind him. I know we wrote code to make the box flip too, but again I've checked all my code a few times now and I'm not seeing any errors to fix this issue.

  • @itsyourgamer3786
    @itsyourgamer3786 2 หลายเดือนก่อน

    hey, was just wondering that is there any way to make the player damage the enemy through melee attacks.i followed through all the scripts but i did not wanted to add a projectile attack system but now im stuck as i dont know how to damage the enemies through melee attack

    • @itsyourgamer3786
      @itsyourgamer3786 2 หลายเดือนก่อน +1

      hey, nevermind. after hours of hit and trials and some useful tutorials i was finally able to get my way through it. And btw youre the goat.

    • @aknyolcu6500
      @aknyolcu6500 หลายเดือนก่อน

      @@itsyourgamer3786 Good luck for you !

  • @zolagibrar
    @zolagibrar 9 หลายเดือนก่อน +1

    Hi there! i already follow the tutorial it was great tutorial, keep it up! but I wanna ask about the enemy health can you make the enemy health visible to the player like the player health bar but in the enemy. please make it the video tutorial cause I wanna learn how to do it, thanks a lot before.

  • @jimix8575
    @jimix8575 ปีที่แล้ว +1

    Nice tutorial! I finally have my ranged enemy patroling perfectly in the scene but when I try to create a prefab of it to use it in another scene it just don't work for some uknown reason. It keeps patroling but he doesn't attack the player and I have all tags displayed correctly. I thought it was a bug but it does the same in older versions of unity. I just don't find how to solve it!

    • @kidsawl
      @kidsawl ปีที่แล้ว

      hey did u fix the bug ? bcz I have the same pb T-T

    • @scorpiusjones5436
      @scorpiusjones5436 ปีที่แล้ว

      It could possibly be because the Ranged Enemy does't have any movement logic attached to it alone, that's in the Enemy Patrol script. It seems like anytime I remove/add a enemy to the scene, I need to plug the info into the Enemy Patrol prefab in the hiarchy to make the enemy patrol

  • @quinnger
    @quinnger ปีที่แล้ว +1

    I followed you exactly but the enemy just ignores me and continues to patrol. He does not stop and attack. What could I be doing wrong?

    • @gargisharmaa
      @gargisharmaa ปีที่แล้ว

      Did you find any solution for this?

    • @quinnger
      @quinnger ปีที่แล้ว

      I think so…

  • @ModernGeography
    @ModernGeography 2 ปีที่แล้ว

    I'm making a basic box game and i just wanted to know wether the enemy animation is neccessary for taking damage (wich it probably isn't(i dont really want to make animations because boxes dont usually do anything)) because every time i walk up to the enemy nothing happens. Even when i created an object that should damage the player nothing happened. Also the enemy is invisible even tho it has a sprite renderer.

    • @ModernGeography
      @ModernGeography 2 ปีที่แล้ว

      It seems like i forgot to save the file and it didn't load in unity lol. Now i got a compile error so ill go fix whatever its saying

    • @ModernGeography
      @ModernGeography 2 ปีที่แล้ว

      Dang im too stupid to fix it

  • @bookley2472
    @bookley2472 2 ปีที่แล้ว +1

    I got everything in this video to work with the exception of the collision with enemies causing damage. My enemies are being treated like solid objects, so my player is blocked by their hitboxes and is able to stand on top of them. Any suggestions as to what can be causing this?

    • @PandemoniumGameDev
      @PandemoniumGameDev  2 ปีที่แล้ว +3

      Pretty sure it's a quick fix. Change the colliders on the enemies to be On Trigger

    • @danieltai6494
      @danieltai6494 4 หลายเดือนก่อน

      @@PandemoniumGameDev Thankkks

  • @rezahamidhhajhoseini4242
    @rezahamidhhajhoseini4242 2 ปีที่แล้ว

    Hi. I just have a question which i cannot find the answer to, at 47:33 to 47:43 what to do. did not change RangedEnemyHolder to MeleeEnemy. I did not understand this part 47:33 to 47:43. What did you do?. Please help me

  • @onlinewarriorspodcast
    @onlinewarriorspodcast 8 หลายเดือนก่อน

    Not sure if anyone had this issue but when I would press play the MeleeEnemy would disappear. The only way to get it to work was to change the value of "Near" to -10 in the Clipping Planes under "Main Camera" If anyone knows why this was happening to me/ why this solution fixed the issue, the feedback would be greatly appreciated.

  • @fajrikhoirunnisa1651
    @fajrikhoirunnisa1651 2 ปีที่แล้ว

    I have a problem with enemyPatrol. I was follow your video many times but I can't found what's the wrong is. while on patrol to the left, he walks backwards and the scale doesn't turn to minus. Can you help me please?

  • @franciscospinola7883
    @franciscospinola7883 2 ปีที่แล้ว

    Hey, I didn't wanted the range enemy so I didn't change the way how the script Health works. Will this cause problems for me in the next tutorials? (In my case just the audio tutorial and the chekpoints & respawn tutorials).

  • @kodysmith2532
    @kodysmith2532 2 ปีที่แล้ว

    I am trying to figure out how to implement the enemy damage in my code which I have made a few tweaks to to not include player projectiles. I want to handle the damage the same way but just on the mouse click. How would I incorporate that?

  • @user-hn3px5ls2j
    @user-hn3px5ls2j ปีที่แล้ว

    Sorry, I followed your course. When I did the 41:48 part, I wanted the enemy in my range to be able to shoot arrows, but after he detected the player, although he shot the arrow, it disappeared instantly. Why is this? By the way, I didn't animate my arrows, could it be related to the animation?

    • @user-hn3px5ls2j
      @user-hn3px5ls2j ปีที่แล้ว +1

      I found the problem, my arrow point is too close to the enemy, causing it to disappear instantly when it is shot.

  • @ushas3349
    @ushas3349 7 หลายเดือนก่อน

    Hello, in the firetrap episode you said you corrected so that player takes damage when he steps on to the firetrap and sit there idle. But I folled all your corrections. But still player does not receive any damage when he sits on the firetrap continuously without moving!
    Pl give me some hint to solve this issue.

  • @aeennem3896
    @aeennem3896 2 ปีที่แล้ว

    Thanks for the tutorial , can you please make a tutorial on how to make this multiplayer with photon server?

  • @kalebstephens5941
    @kalebstephens5941 2 ปีที่แล้ว

    Can you do a video that shows how to have Enemies aggro that goes with enemy patrol using a collider?

  • @anthonylewis3804
    @anthonylewis3804 2 ปีที่แล้ว

    I'm having a problem with my arrowtrap ever since I changed the enemy projectile script every time it hits the player or the wall it stays frozen there and keeps shooting. I think because it's not disabling when it hits anything. Any opinions?

  • @momoesbilly3038
    @momoesbilly3038 ปีที่แล้ว

    Im having some troubles making it turn, for some reason it does the patrol but its not actually turning when it gets to the other side. I check the code and everything seems ok, melee one works, ranged one doesnt.

  • @c4rri770
    @c4rri770 ปีที่แล้ว

    friend, I have a problem, I did everything right and if I came out with an enemy, but when I create another and put the scripts into it, it doesn't hurt, it can perform all the animations but it doesn't hurt the player and it doesn't give any errors, what could it be??

  • @VatsalKumarB23BB104
    @VatsalKumarB23BB104 5 หลายเดือนก่อน

    @PandemoniumGameDev In the unity console it is displaying that the "animator for the melee enemy has been destroyed but you are still trying to access it" Can you suggest a solution to this
    btw love your tutorials

  • @jiayongng7498
    @jiayongng7498 2 ปีที่แล้ว

    Why i dont see any animation set up for the fireball on explode animation?

  • @lordmwmw7576
    @lordmwmw7576 ปีที่แล้ว

    The boxcast/playerinsight function returns true no matter what, even if my player is clearly in the box. I saw that you had IsTrigger activated, but doing so makes my enemy clip through the floor. Really confused, need help!!!

  • @highmuzik5132
    @highmuzik5132 ปีที่แล้ว

    Help me, I can't see the Collider Parameter in the scene, it seems to be hidden, I can't see to adjust