0 votes

So I was working on redoing my sprite from an AnimatedSprite2D to a Sprite2D that uses a AnimationPlayer for greater control for allowing multiple weapon pickups and such; however, after I made the update, the controller broke.
I copy pasted the code into a different CharacterBody2D and replicated what I had before I updated to the AnimationPlayer and the code seemed to work fine there.
The issue is the code no longer works for my updated character which is strange.

here is the main code:
func physicsprocess(_delta):


var directionLR = Input.get_axis("walk_left", "walk_right")
if directionLR:
    velocity.x = directionLR * SPEED
    velocity.x = 0
var directionUD = Input.get_axis("walk_up", "walk_down")
if directionUD:
    velocity.y = directionUD * SPEED
    velocity.y = 0


if Input.is_action_just_pressed("attack") and Input.get_axis("walk_left", "walk_right") or Input.is_action_just_pressed("attack") and Input.get_axis("walk_up", "walk_down"):
    #Attack Animation
if Input.is_action_just_pressed("attack"):
if Input.get_axis("walk_left", "walk_right") or Input.get_axis("walk_left", "walk_right") and Input.is_action_just_released("attack") or Input.get_axis("walk_up", "walk_down") or Input.get_axis("walk_up", "walk_down") and Input.is_action_just_released("attack"):
    #Run animation
elif Input.is_action_just_released("attack") or Input.is_action_just_released("walk_left") or Input.is_action_just_released("walk_right") or Input.is_action_just_released("walk_up") or Input.is_action_just_released("walk_down"):
    #Idle Animation
Godot version 4.0
in Engine by (12 points)

1 Answer

0 votes

Make Debug Logs with print
https://docs.godotengine.org/en/3.1/classes/[email protected]#class-gdscript-method-print
You can check all variables and loops

by (372 points)
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.