public override void OnDestroy(ProjectileObj proj, bool hitPlayer) { Effects.BlackSmokeEffect.DisplayCrowDestruction(proj.Position); Effects.CrowFeatherEffect.Display(proj.Position); proj.KillProjectile(); }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); proj.AltX += proj.CurrentSpeed * 60f * (float)gameTime.ElapsedGameTime.TotalSeconds; proj.Position = CDGMath.GetCirclePosition(proj.AltX, proj.AltY, proj.Target.Position); }
public override void OnDestroy(ProjectileObj proj, bool hitPlayer) { Effects.BlackSmokeEffect.DisplayCrowDestruction(proj.Position); Effects.CrowFeatherEffect.Display(proj.Position); proj.KillProjectile(); }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); proj.AltX += proj.CurrentSpeed * 60f * (float)gameTime.ElapsedGameTime.TotalSeconds; proj.Position = CDGMath.GetCirclePosition(proj.AltX, proj.AltY, proj.Target.Position); }
protected virtual void Activate(ProjectileObj proj) { proj.CollisionType = Game.CollisionType.GlobalDamageWall; proj.LifeSpan = proj.AltY; proj.m_elapsedLifeSpan = 0f; proj.IsCollidable = true; proj.Opacity = 1f; }
public static void FadeOutOffset(ProjectileObj proj, bool hitPlayer) { Tween.StopAllContaining(proj, false); proj.IsCollidable = false; Tween.By(proj, 0.3f, Linear.EaseNone, "X", CDGMath.RandomInt(-50, 50).ToString(), "Y", CDGMath.RandomInt(-100, 100).ToString()); Tween.To(proj, 0.3f, Linear.EaseNone, "Opacity", "0"); Tween.AddEndHandlerToLastTween(proj, "KillProjectile"); }
public static void StopFadeOut(ProjectileObj proj, bool hitPlayer) { proj.IsCollidable = false; proj.AccelerationX = 0f; proj.AccelerationY = 0f; Tween.To(proj, 0.3f, Tween.EaseNone, "Opacity", "0"); Tween.AddEndHandlerToLastTween(proj, "KillProjectile"); }
protected virtual void Activate(ProjectileObj proj) { proj.CollisionType = Game.CollisionType.GlobalDamageWall; proj.LifeSpan = proj.AltY; proj.m_elapsedLifeSpan = 0f; proj.IsCollidable = true; proj.Opacity = 1f; }
public override void Initialize(ProjectileObj projectile) { base.Initialize(projectile); projectile.IgnoreBoundsCheck = true; projectile.AccelerationXEnabled = false; projectile.AccelerationYEnabled = false; }
public override void Initialize(ProjectileObj projectile) { base.Initialize(projectile); projectile.IgnoreBoundsCheck = true; projectile.AccelerationXEnabled = false; projectile.AccelerationYEnabled = false; }
public override void Initialize(ProjectileObj projectile) { base.Initialize(projectile); projectile.IgnoreBoundsCheck = true; if (projectile.Source.Flip == SpriteEffects.FlipHorizontally) projectile.AltX = -projectile.AltX; }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); var totalSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; if (proj.AltY > 0f) { proj.AltY -= totalSeconds; if (proj.AltY <= 0f) { //ProceduralLevelScreen currentScreen = Game.ScreenManager.CurrentScreen as ProceduralLevelScreen; //if (currentScreen != null) //{ Effects.BlackSmokeEffect.DisplayCrowSmoke(proj.Position); proj.AltY = 0.05f; //} } } if (proj.AltX > 0f) { proj.AltX -= totalSeconds; proj.Orientation = MathHelper.WrapAngle(proj.Orientation); } else proj.TurnToFace(proj.Target.Position, proj.TurnSpeed, totalSeconds); proj.HeadingX = (float)Math.Cos(proj.Orientation); proj.HeadingY = (float)Math.Sin(proj.Orientation); proj.AccelerationX = 0f; proj.AccelerationY = 0f; proj.Position += proj.CurrentSpeed * totalSeconds * proj.Heading; float rotation = MathHelper.ToDegrees(proj.Orientation); if (proj.HeadingX <= 0f) { proj.Flip = SpriteEffects.FlipHorizontally; rotation = ((rotation >= 0f ? -180f : 180f) + rotation) * 60f * totalSeconds; } else proj.Flip = SpriteEffects.None; proj.Rotation = rotation; proj.Rotation = MathHelper.Clamp(proj.Rotation, -90f, 90f); if (proj.Target == null) proj.RunDestroyAnimation(false); else { var enemy = proj.Target as IKillableObj; if (enemy != null && enemy.IsKilled) proj.RunDestroyAnimation(false); } }
public override void Initialize(ProjectileObj projectile) { base.Initialize(projectile); projectile.IgnoreBoundsCheck = true; if (projectile.Source.Flip == SpriteEffects.FlipHorizontally) { projectile.AltX = -projectile.AltX; } }
public override void Initialize(ProjectileObj projectile) { base.Initialize(projectile); projectile.Opacity = 0; projectile.CollisionType = Game.CollisionType.Player; projectile.IgnoreBoundsCheck = true; Tween.To(projectile, 0.2f, Tween.EaseNone, "ScaleX", "100", "ScaleY", "50"); Tween.AddEndHandlerToLastTween(projectile, "KillProjectile"); }
public override void Initialize(ProjectileObj projectile) { base.Initialize(projectile); projectile.Opacity = 0; projectile.CollisionType = Game.CollisionType.Player; projectile.IgnoreBoundsCheck = true; Tween.To(projectile, 0.2f, Tween.EaseNone, "ScaleX", "100", "ScaleY", "50"); Tween.AddEndHandlerToLastTween(projectile, "KillProjectile"); }
public override bool OnCollision(ProjectileObj proj, PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount) { if (knockbackAmount != Vector2.Zero) { float inertia = 3f; target.CurrentSpeed = 0f; target.AccelerationX = knockbackAmount.X * (target.X >= proj.Source.X ? inertia : -inertia); target.AccelerationY = -knockbackAmount.Y * inertia; } return(false); }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); if (proj.AltX > 0f) { proj.AltX -= (float)gameTime.ElapsedGameTime.TotalSeconds; proj.Opacity = 0.9f - AltX; proj.ScaleY = 1f - AltX; if (AltX <= 0f) Activate(proj); } }
public override bool OnCollision(ProjectileObj proj, PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount) { if (knockbackAmount != Vector2.Zero) { float inertia = 3f; target.CurrentSpeed = 0f; target.AccelerationX = knockbackAmount.X * (target.X >= proj.Source.X ? inertia : -inertia); target.AccelerationY = -knockbackAmount.Y * inertia; } return false; }
private void DisplayExplosion(ProjectileObj proj) { proj.IsWeighted = false; proj.ChangeSprite("SpellTimeBombExplosion_Sprite"); proj.PlayAnimation(false); proj.IsDying = true; proj.CollisionType = Game.CollisionType.GlobalDamageWall; proj.AnimationDelay = 0.0333333351f; proj.Scale = new Vector2(4f); Tweener.Tween.RunFunction(0.5f, this, "KillProjectile"); Effects.ExplosionEffect.Display(proj.Position); }
private void DisplayExplosion(ProjectileObj proj) { proj.IsWeighted = false; proj.ChangeSprite("SpellTimeBombExplosion_Sprite"); proj.PlayAnimation(false); proj.IsDying = true; proj.CollisionType = Game.CollisionType.GlobalDamageWall; proj.AnimationDelay = 0.0333333351f; proj.Scale = new Vector2(4f); Tweener.Tween.RunFunction(0.5f, this, "KillProjectile"); Effects.ExplosionEffect.Display(proj.Position); }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); var totalSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; proj.AccelerationX -= proj.AltX * 60f * totalSeconds; if (proj.AltY > 0f) { proj.AltY -= totalSeconds; if (proj.AltY <= 0f) proj.CollisionType = Game.CollisionType.GlobalDamageWall; } }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); if (proj.AltX > 0f) { proj.AltX -= (float)gameTime.ElapsedGameTime.TotalSeconds; proj.Opacity = 0.9f - AltX; proj.ScaleY = 1f - AltX; if (AltX <= 0f) { Activate(proj); } } }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); var totalSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; proj.AccelerationX -= proj.AltX * 60f * totalSeconds; if (proj.AltY > 0f) { proj.AltY -= totalSeconds; if (proj.AltY <= 0f) { proj.CollisionType = Game.CollisionType.GlobalDamageWall; } } }
public static void PlayerDeflect(ProjectileObj proj, bool hitPlayer) { if (hitPlayer) { Tween.By(proj, 0.3f, Linear.EaseNone, "X", CDGMath.RandomInt(-50, 50).ToString(), "Y", CDGMath.RandomInt(-100, -50).ToString(), "Rotation", "270"); Tween.To(proj, 0.3f, Linear.EaseNone, "Opacity", "0"); } else { proj.IsWeighted = false; proj.IsCollidable = false; Tween.To(proj, 0.3f, Linear.EaseNone, "delay", "0.3", "Opacity", "0"); } Tween.AddEndHandlerToLastTween(proj, "KillProjectile"); }
public override void Update(ProjectileObj proj, GameTime gameTime) { if (proj.BlinkTime >= proj.AltX && proj.AltX != 0f) { proj.Blink(Color.Red, 0.1f); proj.BlinkTime = proj.AltX / 1.5f; } if (proj.AltX > 0f) { proj.AltX -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (proj.AltX <= 0f) DisplayExplosion(proj); } base.Update(proj, gameTime); }
public static void Explosion(ProjectileObj proj, bool hitPlayer) { string newSprite = proj.SpriteName.Replace("_", "Explosion_"); proj.ChangeSprite(newSprite); proj.AnimationDelay = 0.0333333351f; proj.PlayAnimation(false); proj.IsWeighted = false; proj.IsCollidable = false; if (newSprite != "EnemySpearKnightWaveExplosion_Sprite" && newSprite != "WizardIceProjectileExplosion_Sprite") { proj.Rotation = 0f; } Tween.RunFunction(0.5f, proj, "KillProjectile"); }
public override void Update(ProjectileObj proj, GameTime gameTime) { if (proj.BlinkTime >= proj.AltX && proj.AltX != 0f) { proj.Blink(Color.Red, 0.1f); proj.BlinkTime = proj.AltX / 1.5f; } if (proj.AltX > 0f) { proj.AltX -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (proj.AltX <= 0f) { DisplayExplosion(proj); } } base.Update(proj, gameTime); }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); var totalSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; proj.AccelerationX = 0f; proj.AccelerationY = 0f; proj.HeadingX = (float)Math.Cos(proj.Orientation); proj.HeadingY = (float)Math.Sin(proj.Orientation); proj.Position += (proj.Heading * (proj.CurrentSpeed * totalSeconds)); if (proj.AltY > 0f) { proj.AltY -= totalSeconds; if (proj.AltY <= 0f) proj.CollisionType = Game.CollisionType.GlobalDamageWall; } }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); var totalSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; proj.AccelerationX = 0f; proj.AccelerationY = 0f; proj.HeadingX = (float)Math.Cos(proj.Orientation); proj.HeadingY = (float)Math.Sin(proj.Orientation); proj.Position += (proj.Heading * (proj.CurrentSpeed * totalSeconds)); if (proj.AltY > 0f) { proj.AltY -= totalSeconds; if (proj.AltY <= 0f) { proj.CollisionType = Game.CollisionType.GlobalDamageWall; } } }
public static void Kill(ProjectileObj proj, bool hitPlayer) { proj.KillProjectile(); }
public static void FadeOut(ProjectileObj proj, bool hitPlayer) { Tween.To(proj, 0.2f, Tween.EaseNone, "Opacity", "0"); Tween.AddEndHandlerToLastTween(proj, "KillProjectile"); }
public override void OnDestroy(ProjectileObj proj, bool hitPlayer) { base.OnDestroy(proj, hitPlayer); }
public virtual void Initialize(ProjectileObj projectile) { projectile.Prepare(); }
public static void Explosion(ProjectileObj proj, bool hitPlayer) { string newSprite = proj.SpriteName.Replace("_", "Explosion_"); proj.ChangeSprite(newSprite); proj.AnimationDelay = 0.0333333351f; proj.PlayAnimation(false); proj.IsWeighted = false; proj.IsCollidable = false; if (newSprite != "EnemySpearKnightWaveExplosion_Sprite" && newSprite != "WizardIceProjectileExplosion_Sprite") proj.Rotation = 0f; Tween.RunFunction(0.5f, proj, "KillProjectile"); }
public ProjectileFireEvent(GameObj sender, Projectiles.ProjectileDefinition definition, Projectiles.ProjectileObj projectile) : base(sender) { _projDef = definition; _projectile = projectile; }
public virtual void Initialize(ProjectileObj projectile) { projectile.Prepare(); }
public virtual bool OnCollision(ProjectileObj proj, PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount) { return true; }
public static void PlayerDeflect(ProjectileObj proj, bool hitPlayer) { if (hitPlayer) { Tween.By(proj, 0.3f, Linear.EaseNone, "X", CDGMath.RandomInt(-50, 50).ToString(), "Y", CDGMath.RandomInt(-100, -50).ToString(), "Rotation", "270"); Tween.To(proj, 0.3f, Linear.EaseNone, "Opacity", "0"); } else { proj.IsWeighted = false; proj.IsCollidable = false; Tween.To(proj, 0.3f, Linear.EaseNone, "delay", "0.3", "Opacity", "0"); } Tween.AddEndHandlerToLastTween(proj, "KillProjectile"); }
public static void StopFadeOut(ProjectileObj proj, bool hitPlayer) { proj.IsCollidable = false; proj.AccelerationX = 0f; proj.AccelerationY = 0f; Tween.To(proj, 0.3f, Tween.EaseNone, "Opacity", "0"); Tween.AddEndHandlerToLastTween(proj, "KillProjectile"); }
public static void Kill(ProjectileObj proj, bool hitPlayer) { proj.KillProjectile(); }
public static void FadeOutOffset(ProjectileObj proj, bool hitPlayer) { Tween.StopAllContaining(proj, false); proj.IsCollidable = false; Tween.By(proj, 0.3f, Linear.EaseNone, "X", CDGMath.RandomInt(-50, 50).ToString(), "Y", CDGMath.RandomInt(-100, 100).ToString()); Tween.To(proj, 0.3f, Linear.EaseNone, "Opacity", "0"); Tween.AddEndHandlerToLastTween(proj, "KillProjectile"); }
public static void FadeOut(ProjectileObj proj, bool hitPlayer) { Tween.To(proj, 0.2f, Tween.EaseNone, "Opacity", "0"); Tween.AddEndHandlerToLastTween(proj, "KillProjectile"); }
public virtual bool OnCollision(ProjectileObj proj, PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount) { return(true); }
public virtual void OnDestroy(ProjectileObj proj, bool hitPlayer) { DestructionHandler?.Invoke(proj, hitPlayer); }
public static void RunTeleport(ProjectileObj proj) { var source = proj.Source as PhysicsObjContainer; int closestDistance = int.MaxValue; BlankObj closestObj = null; bool flip = source.Flip != SpriteEffects.None; foreach (BlankObj terrainObj in Core.GetCurrentRoomTerrainObjects()) { if (terrainObj.Bounds.Top >= proj.Bounds.Bottom || terrainObj.Bounds.Bottom <= proj.Bounds.Top) continue; var point = Vector2.Zero; float distance = float.MaxValue; Vector2 start1 = Vector2.Zero, end1 = Vector2.Zero; Func<Rectangle, float, Vector2, Vector2> startFunc = null, endFunc = null; if (!flip) { if (terrainObj.X <= proj.X) continue; if (terrainObj.Rotation != 0) { start1 = proj.Position; end1 = new Vector2(proj.X + 6600f, proj.Y); if (terrainObj.Rotation < 0f) { startFunc = CollisionMath.UpperLeftCorner; endFunc = CollisionMath.UpperRightCorner; } else { startFunc = CollisionMath.LowerLeftCorner; endFunc = CollisionMath.UpperLeftCorner; } } } else { if (terrainObj.X >= proj.X) continue; if (terrainObj.Rotation != 0) { start1 = new Vector2(proj.X - 6600f, proj.Y); end1 = proj.Position; if (terrainObj.Rotation < 0f) { startFunc = CollisionMath.UpperRightCorner; endFunc = CollisionMath.LowerRightCorner; } else { startFunc = CollisionMath.UpperLeftCorner; endFunc = CollisionMath.UpperRightCorner; } } } if (startFunc != null) { var bounds = new Rectangle((int)terrainObj.X, (int)terrainObj.Y, terrainObj.Width, terrainObj.Height); var start2 = startFunc(bounds, terrainObj.Rotation, Vector2.Zero); var end2 = endFunc(bounds, terrainObj.Rotation, Vector2.Zero); point = CollisionMath.LineToLineIntersect(start1, end1, start2, end2); } if (point == Vector2.Zero) distance = !flip ? (terrainObj.Bounds.Left - proj.Bounds.Right) : (proj.Bounds.Left - terrainObj.Bounds.Right); else distance = !flip ? (point.X - proj.X) : (proj.X - point.X); if (distance < closestDistance) { closestDistance = (int)distance; closestObj = terrainObj; } } if (closestObj != null) { var newOffset = closestDistance - (closestObj.Rotation != 0f ? source.Width : source.TerrainBounds.Width) / 2f; if (flip) newOffset = -newOffset; source.X += newOffset; } }
public virtual void OnDestroy(ProjectileObj proj, bool hitPlayer) { DestructionHandler?.Invoke(proj, hitPlayer); }
public override void Update(ProjectileObj proj, GameTime gameTime) { base.Update(proj, gameTime); var totalSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; if (proj.AltY > 0f) { proj.AltY -= totalSeconds; if (proj.AltY <= 0f) { //ProceduralLevelScreen currentScreen = Game.ScreenManager.CurrentScreen as ProceduralLevelScreen; //if (currentScreen != null) //{ Effects.BlackSmokeEffect.DisplayCrowSmoke(proj.Position); proj.AltY = 0.05f; //} } } if (proj.AltX > 0f) { proj.AltX -= totalSeconds; proj.Orientation = MathHelper.WrapAngle(proj.Orientation); } else { proj.TurnToFace(proj.Target.Position, proj.TurnSpeed, totalSeconds); } proj.HeadingX = (float)Math.Cos(proj.Orientation); proj.HeadingY = (float)Math.Sin(proj.Orientation); proj.AccelerationX = 0f; proj.AccelerationY = 0f; proj.Position += proj.CurrentSpeed * totalSeconds * proj.Heading; float rotation = MathHelper.ToDegrees(proj.Orientation); if (proj.HeadingX <= 0f) { proj.Flip = SpriteEffects.FlipHorizontally; rotation = ((rotation >= 0f ? -180f : 180f) + rotation) * 60f * totalSeconds; } else { proj.Flip = SpriteEffects.None; } proj.Rotation = rotation; proj.Rotation = MathHelper.Clamp(proj.Rotation, -90f, 90f); if (proj.Target == null) { proj.RunDestroyAnimation(false); } else { var enemy = proj.Target as IKillableObj; if (enemy != null && enemy.IsKilled) { proj.RunDestroyAnimation(false); } } }
public virtual void Update(ProjectileObj proj, GameTime gameTime) { }
public override void OnDestroy(ProjectileObj proj, bool hitPlayer) { base.OnDestroy(proj, hitPlayer); }
public virtual void Update(ProjectileObj proj, GameTime gameTime) { }