public PlayerDrawer( Vector2 position, EntitySpriteSheet entitySpriteSheet, Character player, ControllerInputHandler characterInputController) { this.position = position; this.EntitySpriteSheet = entitySpriteSheet; this.Player = player; this.ControllerInputHandler = characterInputController; this.currentFrame = 0; this.totalFrames = this.EntitySpriteSheet.SpriteSheetRows * this.EntitySpriteSheet.SpriteSheetCols; this.currentRow = 0; this.isMoving = false; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); this.controllerInputHandler = new ControllerInputHandler(Keyboard.GetState()); Vector2 playerPosition = new Vector2(20, 20); Texture2D playerTexture = Content.Load <Texture2D>("Enemy\\beatem"); this.player = new Character(4, 4); EntitySpriteSheet ess = new EntitySpriteSheet( playerTexture, playerPosition, 4, 4); ess.IntializeMovementPositions(3, 0, 1, 2); ess.InitializeParticles(new EntitySpriteSheet[] { new EntitySpriteSheet(ess.Texture, playerPosition, 1, ess.SpriteSheetCols), new EntitySpriteSheet(ess.Texture, playerPosition, 1, ess.SpriteSheetCols), new EntitySpriteSheet(ess.Texture, playerPosition, 1, ess.SpriteSheetCols), new EntitySpriteSheet(ess.Texture, playerPosition, 1, ess.SpriteSheetCols) }); this.playerDrawer = new PlayerDrawer(playerPosition, ess, this.player, this.controllerInputHandler); }