public override void prePhysicsUpdate(GameTime time) { base.prePhysicsUpdate(time); transformedFrom.hunger -= .005f; frameSwitcher--; if (flapping) { float bonusJump = 0; SortedList <float, StatusEffect> jumpList; statusEffects.TryGetValue(StatusEffect.status.JUMP, out jumpList); if (jumpList != null && jumpList.Count > 0) { bonusJump = jumpList.ElementAt(jumpList.Count - 1).Value.potency; } impulse += new Vector2(0, -jumpForce * (1 + bonusJump)); for (int i = 0; i < bonusJump * 3; i++) { ParticleJumpBoost particle = new ParticleJumpBoost(location, world, new Vector2(), 100); world.addEntity(particle); } transformedFrom.hunger -= .3f; if (frameSwitcher <= 0) { if (currentFrame + 1 == Game1.texture_condor_flap.Length) { flapping = false; } else { currentFrame = (currentFrame + 1) % Game1.texture_condor_flap.Length; frameSwitcher = flapFrameSwitchPoint; selectedFrame = Game1.texture_condor_flap[currentFrame]; } } } else { if (frameSwitcher <= 0) { currentFrame = (currentFrame + 1) % Game1.texture_condor.Length; frameSwitcher = frameSwitchPoint; selectedFrame = Game1.texture_condor[currentFrame]; } } }
public virtual void jump(float directionAndVelocityAsPercentOfSpeed) { float bonusJump = 0; StatusEffect jump = getEffect(StatusEffect.status.JUMP); if (jump != null) { bonusJump = jump.potency; } StatusEffect slow = getEffect(StatusEffect.status.SLOW); if (slow != null) { bonusJump *= slow.potency; } if (collideBottom && framesCollidingBottom > 0) { impulse += new Vector2(0, -directionAndVelocityAsPercentOfSpeed * jumpForce * (1 + bonusJump)); for (int i = 0; i < bonusJump * 20; i++) { ParticleJumpBoost particle = new ParticleJumpBoost(location, world, new Vector2(), 100); world.addEntity(particle); } } else { TileType tileBelow = world.getBlock(location + new Vector2(0, Chunk.tileDrawWidth)); if (tileIn != null && !tileIn.tags.Contains(TagReferencer.WATER)) { impulse += new Vector2(0, -.05f); } else { impulse += new Vector2(0, -.2f); if ((collideLeft || collideRight) && velocity.Y > -4.3f) { impulse += new Vector2(0, -1.5f); } } } }