Godot Version
4.2
Question
I have two exemplars of two child classes extend from “Character” class. When i try to place them in scene separatly they have one set of properties they give to parent class constructor, but when they are in scene together they will share same set of properties that seems to be the sum of their properties.
public Character(uint healthValue = 3000, float movementSpeed = 5f, float jumpHeight = 0.8f, float aerialJumpHeight = 1.6f, float jumpHalfTime = 0.5f / 2f)
{
health = new Health(healthValue);
this.movementSpeed = movementSpeed;
fallingAcceleration = 2f * jumpHeight / (jumpHalfTime * jumpHalfTime);
jumpVelocity = 2f * jumpHeight / (jumpHalfTime);
aerialJumpVelocity = Mathf.Sqrt(2f * aerialJumpHeight * fallingAcceleration);
}
public partial class Char1 : Character
{
public Char1() :
base(healthValue: 5000, movementSpeed: 4f, jumpHeight: 0.6f, aerialJumpHeight: 1.2f, jumpHalfTime: 0.5f / 2f)
{}
}
public partial class Char2 : Character
{
public Char2() :
base(healthValue: 2900, movementSpeed: 5f, jumpHeight: 0.8f, jumpHalfTime: 0.5f / 2f)
{}
}