I want to flip the animated sprite 3d horizontally whenever the player presses move left or right buttons.
The error:
C:\Users\Admin\Documents\Es-troidvania\Player.cs(29,11): 'AnimatedSprite3D' does not contain a definition for 'flip_h' and no accessible extension method 'flip_h' accepting a first argument of type 'AnimatedSprite3D' could be found (are you missing a using directive or an assembly reference?)
My code:
public class Player : KinematicBody
{
// Declare member variables here. Examples:
private Vector3 vel = Vector3.Zero;
private int grav = 50;
private int spd;
private int jump = 25;
private AnimatedSprite3D _anim;
public override void _Ready()
{
}
public bool ButtonPressed(string input)
{
return Input.IsActionPressed(input);
}
public override void _Process(float delta)
{
if (ButtonPressed("move_right") || ButtonPressed("move_left"))
{
if (ButtonPressed("move_right"))
{
_anim.flip_h = false;
} else if (ButtonPressed("move_left"))
{
//flip_h = true;
}
if (ButtonPressed("shift")) _anim.Play("run"); else _anim.Play("walk");
} else
{
_anim.Play("idle");
}