C
C#9mo ago
FloW

✅ Why doesnt "this." work here?

public override void _Ready()
{
float StepLenght = 5;
if (Input.IsKeyPressed((int)KeyList.W)){
this.Position += new Vector2(0, -StepLenght);
}
if (Input.IsKeyPressed((int)KeyList.S)){
this.Position += new Vector2(0, StepLenght);
}
if (Input.IsKeyPressed((int)KeyList.D)){
this.Position += new Vector2(StepLenght, 0);
}
if (Input.IsKeyPressed((int)KeyList.A)){
this.Position += new Vector2(-StepLenght, 0);
}
}
public override void _Ready()
{
float StepLenght = 5;
if (Input.IsKeyPressed((int)KeyList.W)){
this.Position += new Vector2(0, -StepLenght);
}
if (Input.IsKeyPressed((int)KeyList.S)){
this.Position += new Vector2(0, StepLenght);
}
if (Input.IsKeyPressed((int)KeyList.D)){
this.Position += new Vector2(StepLenght, 0);
}
if (Input.IsKeyPressed((int)KeyList.A)){
this.Position += new Vector2(-StepLenght, 0);
}
}
1 Reply
FloW
FloWOP9mo ago
done, all was fine but I put this code in Ready instead of _Process sorry
Want results from more Discord servers?
Add your server