Godot Version
4.2.1
Question
I have a bunch of animations on my character working well but when I try to crouch and shoot at one he is bugging. I have animation for crouching and animation for shooting in crouch but for some reason this animation isn’t workig.
Here is my (broblematic part I guess) code:
elif Input.is_action_just_pressed("main_action") and shooting_timer == true:
if is_crouching == false:
shoot()
shooting_timer = false
$shooting_timer.start()
#shooting animation here:
animation.play("shooting")
if is_crouching == true:
shoot()
shooting_timer = false
$shooting_timer.start()
$CollisionShape2D.scale.y = 0.7
$CollisionShape2D.position.y = 6
$Node2D/Marker2D.position.y = 4.5
animation.play("crouch_shooting")
elif Input.is_action_pressed("crouch"):
animation.play("crouching")
#animation.play("RESET")
$CollisionShape2D.scale.y = 0.7
$CollisionShape2D.position.y = 6
$Node2D/Marker2D.position.y = 4.5
is_crouching = true
velocity.x = 0
else:
velocity.x = lerp(velocity.x, 0.0, 0.4)
$CollisionShape2D.scale.y = 1
$CollisionShape2D.position.y = 1
$Node2D/Marker2D.position.y = 0
is_crouching = false
if shooting_timer == true:
#idle animation here:
animation.play("idle")
The collision shape is also changing as he crouch but I don’t think that’s the problem