Well while coding in c# and xna, I've ran into a few uh-ohs. I accidentally made classes that overwrote other classes. I was thinking of ruby when I did this, I just typed up the class name and added a method. And figured it would work fine. Something like this.
Game_Actors
def new_method
end
end
And everything would work fine if you placed that in rmxp. Now here's what I actually did in c#
public class Mouse
{
public bool MouseInArea(Rectangle area)
{
// code here
}
}
Then got a bunch of errors that the mouse had no method or properties named x and y and blah blah. Then I realized that I couldn't do what I wanted to that way. But I'm curious if there is a way to do that, add methods or properties to a class without overwriting it?
use partial classes:
you declare the base class as
then add on methods in a different file under
public partial class Mouse
This is the same way that windows forms applications work in visual studio, with the design in the base class, and the events and behavior in a partial class.