0 votes

Hello,
I'm in the middle of writing some code, when I checked to see if it was working as intended I got a CS1002 error code and I don't know why.
Note: GODOT Ver v3.5, Language: C#. I'm brand new to GODOT and still learning C#

Errors:
G:\The Stick Runners\TSR-Project\Character\Char.cs(33,66): ; expected
G:\The Stick Runners\TSR-Project\Character\Char.cs(39,77): ; expected

using Godot;
using System;

public class Char : KinematicBody2D
{
   // Declare member variables here. Examples:
   // NOTE: VECTOR(X,Y)

   public int isFalling = 4;
   public int isJumping = 2;
   public int isSliding = 3;
   public int isRunning = 1;
   Public int charState = 0;

   public float JumpSpeed = 5;
   public float currentHight = 0;
   public float maxHight = 20;


   // Called when the node enters the scene tree for the first time.

   public override void _Ready()
   {

   }

//  // Called every frame. 'delta' is the elapsed time since the previous frame.

public override void _Process(float delta)
{

    if (Input.IsKeyPressed((int)KeyList.Space)) and (charState = 1)
    {
        charState = isJumping;
        currentHight += JumpSpeed;
        this.Position += new Vector2(0 , -JumpSpeed);

        if (currentHight = maxHight) or (Input.IsKeyReleased((int)KeyList.Space))
        {
            charState = isFalling;
            currentHight -= JumpSpeed;
            this.Position += new Vector2(0 , JumpSpeed);
        }

    }
}
}
Godot version 3.5
in Engine by (12 points)

1 Answer

+1 vote

Line 13:

Public int charState = 0;

Public hast to be lowercase

Line 32:

if (Input.IsKeyPressed((int)KeyList.Space)) and (charState = 1)
  • Your missing a ) at the end
  • You have to use && and || , because and and or are not valid for boolean comparison.

Also line 38 is wrong.

by (1,081 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.