public AI(Game game, SpriteBatch screenSpriteBatch) : base(game, screenSpriteBatch, PlayerSide.Right) { Catapult = new Catapult(game, screenSpriteBatch, "Textures/Catapults/Red/redIdle/redIdle", new Vector2(600, 332), SpriteEffects.FlipHorizontally, true); }
public Human (Game game, SpriteBatch screenSpriteBatch) : base(game, screenSpriteBatch) { Catapult = new Catapult (game, screenSpriteBatch, "Textures/Catapults/Blue/blueIdle/blueIdle", catapultPosition, SpriteEffects.None, false); }
public Human(Game game, SpriteBatch screenSpriteBatch) : base(game, screenSpriteBatch) { Catapult = new Catapult(game, screenSpriteBatch, "Textures/Catapults/Blue/blueIdle/blueIdle", catapultPosition, SpriteEffects.None, false); }
public override void Initialize() { arrow = curGame.Content.Load <Texture2D>("Textures/HUD/arrow"); Catapult.Initialize(); base.Initialize(); }
public override void Initialize() { //Initialize randomizer random = new Random(); Catapult.Initialize(); base.Initialize(); }
public AI(Game game, SpriteBatch screenSpriteBatch) : base(game, screenSpriteBatch) { // Initialize catapult Catapult = new Catapult(game, screenSpriteBatch, "Textures/Catapults/Red/redIdle/redIdle", new Vector2(600, 332), SpriteEffects.FlipHorizontally, true); }
public override void Initialize() { arrow = curGame.Content.Load <Texture2D>("Textures/HUD/arrow"); guideDot = curGame.Content.Load <Texture2D>("Textures/HUD/guideDot"); Catapult.Initialize(); guideProjectile = new Projectile(Game, spriteBatch, "Textures/Ammo/rock_ammo", Catapult.ProjectileStartPosition, Catapult.GroundHitOffset, false, Catapult.Gravity); base.Initialize(); }
public void HandleInput(GestureSample gestureSample) { // Process input only if in Human's turn if (IsActive) { // Process any Drag gesture if (gestureSample.GestureType == GestureType.FreeDrag) { // If drag just began, save the sample for future // calculations and start Aim "animation" if (null == firstSample) { firstSample = gestureSample; Catapult.CurrentState = CatapultState.Aiming; } // save the current gesture sample prevSample = gestureSample; // calculate the delta between first sample and current // sample to present visual sound on screen Vector2 delta = prevSample.Value.Position - firstSample.Value.Position; Catapult.ShotStrength = delta.Length() / maxDragDelta; float baseScale = 0.001f; arrowScale = baseScale * delta.Length(); isDragging = true; } else if (gestureSample.GestureType == GestureType.DragComplete) { // calculate velocity based on delta between first and last // gesture samples if (null != firstSample) { Vector2 delta = prevSample.Value.Position - firstSample.Value.Position; Catapult.ShotVelocity = MinShotStrength + Catapult.ShotStrength * (MaxShotStrength - MinShotStrength); Catapult.Fire(Catapult.ShotVelocity); Catapult.CurrentState = CatapultState.Firing; } // turn off dragging state ResetDragState(); } } }
public Human (Game game, SpriteBatch screenSpriteBatch, PlayerSide playerSide) : base(game, screenSpriteBatch) { string idleTextureName = ""; this.playerSide = playerSide; if (playerSide == PlayerSide.Left) { catapultPosition = new Vector2 (140, 332); idleTextureName = "Textures/Catapults/Blue/blueIdle/blueIdle"; } else { catapultPosition = new Vector2 (600, 332); spriteEffect = SpriteEffects.FlipHorizontally; idleTextureName = "Textures/Catapults/Red/redIdle/redIdle"; } Catapult = new Catapult (game, screenSpriteBatch, idleTextureName, catapultPosition, spriteEffect, playerSide == PlayerSide.Left ? false : true); }
public void HandleInput(InputState input) { // Process input only if in Human's turn if (IsActive && !IsAI) { if (input.MouseGesture.HasFlag(MouseGestureType.FreeDrag)) { // If drag just began save the sample for future // calculations and start Aim "animation" if (null == firstMouseSample) { firstMouseSample = input.MouseDragStartPosition; Catapult.CurrentState = CatapultState.Aiming; } // save the current gesture sample prevMouseSample = input.CurrentMousePosition; // calculate the delta between first sample and current // sample to present visual sound on screen Vector2 delta = (Vector2)prevMouseSample - (Vector2)firstMouseSample; Catapult.ShotStrength = delta.Length() / maxDragDelta; float baseScale = 0.001f; arrowScale = baseScale * delta.Length(); isDragging = true; } else if (input.MouseGesture.HasFlag(MouseGestureType.DragComplete)) { // calc velocity based on delta between first and last // gesture samples if (null != firstMouseSample) { Vector2 delta = (Vector2)prevMouseSample - (Vector2)firstMouseSample; Catapult.ShotVelocity = MinShotStrength + Catapult.ShotStrength * (MaxShotStrength - MinShotStrength); Catapult.Fire(Catapult.ShotVelocity); Catapult.CurrentState = CatapultState.Firing; } ResetDragState(); } } }
public Human(Game game, SpriteBatch screenSpriteBatch, PlayerSide playerSide) : base(game, screenSpriteBatch) { string idleTextureName = ""; this.playerSide = playerSide; if (playerSide == PlayerSide.Left) { catapultPosition = new Vector2(140, 332); idleTextureName = "Textures/Catapults/Blue/blueIdle/blueIdle"; } else { catapultPosition = new Vector2(600, 332); spriteEffect = SpriteEffects.FlipHorizontally; idleTextureName = "Textures/Catapults/Red/redIdle/redIdle"; } Catapult = new Catapult(game, screenSpriteBatch, idleTextureName, catapultPosition, spriteEffect, playerSide == PlayerSide.Left ? false : true); }
public override void Draw(GameTime gameTime) { // Draw related catapults Catapult.Draw(gameTime); base.Draw(gameTime); }
public override void Update(GameTime gameTime) { // Update catapult related to the player Catapult.Update(gameTime); base.Update(gameTime); }