0 votes

showcase video:
https://imgur.com/a/V5LBqfM

My problem is, I think simple. If the enemy facing left it detects player but if facing right it's not. What's the case?

Hitbox/CollishionShape is the area of the enemy, when area entered by player play animation attack.

if direction == 1:
        $Sprite.flip_h = false
        $Sprite/Sprite2.flip_h = false
        $Sprite/Sprite2.position.x = 50 
        $HitBox/CollisionShape2D.position.x = 376
    else:
        $Sprite.flip_h = true
        $Sprite/Sprite2.flip_h = true
        $Sprite/Sprite2.position.x = -50
        $HitBox/CollisionShape2D.position.x = 156
Godot version Godot v3.2.1 - stable
in Engine by (25 points)

2 Answers

0 votes
Best answer

Hi! I already found a solution. Hitbox/CollishionShape was detecting Player's body but animation was blocking itself on the right side. I added a variable named blocked_anim and set it to false. I play animation only when its false, it worked. Animation is playing on the right side and left. Sometimes random idea's are the best!

by (25 points)
0 votes

Hmm... I'm a beginner, but I found out about this good website that can tell you more about areas, I mean that website worked for me.
Link - https://kidscancode.org/godot_recipes/g101/3d/101_3d_04/

by (18 points)

Thanks for comment, i will look at this too.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.