Forum begins after the advertisement:


[Part 6] Enemy issues

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #12094
    Auten Diver
    Participant

    Thanks for the great tutorials, I am having a few issues regarding enemies.

    The bat enemy won’t move at a reasonable rate unless I set its speed in the triple digits.

    The Crawler enemy takes no damage of any kind (Bat, Charger, and Zombie scripted enemies do).

    The Charger enemy cannot detect the player, it detects walls and ledges just fine.

    Code seems to be exact, setup in Unity should also be working. Any thoughts would be appreciated.

    #12095
    Terence
    Keymaster

    Hi Auten,

    A little insight on the collision issues. You can print a message in the function that is supposed to fire when the enemy is hit. For this project, I think it should be the EnemyHit() function (I don’t work on this project, so I’m not familiar with the codebase).

    Since the Crawler doesn’t have a definition for the EnemyHit() function, you will have to provide an override like so to detect hits only on the Crawler.

        public override void EnemyHit(float _damageDone, Vector2 _hitDirection, float _hitForce)
        {
            print("Crawler is hit!")
            super.EnemyHit(_damageDone, _hitDirection, _hitForce);
        }

    Then watch at the Console window to see whether the message fires. If it doesn’t, it means that EnemyHit() is not being called on the Crawler script. There are many reasons why this would be the case. Do you have Colliders on the Crawler? Or maybe for some reason the script that calls EnemyHit() on enemies is not calling the function for crawlers only?

    #12102
    Auten Diver
    Participant

    I tested that out, was hitting, but no still no damage. So I just rewrote everything on a different script, added a piece of code from another different script, and it works now.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: