Add Killer Enemies to Your Game - 2D Top Down Shooter - Unity Tutorial

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

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

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

    Access the FULL source code on my Patreon here: www.patreon.com/posts/2d-shooter-code-85313134

  • @hardyhu9999
    @hardyhu9999 ปีที่แล้ว +5

    can you add like enemy Health bar? so they don't die instintly + when you kill them blood particles will shower you? if you could that will be great .
    just a note your videos are amazing!

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

    appreciate the videos man!

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

    great video helped me a lot

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

    I enjoyed this video a lot, you explained movement pretty well, I'm searching for how to make enemies avoid obstacles while also chasing the player, I'm pretty stuck on that. Do you have any suggestions?

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

      Ooo you can use A* pathfinding! If you TH-cam it you'll find loads of tutorials but I recommend brackeys tutorial!

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

    Amazing video! helped me so much, Thanks!

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

      Awesome! I'm happy it helped, Jetsi!

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

    Thank you very much! On to the next one.

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

    is anyone having an issue where the enemy isn't destroying the player when it collides with it? (Fixed - make sure that the player has been tagged as a player)

    • @Hamza-xj6wj
      @Hamza-xj6wj ปีที่แล้ว

      how do you do that ?

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

    Is there anyway to make the zombies take more shots to kill?
    very good tutorial btw keep it up. would love more to this tutorial serie.

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

    can you help I have a problem on the 'Vector' could not be found

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

    When the enemy touches my player, the player starts spinning forever.

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

      Just doa check collision when the enemy touches the player you restart the scene:
      First at the top of the script do (using unityengine.scenemanagment)
      Then, write(Oncollisionenter(collision col):
      If(col.gameobject.tag == "enemy"
      Scenemanager.loadscene("You put her the index of the level")

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

    Hello can you help me I have some problem about the enemy

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

    Very good video you are great

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

      Thank you so much 😀

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

    I did every. single. bit of code you did, EXACTLY, replaying the video at least 10 times. My enemy still isn't moving. Please help me figure out what's going on.

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

      Do you have a fix yet? I’m experiencing the same issue and I’m on a time restraint with this being a school project. Please share if you do have a fix

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

      @@ByteKnite I don’t sadly. I just kinda abandoned my project

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

      @@jankystreams3337 I just deleted and retyped the code and it just started working. Idk what I changed but it started working

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

      @@ByteKnite That’s weird. Thanks.

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

    How is the word "other" italicized?

  • @ketsueki血液
    @ketsueki血液 7 หลายเดือนก่อน

    My player spawns on top of the enemy then cant move, someone pls help

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

    this helps a lot thanks

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

    make him die from many bullets, that is to say: that the enemy has invisible life for the player but that he dies from 2 or 3 shots

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

      Nice idea! We could add a life count and each bullet will take one life away until they die!

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

      @@MuddyWolf 👍

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

      @@MuddyWolf How about a boss where it has an HP and armor bar in which you have to get to zero before the boss starts taking health damage? Too much? >.

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

    Yay tysm!

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

      You're welcome! :)

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

    9:21

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

    plz give code for free

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

      You can copy and use the code from the video for free, however if you don't want to copy it out then you can get it via my Patreon by subscribing as a "Beta Wolf" - this is to support the channel and the tutorials I make for free.

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

    unfortunately there is something wrong with how i did it. it says "Assets\Enemy.cs(31,92): ; expected"
    Any help would be amazing. The my code is in the comment.
    I tried running it through spell check but I couldn't find anything. I also checked the tags and that not it ether.
    I tested it at 9:33
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Enemy : MonoBehavior {
    public Transform target;
    public float speed = 3f;
    public float rotateSpeed = 0.0025f;
    private Rigidbody2D rd;
    private void Start () {
    rb = GetComponent < Rigidbody>2D();
    }
    private void Update () {
    if (!target) {
    GetTarget();
    } else {
    RotateTowardsTarget();
    }
    }
    private void FixedUpdate () {
    // move foward
    }
    private void RotateTowardsTarget () {
    Vector2 targetDirection = target.position - transform.position;
    float angle = Mathf.Atan2(targetDirection.y, targetDirection.x) * Mathf.Rad2Deg - 90f; //the - 90f is because the triangle is naturally facing up. This will make it face the player.
    Quaternion q = Quaternion.Euler(new Vector3(0, 0, angle));
    transform.localRotation = Quaternion.Slerp(transform.localRotation, q, rotateSpeed)
    }
    private void GetTarget () {
    target = GameObject.FindGameObjectWithTag("Player").transform;
    }
    }

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

      as the error says, you're missing a ; on line 31 col 92,
      transform.localRotation = Quaternion.Slerp(transform.localRotation, q, rotateSpeed);

    • @Bullet15-D
      @Bullet15-D ปีที่แล้ว +1

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class Enemigo : MonoBehaviour{
      public Transform target;
      public float speed = 3f;
      public float rotateSpeed = 0.0025f;
      private Rigidbody2D rb;
      private void Start(){
      rb = GetComponent();
      }
      private void Update()
      {
      if (!target)
      {
      GetTarget();
      }
      else
      {
      RotateTowardsTarget();
      }
      }
      private void FixedUpdate() {
      //Move Forwards
      }
      private void RotateTowardsTarget() {
      Vector2 targetDirection = target.position - transform.position;
      float angle = Mathf.Atan2(targetDirection.y, targetDirection.x) * Mathf.Rad2Deg - 90f;
      Quaternion q = Quaternion.Euler(new Vector3(0, 0, angle));
      transform.localRotation = Quaternion.Slerp(transform.localRotation, q, rotateSpeed);
      }
      private void GetTarget () {
      target = GameObject.FindGameObjectWithTag("Player").transform;
      }
      }
      Ahí tienes la versión sin errores xd habían cosas que fallaste que no falle pero yo falle en un } xddd, igual gracias por compartir me sirvió.