Skip to content

Instantly share code, notes, and snippets.

@matthewd673
Created April 10, 2015 16:15
Show Gist options
  • Save matthewd673/ae7363292eef0298b5ab to your computer and use it in GitHub Desktop.
Save matthewd673/ae7363292eef0298b5ab to your computer and use it in GitHub Desktop.
I'm writing a little game engine in C#, this is the sprite class in it's early stages
//Maybe use Bitmap
private static Image[] frameArray;
public static Image active_frame;
public static int active_frame_number;
public sprite(Image[] frame_array)
{
frameArray = frame_array;
active_frame_number = 0
active_frame = frameArray[active_frame_number];
}
public static void nextFrame()
{
active_frame_number += 1;
}
public static void previousFrame()
{
active_frame_number -= 1;
}
public static void preciseFrame(int frame_number)
{
active_frame_number = frame_number;
}
public static void firstFrame()
{
active_frame_number = 0;
}
public static void lastFrame()
{
active_frame_number = frameArray.Length - 1;
}
public static void animate()
{
active_frame = frameArray[active_frame_number];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment