Dynamic Enemy AI to Jump Gaps and Chase Player - 2D Platformer Unity #12

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

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

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

    Hope you enjoy the video!
    The entire package for our enemy can be found on my Patreon: www.patreon.com/posts/92227715?pr=true
    Check it out to also get some free scripts, packages and sprites from previous videos - or support the channel and have access to the whole project! 💜

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

    Have to admit the best one so far all other script didn't worked but now the enemy doing something (flothing)

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

    İ don't care about ur tutorials cuz im Professional in games Development but i love hearing ur voice hahah 🤣and support u cuz u r deserve that good luck

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

      Thank you for the support 😝 I’ll hopefully make some videos that aren’t just tutorials in the future that might be more interesting for you!

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

      @@GameCodeLibrary we will see 👀

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

    So good tutorial, also i like your voice, new subscriber i'm here to learn and support

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

      So glad you enjoyed!! Thank you for the support :-)

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

    My enemy doesn't detect the ground in front. All the other things work perfect, however, this one no.

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

    This is cool!
    Thank you

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

      I’m glad you enjoyed!! I’ll keep making fun vids 😈

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

    This is so good. However for my game, my enemy doesn't face towards the player when walking towards it. Could you make a tutorial addressing that part. Thanks

    • @GameCodeLibrary
      @GameCodeLibrary  9 หลายเดือนก่อน +2

      Try putting this code into your enemie's update function:
      float direction = Mathf.Sign(player.position.x - transform.position.x); //Gets direction of player
      spriteRenderer.flipX = direction < 0; //Flips enemy sprite
      If this flips it to turn the wrong way, change it to be:
      spriteRenderer.flipX = direction > 0; //Flips enemy sprite
      Hope this helps!

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

    the time section are from the old video btw. still, thanks for this tutorial

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

      Woops you’re right!! I’ll redo the chapters now 😝 thank you! 🙏

  • @timmm0-065
    @timmm0-065 8 หลายเดือนก่อน

    I don't know why isGrounded is always false for me. I used Debug.DrawLine on it, and I think the Raycast on isGrounded isn't working. HELP 😭

    • @timmm0-065
      @timmm0-065 8 หลายเดือนก่อน

      I could finally get isGround to turn true, but when I lifted my enemy in the air, isGround was still true 💀😭

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

      Have you tried debugging? You can stick breakpoints into your code and press the play button - then when the isGrounded is meant to be turned on/off you can try and see why it isn’t!
      Follow the code path and see what it could be! I can’t help much without seeing it sorry 🙏😣

  • @user-if6jt4fo4s
    @user-if6jt4fo4s 9 หลายเดือนก่อน

    enemy jumpscare please 🙏

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

      I’d never thought of adding a jump scare to a 2D game! Guess it’d work the same as a 3D one: adding a sort of trigger that when the player walks on it makes an enemy pop out and play a sound effect 🧐
      I’ll have a think about it and add it to the to do list! 🙏

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

    I got this error in this code..
    69,19 CS1061 'Rigidbody2D' does not contain a definition for 'Addforce' and no accessible extension method 'Addforce' accepting a first arguments of type 'Rigidbody2D'
    seems like unity mentioned about
    rb = GetComponent();
    and
    rb.Addforce(new Vector2(jumpDirection.x, jumpForce), ForceMode2D.Impulse);
    nevermind, f for F my bad. lmao xd