public void Draw(Vector2 contactPos, SpriteBatch spriteBatch, Camera camera, Vector2 playerPosition) { frame += speed; if (frame >= totalFrames) { frame -= totalFrames; } currentFrame = (int)Math.Floor(frame); if (drawSimpleBoard) { SpriteHandler.Draw(simpleBoard, spriteBatch, camera, contactPos + position, 1, rotation, simpleBoardOrigin, Color.White, 1f, SpriteEffects.None, 0f); } else { string key; if (Game1.CeilAdv(scaleX) == Game1.CeilAdv(scaleY)) { key = deck; } else { key = tape; } //SpriteHandler.sprites[key].Draw(spriteBatch, camera, new Rectangle((int)(position.X + contactPos.X - (width * .5f * Math.Abs(scaleX))), (int)(position.Y + contactPos.Y - height * .5f * Math.Abs(scaleY)), (int)(width * Math.Abs(scaleX)), (int)(height * Math.Abs(scaleY))), rotation, new Vector2(0, 0), Color.White, 1f, SpriteEffects.None, 0f); SpriteHandler.sprites[key].Draw(spriteBatch, camera, new Rectangle((int)(position.X + contactPos.X), (int)(position.Y + contactPos.Y), (int)(width * Math.Abs(scaleX)), (int)(height * Math.Abs(scaleY))), rotation, new Vector2(width * Math.Abs(scaleX) * .5f, height * Math.Abs(scaleY) * .5f), Color.White, 1f, SpriteEffects.None, 0f); } }
/// <summary> /// Loads every animation for the player /// </summary> /// <param name="Content"></param> public void LoadContent(ContentManager Content) { SpriteHandler.AddSprite("Player_Idle", new Sprite(Content.Load <Texture2D>("idle"), 4, 64, 128)); SpriteHandler.SetInfo("Player_Idle", 0.1f, 1); SpriteHandler.AddSprite("Player_Jump", new Sprite(Content.Load <Texture2D>("jump"), 15, 64, 128)); SpriteHandler.SetInfo("Player_Jump", 0.1f, 1); SpriteHandler.AddSprite("Player_JumpCharge", new Sprite(Content.Load <Texture2D>("jumpCharge"), 10, 64, 128)); SpriteHandler.SetInfo("Player_JumpCharge", 0.1f, 1); SpriteHandler.AddSprite("Player_Accelerate", new Sprite(Content.Load <Texture2D>("accelerate"), 15, 64, 128)); SpriteHandler.SetInfo("Player_Accelerate", 0.1f, 1); }
/// <summary> /// Loads all the decks and tapes, etc /// </summary> /// <param name="Content"></param> public void LoadContent(ContentManager Content) { SpriteHandler.AddSprite("Tape_Default", new Sprite(Content.Load <Texture2D>("Tape_Default"))); SpriteHandler.AddSprite("Deck_Default", new Sprite(Content.Load <Texture2D>("Deck_Default"))); SpriteHandler.AddSprite("SimpleBoard", new Sprite(Content.Load <Texture2D>("board"))); }