Search code examples
c#classmethodscall

Issue starting method from other class


i am trying to do something that should be quite simple, call a method from a another class, I have allready done it once in my project but this time it doesn't work.

How I am calling the method:

Characters.Character_One.MoveLeft();

this is the contents of the method I am trying to call:

public static void MoveLeft(Character_One c)
{
    c.s.Top -= movespeed;
}

Solution

  • You're not passing it the parameter it requires - an instance of Character_One.

    var charOne = new Character_One();
    
    Characters.Character_One.MoveLeft(charOne);