Exemplo n.º 1
0
 public void GenerateSmoke(Color startColor, Color endColor, int width, int height, int amount)
 {
     for (int s = 0; s < amount; s++)
     {
         Vector2 pos = position + new Vector2(Main.random.Next(0, width), Main.random.Next(0, height));
         Vector2 vel = new Vector2(Main.random.Next(-2, 2) / 20.5f, -0.03f);
         Smoke.NewSmokeParticle(pos, vel, startColor, endColor, 30, 90);
     }
 }
        private void PlayerEntryAnimation()
        {
            animationTimer++;
            float flightStopCoord = 160f;

            if (animationTimer % 2 == 0)
            {
                Main.player.AddAfterImage(0.8f, Main.player.position);
            }

            if (animationTimer == 1)
            {
                Main.player.canMove    = false;
                Main.player.position.Y = 260f;
            }
            if (animationTimer >= 120 && Main.player.position.Y > flightStopCoord)
            {
                Main.player.position.Y -= animationTimer / 32f;
            }

            if (Main.player.position.Y <= flightStopCoord)
            {
                Main.player.canMove = true;
                for (int s = 0; s < 60; s++)
                {
                    Vector2 position = Main.player.position;
                    float   angle    = s * (360f / 60f);
                    Vector2 velocity = new Vector2(0.6f, 0.6f) * new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
                    Smoke.NewSmokeParticle(position + new Vector2(Main.player.hitbox.Width / 2f, Main.player.hitbox.Height / 2f), velocity, Color.LightBlue, Color.White, 30, 60);
                }
            }

            if (Main.player.canMove)
            {
                secondaryAnimationTimer++;
                if (secondaryAnimationTimer % 5 == 0)
                {
                    if (PlayerUI.uiAlpha == 0f)
                    {
                        PlayerUI.uiAlpha = 1f;
                    }
                    else if (PlayerUI.uiAlpha == 1f)
                    {
                        PlayerUI.uiAlpha = 0f;
                    }
                }
                if (secondaryAnimationTimer >= 25)
                {
                    PlayerUI.uiAlpha = 1f;
                    EndAnimation(PlayerEntry);
                }
            }
        }
Exemplo n.º 3
0
 private void ExtraEffects()
 {
     if (Main.random.Next(0, 2) == 0)
     {
         for (int s = 0; s < Main.random.Next(1, 4); s++)
         {
             float   newRotation = rotation + MathHelper.ToRadians(90f);
             Vector2 angle       = new Vector2((float)Math.Cos(newRotation), (float)Math.Sin(newRotation));
             float   radius      = 4f;
             angle.Normalize();
             //Vector2 offset = angle * radius;
             Vector2 smokePosition = center + (angle * radius);
             Smoke.NewSmokeParticle(smokePosition, -velocity * 0.6f, Color.Orange, Color.Gray, 5, 8, 8);
         }
     }
 }
Exemplo n.º 4
0
 private void ExtraEffects()
 {
     if (Main.random.Next(0, 5) == 0)
     {
         for (int s = 0; s < Main.random.Next(1, 4); s++)
         {
             Vector2 offset = new Vector2(4f, 15f);
             if (Main.random.Next(0, 2) == 1)
             {
                 offset.X += 12f;
             }
             Vector2 position       = Main.player.position + offset;
             float   angle          = 270f + Main.random.Next(-15, 15 + 1);
             float   angleInRadians = MathHelper.ToRadians(angle);
             Vector2 velocity       = new Vector2((float)Math.Cos(angleInRadians), (float)Math.Sin(angleInRadians));
             velocity.Normalize();
             velocity *= -0.6f;
             Smoke.NewSmokeParticle(position, velocity, Color.Orange, Color.Gray, 5, 8, 8);
         }
     }
 }
        public override void Update()
        {
            lifeTimer++;
            if (lifeTimer > MaxLifeTime)
            {
                Main.StartScreenShake(30, 2);
                DestroyInstance(this);
                Main.shaderManager.DisableScreenShaders();
                return;
            }
            float   strength = 0.01f;
            Vector2 center   = position + new Vector2(BombWidth / 2f, BombHeight / 2f);
            float   distance = 0.13f;

            Main.shaderManager.ActivateBlackHoleShader(strength, center, distance);
            if (lifeTimer > 2 * 60 && !playedOpeningSound)
            {
                playedOpeningSound = true;
                velocity           = Vector2.Zero;
                blackHoleOpeningSound.Play();
            }
            if (lifeTimer > 3 * 60)
            {
                activeSoundTimer++;
                if (activeSoundTimer > 200)
                {
                    activeSoundTimer = 0;
                    blackHoleActiveSound.Play();
                }
                CollisionBody[] activeEntitiesClone = Main.activeEntities.ToArray();
                foreach (CollisionBody entity in activeEntitiesClone)
                {
                    Vector2 posAdd = position - entity.position;
                    posAdd.Normalize();
                    entity.position += posAdd * 1.6f;

                    if (Vector2.Distance(position, entity.position) <= 20f)
                    {
                        if (entity is Enemy)
                        {
                            Enemy enemy = entity as Enemy;
                            enemy.health -= 1;
                            if (enemy.health <= 0)
                            {
                                enemy.DestroyInstance(enemy);
                            }
                        }
                        else if (entity is Player)
                        {
                            Main.playerHealth -= 1;
                        }
                    }
                }
                Main.StartScreenShake(1, 4);
                if (accretionDiskAlpha <= 1f && lifeTimer > 5 * 60)
                {
                    accretionDiskAlpha += 0.04f;
                    for (int s = 0; s < Main.random.Next(1, 4); s++)
                    {
                        float   radius         = 11f;
                        float   angle          = Main.random.Next(0, 360);
                        float   angleInRadians = MathHelper.ToRadians(angle);
                        Vector2 spawnPos       = new Vector2((float)Math.Cos(angleInRadians), (float)Math.Sin(angleInRadians)) * radius;
                        Vector2 velocity       = new Vector2(Main.random.Next(-5, 5 + 1) / 10f, Main.random.Next(-5, 5 + 1) / 10f);
                        Smoke.NewSmokeParticle(spawnPos, velocity, Color.Orange, Color.Red, (int)(accretionDiskAlpha / 0.2f), 5);
                    }
                }
            }

            frameCounter++;
            if (frameCounter >= 5)
            {
                frame       += 1;
                frameCounter = 0;
                if (frame >= 4)
                {
                    frame = 0;
                }
            }
            accretionDiskRotation += 0.58104f;

            position += velocity;
            hitbox.X  = (int)position.X;
            hitbox.Y  = (int)position.Y;
            animRect  = new Rectangle(0, BombHeight * frame, BombWidth, BombHeight);
        }