//=========================================================================== /*------------------------------------- * * Constructors * * ----------------------------------*/ public Sprite() { facing = Facing.right; status = Status.standing; LoadMsg = "No source directory provided."; Ready = false; displayImage = new SKBitmap(); fallingImg = new SKBitmap(); crouchingImg = new SKBitmap(); standingImg = new SKBitmap(); attackImg = new SKBitmap(); _skiaPosition = new SKPoint(0, 0); GL_Position = new Block(0, 0); verticalPixelsTraveled = 0; lateralPixelsTraveled = 0; //-- delegates FacingChanged = new DisplayImageChangedHandler(OnFacingChanged); StatusChanged = new DisplayImageChangedHandler(OnStatusChanged); }
//========================================================== /*------------------------------------------- * * Constructor accepting a source directory * parameter * * ------------------------------------------*/ public Sprite(Character character) { SourceDirectory = "DarkValkyrie.Graphics." + character.SpriteSource; displayImage = new SKBitmap(); fallingImg = new SKBitmap(); crouchingImg = new SKBitmap(); standingImg = new SKBitmap(); attackImg = new SKBitmap(); LoadMsg = string.Empty; bool SpritesLoaded = LoadSprites(LoadMsg); Ready = false; if (SpritesLoaded) { LoadMsg = "Images Loaded, sprite ready."; Ready = true; } _Facing = Facing.right; _Status = Status.standing; UpdateDisplayImage(); //-- initialize these coordinates, and then move them to where they need to be. GL_Position = character.BlockPosition; _skiaPosition = new SKPoint(0, 0); verticalPixelsTraveled = 0; lateralPixelsTraveled = 0; //-- wire up the delegate FacingChanged = new DisplayImageChangedHandler(OnFacingChanged); StatusChanged = new DisplayImageChangedHandler(OnStatusChanged); }