// --------------------- /// <summary> /// Player Entity Class - All controls and stuff go here. Woo. /// </summary> /// <param name="game">Our Game</param> /// <param name="spriteBatch">The Spritebatch</param> public Player() : base() { // --------------------- this.spriteBatch = spriteBatch; this.SpriteSheet = Shared.IMG_Sprites["player"]; Set_State(Shared.EntityState.IDLE); this.FrameSize = new Vector2(32, 32); // --------------------- // Stats // --------------------- Team = Shared.Damage_Team.FRIENDLY; Base_Inv_Time = 0.4f; // --------------------- #region Animations //Generate Animations based on supplied sheet // ----------------------- int[] delay; // Idle State // ----------------------- // Idle Delays delay = new int[7]; // ----------------------- delay[0] = 20; // Delay Pre-Blink delay[3] = 20; // Delay Pre-Glance delay[4] = 5; // Hold Close Glance delay[6] = 5; // Hold Far Glance Animation_state.Add( Shared.EntityState.IDLE, AnimationHandler.Generate(SpriteSheet, FrameSize, 1, 7, delay)); // Idle / Default Bound Box // ----------------------- State_Boundary_Offset.Add( Shared.EntityState.IDLE, new Rectangle ( 3, 4, 20, 8 )); // Crouch State // ----------------------- Animation_state.Add( Shared.EntityState.CROUCHING, AnimationHandler.Generate(SpriteSheet, FrameSize, 2, 3, null, false)); // Crouch Bound Box // ----------------------- State_Boundary_Offset.Add( Shared.EntityState.CROUCHING, new Rectangle ( 3, 10, 20, 20 )); // Walking State // ----------------------- // Walking Delay delay = new int[6]; for (int item = 0; item < delay.Length; item++) { delay[item] = 1; } // ----------------------- Animation_state.Add( Shared.EntityState.WALKING, AnimationHandler.Generate(SpriteSheet, FrameSize, 3, 6, delay)); // Running State Animation_state.Add( Shared.EntityState.RUNNING, AnimationHandler.Generate(SpriteSheet, FrameSize, 3, 6)); // Jump Wind State // ----------------------- Animation_state.Add( Shared.EntityState.JUMP_WIND, AnimationHandler.Generate(SpriteSheet, FrameSize, 4, 1, null, false)); // Jumping State // ----------------------- // Jumping Delay delay = new int[3]; for (int item = 0; item < delay.Length; item++) { delay[item] = 1; } // ----------------------- Animation_state.Add( Shared.EntityState.JUMPING, AnimationHandler.Generate(SpriteSheet, FrameSize, 5, 3, delay)); // Falling State // ----------------------- // Falling Delay delay = new int[2]; for (int item = 0; item < delay.Length; item++) { delay[item] = 1; } // ----------------------- Animation_state.Add( Shared.EntityState.FALLING, AnimationHandler.Generate(SpriteSheet, FrameSize, 6, 2, delay)); // Basic Attack Animation // ----------------------- // Side Attack delay = new int[1] { 1 }; Animation_state.Add( Shared.EntityState.SIDE_ATTACK, AnimationHandler.Generate(SpriteSheet, FrameSize, 4, 1, delay, false, 1)); // Up Attack Animation_state.Add( Shared.EntityState.UP_ATTACK, AnimationHandler.Generate(SpriteSheet, FrameSize, 4, 1, delay, false, 2)); // Down Attack Animation_state.Add( Shared.EntityState.DOWN_ATTACK, AnimationHandler.Generate(SpriteSheet, FrameSize, 4, 1, delay, false, 3)); // ----------------------- #endregion // --------------------- // Basic Attack // ----------------------- Attack Basic = new Attack(); Basic.Damage = 2; Basic.Knockback = 2f; Basic.Lifespan = 1f; Basic.Cooldown = 0.4f; Basic.SFX = Shared.SFX_Sounds["Throw"]; Basic.Effect_Name = "Dagger"; Basic.Directional_Velocity = 11f; Basic.Source_Offset = new Vector2(0, 10); Basic.Damage_Type = Shared.Type.MUNDANE; Basic.Damage_Team = Shared.Damage_Team.FRIENDLY; Basic.Hit_Frame = 0; Basic.Source = this; Basic.Follow_Source = false; Basic.Inherit_Velocity = true; Attack_Roster.Add("basic", Basic); // Arcane Bolt // ----------------------- Attack Arcane_Bolt = new Attack(); Arcane_Bolt.Damage = 6; Arcane_Bolt.Focus_Cost = 3; Arcane_Bolt.Knockback = 15f; Arcane_Bolt.Lifespan = 1f; Arcane_Bolt.Cooldown = 0.5f; Arcane_Bolt.SFX = Shared.SFX_Sounds["arcane_bolt"]; Arcane_Bolt.Effect_Name = "Arcane_Bolt"; Arcane_Bolt.Directional_Velocity = 10f; Arcane_Bolt.Source_Offset = new Vector2(0, 10); Arcane_Bolt.Damage_Type = Shared.Type.ARCANE; Arcane_Bolt.Damage_Team = Shared.Damage_Team.FRIENDLY; Arcane_Bolt.Hit_Frame = 0; Arcane_Bolt.Source = this; Arcane_Bolt.Follow_Source = false; Arcane_Bolt.Inherit_Velocity = true; Attack_Roster.Add("Arcane_Bolt", Arcane_Bolt); }
// --------------------- // Goblin // --------------------- public Goblin(Vector2 input_position) { // Establish Basic Data // ----------------------- this.SpriteSheet = Shared.IMG_Sprites["goblin"]; this.Set_State(Shared.EntityState.IDLE); this.FrameSize = new Vector2(42, 42); this.Position = input_position; // ----------------------- // Stats // ----------------------- Eye_Offset = new Vector2(0, 0); Brain.target = Shared.Player; Attention_range = 6; Persistence = 3; Knockback = 6f; True_Damage = 5; MAX_Health_Points = 10; Walk_Speed = 2f; Run_Speed = 3f + (Shared.Randomizer.Next(2, 4)); // Varying RunSpeed ... for fun. Temporary. Jump_Strength = 11f; Team = Shared.Damage_Team.HOSTILE; Health_Points = MAX_Health_Points; Focus_Points = MAX_Focus_Points; Health_Cache = MAX_Health_Points; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Animation Zone // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ----------------------- #region Animations // Idle / Default Bound Box // ----------------------- State_Boundary_Offset.Add( Shared.EntityState.IDLE, new Rectangle ( 0, 10, 34, 20 )); //Generate Animations based on supplied sheet // ----------------------- int[] delay; // Idle State // ----------------------- delay = new int[8]; // ----------------------- delay[0] = 20; // Delay Pre-Blink delay[2] = 20; // Delay Pre-Blink Animation_state.Add( Shared.EntityState.IDLE, AnimationHandler.Generate(SpriteSheet, FrameSize, 1, 8, delay)); // Idle / Default Bound Box // ----------------------- // Walking State // ----------------------- // Walking Delay Animation_state.Add( Shared.EntityState.WALKING, AnimationHandler.Generate(SpriteSheet, FrameSize, 2, 6)); // Jumping State // ----------------------- Animation_state.Add( Shared.EntityState.JUMPING, AnimationHandler.Generate(SpriteSheet, FrameSize, 3, 1, null, false)); #endregion // ----------------------- }