2

私は私のプレーヤーのアニメーションフレームである19枚の画像を持っています

以下では、私のプレーヤーであるカエルとしてテクスチャの配列を作成しました.19個の画像があります.それらをアニメーション化する方法.

public class Texture { public static Texture2D mBackground; public static Texture2D mBackgroundOne; public static Texture2D mBackgroundTwo; public static Texture2D grassUp; public static Texture2D grassDown;
public static Texture2D[] カエル = new Texture2D[19]; public static Texture2D[] frogdie = new Texture2D[4];

    public static Vector2 position;

    public static void Load()
    {
        mBackground = GamePage.contentManager.Load<Texture2D>("layer_11");
        mBackgroundOne = GamePage.contentManager.Load<Texture2D>("layer_11");
        mBackgroundTwo = GamePage.contentManager.Load<Texture2D>("layer_11");
        grassUp = GamePage.contentManager.Load<Texture2D>("layer_11");
        grassDown = GamePage.contentManager.Load<Texture2D>("layer_11");


        frog[0] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal1");
        frog[1] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal2");
        frog[2] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal3");
        frog[3] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal4");
        frog[4] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal5");
        frog[5] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal6");
        frog[6] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal7");
        frog[7] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal8");
        frog[8] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal9");
        frog[9] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal10");
        frog[10] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal11");
        frog[11] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal12");
        frog[12] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal13");
        frog[13] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal14");
        frog[14] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal15");
        frog[15] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal16");
        frog[16] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal17");
        frog[17] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal18");
        frog[18] = GamePage.contentManager.Load<Texture2D>("player/maindak_normal19");

    }

    public  static void draw(SpriteBatch sprite)
    {
        for (int i = 0; i <= 18; i++)
        {
            sprite.Draw(frog[i],position= new Vector2(100, 100), Color.White);

        }

    }
4

1 に答える 1