How comes this snippet of code produces no error:
using Godot; using System; public class Animation : AnimatedSprite { private AnimationPlayer Direction; // Called when the node enters the scene tree for the first time. public override void _Ready() { // Must have the node AnimationPlayer attached to it. Direction = GetNode<AnimationPlayer>("AnimationPlayer"); } public override void _Process(float delta) { if (Input.IsActionPressed("move_right")) Direction.Play("Right"); if (Input.IsActionPressed("move_left")) Direction.Play("Left"); if (Input.IsActionPressed("move_down")) Direction.Play("Down"); if (Input.IsActionPressed("move_up")) Direction.Play("Up"); } // // Called every frame. 'delta' is the elapsed time since the previous frame. // public override void _Process(float delta) // { // // } }
But this snippet of code which is practically identical causes an error with the debugger telling me that I forgot to close the curly brackets on line 7:
using Godot; using System; public class Cycles : AnimatedSprite { public override void _Ready() { public anim string = "5"; // } //Changes the player's animation depending on which direction button is pressed. public override void _Process(float delta) { //if (Input.IsActionPressed("move_right")) play(String anim="right", bool backwards=false); //if (Input.IsActionPressed("move_left")) play(String anim="left", bool backwards=false); //if (Input.IsActionPressed("move_down")) play(String anim="down", bool backwards=false); //if (Input.IsActionPressed("move_up")) play(String anim="up", bool backwards=false); } }
Also that being my first time ever coding a game (Started a month ago), I really wish the debugger would give me precise instructions instead of being vague and printing me a load of random errors so much so I don't know where to start and where to end. I'm considering installing an IDE on the side with helpful widgets to better understand how to code using C#.