Created
April 10, 2015 16:15
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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