【问题标题】:Spritesheet Animation in C#C# 中的 Spritesheet 动画
【发布时间】:2015-11-27 00:31:16
【问题描述】:

这是我正在使用的 MSDN 教程,问题是我无法取得任何进展,因为我不知道用什么代替省略号,因为我尝试过的所有内容都返回错误。

private AnimatedTexture SpriteTexture;
private const float Rotation = 0;
private const float Scale = 2.0f;
private const float Depth = 0.5f;
public Game1()
{
    ... //this is where I am stuck
    SpriteTexture = new AnimatedTexture(Vector2.Zero, Rotation, Scale, Depth);

    // Set device frame rate to 30 fps.
    TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);
}

【问题讨论】:

  • 有什么问题?你说一切都还好……大概现在不是,但你没有说问题是什么。
  • 我的主要问题是不知道用什么来代替省略号(“...”),所以在我知道它应该在那里之前我不能继续。
  • 你能链接到教程吗?这里没有足够的信息来帮助您。
  • 本教程与我的 Visual Studio 版本不兼容

标签: c# visual-studio sprite-sheet


【解决方案1】:

您应该使用download the .zip with source codethe tutorial I believe you're trying to follow。一方面,AnimatedTexture 是一个未定义的自定义类。打开AnimatedSprite.sln,从微软的示例代码中获取你需要的东西。

zip 中是 Game1 类的其余部分,您引用的构造函数是:

    private AnimatedTexture SpriteTexture;
    private const float Rotation = 0;
    private const float Scale = 2.0f;
    private const float Depth = 0.5f;
    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        SpriteTexture = new AnimatedTexture(Vector2.Zero,
            Rotation, Scale, Depth);
#if ZUNE
        // Frame rate is 30 fps by default for Zune.
        TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);
#endif
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-25
    • 2012-04-21
    • 1970-01-01
    • 2018-10-10
    • 2013-10-27
    • 1970-01-01
    • 2012-01-10
    • 2014-06-28
    相关资源
    最近更新 更多