我正在使用 WPF 和 C#,并且我有一个带有矩形的画布(就像一个迷宫)。现在我想创建一个在这个迷宫中移动(在算法的帮助下)的角色。因此,我创建了一个名为 character 的新类,但我的问题从这里开始:如何在画布上创建一个对象,该对象具有图像、位置并且可以访问角色类中的方法和属性?所以最后的事情应该是这样的:
private class MainWindow
{
//Here the canvas is made visible and the rectangles are being drawn on the canvas
//Then a method should start to create the character and move him through the maze
//it should look like (character.move(1) so the character moves one step forward etc.)
}
private class Character
{
//here are the methods and attributes the character should have
}
提前感谢,对不起我的英语不好:)