protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } debugTools.Update(); // TODO: Add your update logic here if (!MasterObjectContainer.paused || MasterObjectContainer.advanceOneFrame) { if (MasterObjectContainer.hitstopRemaining <= 0) { mainScene.Update(); MasterObjectContainer.Update(); } else { MasterObjectContainer.hitstopRemaining--; } } noHitstopScene.Update(); if (MasterObjectContainer.advanceOneFrame) { MasterObjectContainer.advanceOneFrame = false; } base.Update(gameTime); }
public void Update() { preState = state; state = Keyboard.GetState(); // switch for hitboxes if (state.IsKeyDown(Keys.F1) && preState.IsKeyUp(Keys.F1)) { MasterObjectContainer.showHitboxes = !MasterObjectContainer.showHitboxes; } // switch for pausing game if (state.IsKeyDown(Keys.Space) && preState.IsKeyUp(Keys.Space)) { MasterObjectContainer.paused = !MasterObjectContainer.paused; } if (state.IsKeyDown(Keys.Right) && preState.IsKeyUp(Keys.Right)) { MasterObjectContainer.advanceOneFrame = true; } if (state.IsKeyDown(Keys.F2) && preState.IsKeyUp(Keys.F2)) { MasterObjectContainer.FillSuper(); } }
public int DealDamage(int amount, bool chip = false) { amount = CalculateProration(amount); DisplayComboInformation(amount); currentHealth -= amount; if (currentHealth <= 0) { if (!chip) { // resolve death playerMovement.otherPlayerMovement.PlayWin(); MasterObjectContainer.EndRound(state.isPlayerOne()); } } return(amount); }
public Hitbox(int damage, int chipDamage, int hitstun, int blockstun, Vector2 pushback, Rectangle hitboxBounds, Vector2 positionOffset, CancelState cancelStrength, HitSpark attackStrength, AttackProperty attackProperty = AttackProperty.Hit, int pushbackDuration = 5, int hitStop = -1, bool ignorePushback = false, ThrowType throwType = ThrowType.none) { this.damage = damage; this.chipDamage = chipDamage; this.hitstun = hitstun; this.blockstun = blockstun; this.pushbackDuration = pushbackDuration; this.pushback = pushback; this.hitboxBounds = hitboxBounds; this.positionOffset = positionOffset; this.attackProperty = attackProperty; this.cancelStrength = cancelStrength; this.attackStrength = attackStrength; this.ignorePushback = ignorePushback; this.throwType = throwType; moveMasterID = MasterObjectContainer.GetMoveMasterID(); moveCurrentUseID = 0; if (hitStop == -1) { if (attackStrength == HitSpark.light) { this.hitStop = 5; } else if (attackStrength == HitSpark.medium) { this.hitStop = 7; } else if (attackStrength == HitSpark.heavy) { this.hitStop = 9; } else { this.hitStop = 11; } } else { this.hitStop = hitStop; } }
protected override void LoadContent() { chunDriverOne.InitializeComponents(PlayerIndex.One); chunDriverTwo.InitializeComponents(PlayerIndex.Two); Camera.SetPosition(new Vector2(0, 110)); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // set up object pools ObjectPool tmpHitSparks = new ObjectPool(HitSpark.block, Content); objectPools.addComponent(tmpHitSparks); tmpHitSparks = new ObjectPool(HitSpark.light, Content); objectPools.addComponent(tmpHitSparks); tmpHitSparks = new ObjectPool(HitSpark.medium, Content); objectPools.addComponent(tmpHitSparks); tmpHitSparks = new ObjectPool(HitSpark.heavy, Content); objectPools.addComponent(tmpHitSparks); tmpHitSparks = new ObjectPool(HitSpark.special, Content); objectPools.addComponent(tmpHitSparks); SpriteAnimator <superFlash> superEffect = new SpriteAnimator <superFlash>(new Vector2(50, 100)); objectPools.addComponent(superEffect); UIMatch.Load(Content); Stage stage = new Stage(); Texture2D stagePic = Content.Load <Texture2D>("stages/gouki/gouki_0-0"); StagePart akumaMoon = new StagePart(Transform.GetCustomRenderPosition(stagePic, new Vector2(0, 260), TransformOriginPoint.center), stagePic, .4f); stage.AddStagePart(akumaMoon); stagePic = Content.Load <Texture2D>("stages/gouki/gouki_1-0"); StagePart akumaMountain = new StagePart(Transform.GetCustomRenderPosition(stagePic, new Vector2(0, 250), TransformOriginPoint.center), stagePic, .35f); stage.AddStagePart(akumaMountain); stagePic = Content.Load <Texture2D>("stages/gouki/gouki_2-0"); StagePart akumaLeftFore = new StagePart(Transform.GetCustomRenderPosition(stagePic, new Vector2(0, 220), TransformOriginPoint.right), stagePic, 0); stage.AddStagePart(akumaLeftFore); stagePic = Content.Load <Texture2D>("stages/gouki/gouki_2-1"); StagePart akumaRightFore = new StagePart(Transform.GetCustomRenderPosition(stagePic, new Vector2(0, 220), TransformOriginPoint.left), stagePic, 0); stage.AddStagePart(akumaRightFore); stageEntity.addComponent(stage); Animation superAnim = new Animation(animationType.oneShot); superAnim.renderOneshotAfterCompletion = false; superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30265"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30266"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30267"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30268"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30269"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30270"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30271"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30272"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30273"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30274"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30275"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30276"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30277"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30278"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30279"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30280"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30281"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30282"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30283"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30284"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30285"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30286"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30287"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30288"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30289"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30290"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30291"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30292"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30293"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30294"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30295"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30296"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30308"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30309"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30310"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30311"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30312"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30313"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30314"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30315"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30316"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30317"), 1); superAnim.addFrame(this.Content.Load <Texture2D>("SuperEffect/30318"), 1); superEffect.addAnimation(superFlash.super, superAnim); MasterObjectContainer.superEffect = superEffect; MasterObjectContainer.hitSparkHolder = objectPools; mainScene.Load(Content); MasterSound.Load(Content); chunDriverOne.setOtherPlayer(ref chunli2); chunDriverTwo.setOtherPlayer(ref chunli); MasterObjectContainer.backgroundMusic = Content.Load <Song>("Music/ChunLiStage"); MasterObjectContainer.playerOneMovement = chunli.getComponent <PlayerMovement>(); MasterObjectContainer.playerTwoMovement = chunli2.getComponent <PlayerMovement>(); MasterObjectContainer.NextRound(); //chunAnim.PlayAnimation(FigherAnimations.neutral); // TODO: use this.Content to load your game content here }