I put Animation as a class in my game, but can’t figure out how to pass it the variables (a list of Sprites, Sprite is also a class) and my college’s wiki doesn’t help as they have animated by using Sprite as a class and letting the list be handled in the run time by varying the frame they are on. How do I get my way and my Animation class to work?
Classes for Sprite and Animation below
internal class Sprite //The sprite. multiple of these for each animation
{
private string SpriteName;
private Texture2D SpriteTexture;
private Image SpriteImg;
public Vector2 Position;
public Sprite(Texture2D sp)
{
SpriteTexture = sp;
}
}
internal class Animation //Animations. A list of sprites.
{
private List<Sprite> Sprites;
public Animation(List<Sprite> sprites)
{
Sprites = sprites;
}
}
How I tried to draw the animation down below
PlayerAnimation = Animation(List <Sprite> < "AnimTest1", "AnimTest2", "AnimTest3", "AnimTest4", "AnimTest5" >> );
PlayerAnimation is already defined, and System.Collections.Generic is used for List. AnimTest 1-5 are the Sprites I am attempting to pass it.
Any help appreciated. Thanks in advance.