I'm creating a Space Invaders game, and graphics sprites in it are defined as 2D arrays of colors.
It seems like it's going to be cumbersome declaring these arrays the way I currently am:
//This creates an inverting red/blue cross animation
public Sprite myFirstAnimation()
{
Sprite frame1 = new Sprite(new Color[,]
{{Color.Red, Color.Blue, Color.Red},
{Color.Blue, Color.Blue, Color.Blue},
{Color.Red, Color.Blue, Color.Red}});
Sprite frame2 = new Sprite(new Color[,]
{{Color.Blue, Color.Red, Color.Blue},
{Color.Red, Color.Red, Color.Red},
{Color.Blue, Color.Red, Color.Blue}});
AnimatedSprite myAnimatedSprite = new AnimatedSprite(new Sprite[] { frame1, frame2 });
return myAnimatedSprite;
}
Can you point me the the direction for a nicer way of doing this, as to make it more maintainable and readable, and less arduous?
System.Drawing.Image.Bitmap
class... \$\endgroup\$