Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public override void OnEnter()
 {
     m_smoke1.Position = new Vector2(CDGMath.RandomInt(300, 1000),
                                     m_text.Y + m_text.Height / 2f - 30f + CDGMath.RandomInt(-100, 100));
     m_smoke2.Position = new Vector2(CDGMath.RandomInt(200, 700),
                                     m_text.Y + m_text.Height / 2f - 30f + CDGMath.RandomInt(-50, 50));
     m_smoke3.Position = new Vector2(CDGMath.RandomInt(300, 800),
                                     m_text.Y + m_text.Height / 2f - 30f + CDGMath.RandomInt(-100, 100));
     m_smoke1.Opacity = (m_smoke2.Opacity = (m_smoke3.Opacity = 0f));
     Tween.To(m_smoke1, m_fadeInSpeed, Tween.EaseNone, "Opacity", "0.3");
     Tween.To(m_smoke2, m_fadeInSpeed, Tween.EaseNone, "Opacity", "0.2");
     Tween.To(m_smoke3, m_fadeInSpeed, Tween.EaseNone, "Opacity", "0.15");
     BackBufferOpacity = 0f;
     m_text.Opacity    = 0f;
     Tween.To(this, m_fadeInSpeed, Tween.EaseNone, "BackBufferOpacity", m_backBufferOpacity.ToString());
     Tween.To(m_text, m_fadeInSpeed, Tween.EaseNone, "Opacity", "1");
     if (m_typewriteText)
     {
         m_text.Visible = false;
         Tween.RunFunction(m_fadeInSpeed, m_text, "BeginTypeWriting", m_text.Text.Length * 0.05f, "");
     }
     else
     {
         m_text.Visible = true;
     }
     base.OnEnter();
 }
Exemplo n.º 3
0
 private void RandomizeItem()
 {
     if (Game.PlayerStats.Class != 16 && Game.PlayerStats.Class != 17)
     {
         var spellList = ClassType.GetSpellList(Game.PlayerStats.Class);
         do
         {
             Spell = spellList[CDGMath.RandomInt(0, spellList.Length - 1)];
         } while ((Game.PlayerStats.Traits.X == 31f || Game.PlayerStats.Traits.Y == 31f) &&
                  (Spell == 6 || Spell == 4 || Spell == 11));
         Array.Clear(spellList, 0, spellList.Length);
         ID = Spell;
     }
     else if (Game.PlayerStats.Class == 16)
     {
         ID    = 13;
         Spell = 13;
     }
     else if (Game.PlayerStats.Class == 17)
     {
         ID    = 14;
         Spell = 14;
     }
     m_icon.ChangeSprite(SpellType.Icon(Spell));
 }
Exemplo n.º 4
0
 public void ActivateTarget()
 {
     if (m_numTargets - m_currentTargetIndex < m_targetIcons.NumChildren)
     {
         m_targetIcons.GetChildAt(m_numTargets - m_currentTargetIndex).Visible = false;
         GiveGold();
     }
     if (m_currentTargetIndex >= m_numTargets)
     {
         m_currentTarget = null;
         return;
     }
     if (m_currentTarget != null)
     {
         m_targetSpeed += m_targetSpeedMod;
     }
     m_currentTarget         = m_targetList[m_currentTargetIndex];
     m_currentTarget.Visible = true;
     if (!IsReversed)
     {
         Tween.By(m_currentTarget, 2f, Quad.EaseOut, "X", (-400 + CDGMath.RandomInt(-200, 200)).ToString());
         return;
     }
     Tween.By(m_currentTarget, 2f, Quad.EaseOut, "X", (400 + CDGMath.RandomInt(-200, 200)).ToString());
 }
Exemplo n.º 5
0
 public void Update(Camera2D camera)
 {
     if (AttachedProjectile.X <= camera.Bounds.Left + m_iconOffset)
     {
         X = m_iconOffset;
     }
     else if (AttachedProjectile.X > camera.Bounds.Right - m_iconOffset)
     {
         X = 1320 - m_iconOffset;
     }
     else
     {
         X = AttachedProjectile.X - camera.TopLeftCorner.X;
     }
     if (AttachedProjectile.Y <= camera.Bounds.Top + m_iconOffset)
     {
         Y = m_iconOffset;
     }
     else if (AttachedProjectile.Y > camera.Bounds.Bottom - m_iconOffset)
     {
         Y = 720 - m_iconOffset;
     }
     else
     {
         Y = AttachedProjectile.Y - camera.TopLeftCorner.Y;
     }
     Rotation                  = CDGMath.AngleBetweenPts(camera.TopLeftCorner + Position, AttachedProjectile.Position);
     m_iconBG.Position         = Position;
     m_iconBG.Rotation         = Rotation;
     m_iconProjectile.Position = Position;
     m_iconProjectile.Rotation = AttachedProjectile.Rotation;
     m_iconProjectile.GoToFrame(AttachedProjectile.CurrentFrame);
 }
Exemplo n.º 6
0
        public static void Display(Vector2 start, Vector2 end, int numCoins)
        {
            float delay = 0.32f;

            lock (_defaultCommands)
                for (int i = 0; i < numCoins; i++, delay += 0.05f)
                {
                    Instance.Run(start, x =>
                    {
                        int xDrift = CDGMath.RandomInt(-30, 30);
                        int yDrift = CDGMath.RandomInt(-30, 30);

                        var cmd           = _defaultCommands[0];
                        cmd.Properties[1] = xDrift.ToString();
                        cmd.Properties[3] = yDrift.ToString();

                        cmd = _defaultCommands[1];
                        cmd.Properties[1] = delay.ToString();
                        cmd.Properties[3] = end.X.ToString();
                        cmd.Properties[5] = end.Y.ToString();

                        cmd.InitialValues[0] = start.X + xDrift;
                        cmd.InitialValues[1] = start.Y + yDrift;
                    });
                }
        }
Exemplo n.º 7
0
 public void MovePlayerTo(GameObj target)
 {
     m_controlsLocked = true;
     if (Player.X != target.X - 150f)
     {
         if (Player.X > target.Position.X - 150f)
         {
             Player.Flip = SpriteEffects.FlipHorizontally;
         }
         var num = CDGMath.DistanceBetweenPts(Player.Position, new Vector2(target.X - 150f, target.Y)) /
                   Player.Speed;
         Player.UpdateCollisionBoxes();
         Player.State         = 1;
         Player.IsWeighted    = false;
         Player.AccelerationY = 0f;
         Player.AccelerationX = 0f;
         Player.IsCollidable  = false;
         Player.CurrentSpeed  = 0f;
         Player.LockControls();
         Player.ChangeSprite("PlayerWalking_Character");
         Player.PlayAnimation();
         var logicSet = new LogicSet(Player);
         logicSet.AddAction(new DelayLogicAction(num));
         Player.RunExternalLogicSet(logicSet);
         Tween.To(Player, num, Tween.EaseNone, "X", (target.Position.X - 150f).ToString());
         Tween.AddEndHandlerToLastTween(this, "MovePlayerComplete", target);
         return;
     }
     MovePlayerComplete(target);
 }
Exemplo n.º 8
0
        public static void Display(Vector2 position, bool horizontal, float length)
        {
            int     numEffects = (int)(length / 20);
            float   posScale   = length / numEffects;
            Vector2 posFactor  = (horizontal ? new Vector2(1f, 0f) : new Vector2(0f, -1f)) * posScale;

            lock (_defaultCommands)
                for (int i = 0; i < numEffects; i++)
                {
                    Instance.Run(position * (i + 1), x =>
                    {
                        float randScale = CDGMath.RandomFloat(0.5f, 0.8f);

                        var cmd           = _defaultCommands[1];
                        cmd.Properties[1] = CDGMath.RandomFloat(-30f, 30f).ToString();

                        cmd = _defaultCommands[2];
                        cmd.Properties[1] = CDGMath.RandomInt(-10, 10).ToString();
                        cmd.Properties[3] = CDGMath.RandomInt(-20, 0).ToString();

                        cmd = _defaultCommands[3];
                        cmd.Properties[1] = randScale.ToString();
                        cmd.Properties[3] = randScale.ToString();
                    });
                }
        }
Exemplo n.º 9
0
 public override void Update(GameTime gameTime)
 {
     if (!m_displayText && CDGMath.DistanceBetweenPts(Player.Position, m_king.Position) < 200f)
     {
         m_displayText = true;
         Tween.StopAllContaining(m_tutorialText, false);
         Tween.To(m_tutorialText, 0.5f, Tween.EaseNone, "Opacity", "1");
     }
     else if (m_displayText && CDGMath.DistanceBetweenPts(Player.Position, m_king.Position) > 200f)
     {
         m_displayText = false;
         Tween.StopAllContaining(m_tutorialText, false);
         Tween.To(m_tutorialText, 0.5f, Tween.EaseNone, "Opacity", "0");
     }
     if (Player.X > m_king.X - 100f)
     {
         Player.X = m_king.X - 100f;
     }
     if (!m_kingKilled && m_king.WasHit)
     {
         m_kingKilled = true;
         Game.ScreenManager.DisplayScreen(27, false);
     }
     base.Update(gameTime);
 }
Exemplo n.º 10
0
 private void RandomizeName()
 {
     string[] array =
     {
         "Oh god!",
         "The pain!",
         "It hurts so much",
         "STOP IT!!",
         "Training Dummy",
         "What'd I do to you?",
         "WHY???",
         "Stop hitting me",
         "Why you do this?",
         "IT HUURRRTS",
         "Oof",
         "Ouch",
         "BLARGH",
         "I give up!",
         "Do you even lift?",
         "Ok, that one hurt",
         "That tickled",
         "That all you got?",
         "Dost thou even hoist?",
         "Nice try",
         "Weak",
         "Try again"
     };
     Name = array[CDGMath.RandomInt(0, array.Length - 1)];
 }
Exemplo n.º 11
0
        private void ThrowCardinalProjectiles(LogicSet ls)
        {
            var projectileData = new ProjectileData(this)
            {
                SpriteName          = "EyeballProjectile_Sprite",
                SourceAnchor        = Vector2.Zero,
                Target              = null,
                Speed               = new Vector2(ProjectileSpeed, ProjectileSpeed),
                IsWeighted          = false,
                RotationSpeed       = 0f,
                Damage              = Damage,
                AngleOffset         = 0f,
                Scale               = ProjectileScale,
                CollidesWithTerrain = false,
                Angle               = new Vector2(0f, 0f)
            };
            var num = CDGMath.RandomPlusMinus();

            for (var i = 0; i <= 170; i += 10)
            {
                projectileData.AngleOffset = i * num;
                ls.AddAction(new FireProjectileLogicAction(m_levelScreen.ProjectileManager, projectileData));
                projectileData.AngleOffset = 90 + i * num;
                ls.AddAction(new FireProjectileLogicAction(m_levelScreen.ProjectileManager, projectileData));
                projectileData.AngleOffset = 180 + i * num;
                ls.AddAction(new FireProjectileLogicAction(m_levelScreen.ProjectileManager, projectileData));
                projectileData.AngleOffset = 270 + i * num;
                ls.AddAction(new FireProjectileLogicAction(m_levelScreen.ProjectileManager, projectileData));
                ls.AddAction(new DelayLogicAction(0.175f));
            }
            projectileData.Dispose();
        }
Exemplo n.º 12
0
        public override void Initialize()
        {
            foreach (var current in EnemyList)
            {
                if (current is EnemyObj_Fireball)
                {
                    m_boss = (current as EnemyObj_Fireball);
                }
                current.Visible = false;
                current.PauseEnemy(true);
            }
            m_boss.ChangeSprite("EnemyGhostBossIdle_Character");
            m_bossStartingScale = m_boss.ScaleX;
            m_fireList          = new List <SpriteObj>();
            var num  = 0f;
            var num2 = 24f;

            for (var i = 0; i < 15; i++)
            {
                var spriteObj = new SpriteObj("GhostBossProjectile_Sprite");
                spriteObj.PlayAnimation();
                spriteObj.OutlineWidth = 2;
                spriteObj.Position     = CDGMath.GetCirclePosition(num, 300f, m_boss.Position);
                spriteObj.Scale        = new Vector2(2f, 2f);
                num += num2;
                spriteObj.Opacity = 0f;
                m_fireList.Add(spriteObj);
                GameObjList.Add(spriteObj);
            }
            base.Initialize();
        }
Exemplo n.º 13
0
        public override void CollisionResponse(CollisionBox thisBox, CollisionBox otherBox, int collisionResponseType)
        {
            var terrainObj = otherBox.Parent as TerrainObj;

            if (terrainObj != null && !(terrainObj is DoorObj) && terrainObj.CollidesBottom && terrainObj.CollidesLeft &&
                terrainObj.CollidesRight && terrainObj.CollidesTop)
            {
                var value = CollisionMath.RotatedRectIntersectsMTD(thisBox.AbsRect, (int)thisBox.AbsRotation,
                                                                   Vector2.Zero, otherBox.AbsRect, (int)otherBox.AbsRotation, Vector2.Zero);
                if (value != Vector2.Zero)
                {
                    var heading  = Heading;
                    var vector   = new Vector2(value.Y, value.X * -1f);
                    var heading2 = 2f * (CDGMath.DotProduct(heading, vector) / CDGMath.DotProduct(vector, vector)) *
                                   vector - heading;
                    X      += value.X;
                    Y      += value.Y;
                    Heading = heading2;
                    SoundManager.Play3DSound(this, Game.ScreenManager.Player, "GiantSpike_Bounce_01",
                                             "GiantSpike_Bounce_02", "GiantSpike_Bounce_03");
                    m_selfDestructCounter++;
                    m_selfDestructTimer = 1f;
                }
            }
        }
Exemplo n.º 14
0
        public static void Display(Vector2 position, int numSprites = 30, float duration = 0.4f)
        {
            float step            = duration / numSprites;
            float currentDuration = 0f;

            lock (_defaultCommands)
                for (int i = 0; i < numSprites; i++)
                {
                    Instance.Run(new Vector2(position.X + CDGMath.RandomInt(-100, 100), position.Y + CDGMath.RandomInt(-100, 100)), x =>
                    {
                        x.Sprite.TextureColor = Color.Black;

                        var cmd      = _defaultCommands[0];
                        cmd.Duration = currentDuration;

                        cmd               = _defaultCommands[1];
                        cmd.Duration      = duration - currentDuration;
                        cmd.Properties[1] = currentDuration.ToString();
                        cmd.Properties[3] = position.X.ToString();
                        cmd.Properties[5] = position.Y.ToString();
                    });

                    currentDuration += step;
                }
        }
Exemplo n.º 15
0
        public void CastFireball()
        {
            var projectileData = new ProjectileData(this)
            {
                SpriteName          = "WizardFireballProjectile_Sprite",
                SourceAnchor        = m_spellOffset,
                Target              = m_target,
                Speed               = new Vector2(ProjectileSpeed, ProjectileSpeed),
                IsWeighted          = false,
                RotationSpeed       = 0f,
                Damage              = Damage,
                AngleOffset         = 0f,
                CollidesWithTerrain = false,
                Scale               = ProjectileScale
            };

            if (Difficulty == GameTypes.EnemyDifficulty.ADVANCED)
            {
                projectileData.AngleOffset = CDGMath.RandomInt(-25, 25);
            }
            if (Difficulty == GameTypes.EnemyDifficulty.EXPERT)
            {
                projectileData.SpriteName          = "GhostBossProjectile_Sprite";
                projectileData.CollidesWithTerrain = false;
            }
            SoundManager.Play3DSound(this, m_target, "FireWizard_Attack_01", "FireWizard_Attack_02",
                                     "FireWizard_Attack_03", "FireWizard_Attack_04");
            var projectileObj = m_levelScreen.ProjectileManager.FireProjectile(projectileData);

            projectileObj.Rotation = 0f;
            if (Difficulty != GameTypes.EnemyDifficulty.EXPERT)
            {
                Tween.RunFunction(0.15f, this, "ChangeFireballState", projectileObj);
            }
        }
Exemplo n.º 16
0
 public override void Initialize()
 {
     m_bossTitle1               = new TextObj(Game.JunicodeFont);
     m_bossTitle1.Text          = "The Forsaken";
     m_bossTitle1.OutlineWidth  = 2;
     m_bossTitle1.FontSize      = 18f;
     m_bossTitle2               = new TextObj(Game.JunicodeLargeFont);
     m_bossTitle2.Text          = "Alexander";
     m_bossTitle2.OutlineWidth  = 2;
     m_bossTitle2.FontSize      = 40f;
     m_bossDivider              = new SpriteObj("Blank_Sprite");
     m_bossDivider.OutlineWidth = 2;
     foreach (var current in DoorList)
     {
         m_roomFloor = current.Bounds.Bottom;
     }
     m_bossChest          = new ChestObj(null);
     m_bossChest.Position = new Vector2(Bounds.Center.X - m_bossChest.Width / 2f, Bounds.Center.Y);
     GameObjList.Add(m_bossChest);
     m_rainFG = new List <RaindropObj>();
     for (var i = 0; i < 50; i++)
     {
         var raindropObj =
             new RaindropObj(new Vector2(CDGMath.RandomFloat(X - Width, X), CDGMath.RandomFloat(Y, Y + Height)));
         m_rainFG.Add(raindropObj);
         raindropObj.ChangeToParticle();
     }
     base.Initialize();
 }
Exemplo n.º 17
0
        public void Update(GameTime gameTime)
        {
            var num = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (!m_silhouetteFlying && m_silhouetteTimer > 0f)
            {
                m_silhouetteTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (m_silhouetteTimer <= 0f)
                {
                    var num2 = CDGMath.RandomInt(1, 100);
                    if (num2 > 95)
                    {
                        ShowSilhouette(true);
                    }
                    else if (num2 > 65)
                    {
                        ShowSilhouette(false);
                    }
                    else
                    {
                        m_silhouetteTimer = 5f;
                    }
                }
            }
            if (!m_silhouetteFlying && m_silhouetteTimer <= 0f)
            {
                m_silhouetteTimer = 5f;
            }
            if (m_silhouette.SpriteName == "GardenPerson_Sprite")
            {
                m_silhouette.Rotation += 120f * num;
            }
        }
Exemplo n.º 18
0
        public void ShatterExpertIceball(int numIceballs)
        {
            SoundManager.Play3DSound(this, m_target, "Ice_Wizard_Attack");
            if (m_iceballSummon.SpriteName == "WizardIceSpell_Sprite")
            {
                m_iceballSummon.PlayAnimation("Grown", "End");
            }
            var projectileData = new ProjectileData(this)
            {
                SpriteName          = "WizardIceProjectile_Sprite",
                SourceAnchor        = m_spellOffset,
                Target              = null,
                Speed               = new Vector2(ProjectileSpeed, ProjectileSpeed),
                IsWeighted          = false,
                RotationSpeed       = 0f,
                Damage              = Damage,
                AngleOffset         = 0f,
                CollidesWithTerrain = false,
                Scale               = ProjectileScale
            };
            var num = 60f;

            for (var i = 0; i < numIceballs; i++)
            {
                float num2 = CDGMath.RandomInt(0, 360);
                projectileData.Angle = new Vector2(num2, num2);
                var projectileObj = m_levelScreen.ProjectileManager.FireProjectile(projectileData);
                Tween.RunFunction(0.15f, this, "ChangeIceballState", projectileObj);
                num2 += num;
            }
            projectileData.Dispose();
        }
Exemplo n.º 19
0
 public void ThrowCardinalProjectilesNeo(int startProjIndex, bool randomizeFlipper, int flipper)
 {
     if (startProjIndex < 13)
     {
         var projectileData = new ProjectileData(this)
         {
             SpriteName          = "EyeballProjectile_Sprite",
             SourceAnchor        = Vector2.Zero,
             Target              = null,
             Speed               = new Vector2(ProjectileSpeed, ProjectileSpeed),
             IsWeighted          = false,
             RotationSpeed       = 0f,
             Damage              = Damage,
             AngleOffset         = 0f,
             Scale               = ProjectileScale,
             CollidesWithTerrain = false,
             Angle               = new Vector2(0f, 0f)
         };
         if (randomizeFlipper)
         {
             flipper = CDGMath.RandomPlusMinus();
         }
         projectileData.AngleOffset = -10 + startProjIndex * 17 * flipper;
         m_levelScreen.ProjectileManager.FireProjectile(projectileData);
         projectileData.AngleOffset = 80 + startProjIndex * 17 * flipper;
         m_levelScreen.ProjectileManager.FireProjectile(projectileData);
         projectileData.AngleOffset = 170 + startProjIndex * 17 * flipper;
         m_levelScreen.ProjectileManager.FireProjectile(projectileData);
         projectileData.AngleOffset = 260 + startProjIndex * 17 * flipper;
         m_levelScreen.ProjectileManager.FireProjectile(projectileData);
         projectileData.Dispose();
         startProjIndex++;
         Tween.RunFunction(0.12f, this, "ThrowCardinalProjectilesNeo", startProjIndex, false, flipper);
     }
 }
Exemplo n.º 20
0
        public static void Display(int numEntities)
        {
            float step = 1320f / numEntities;

            lock (_defaultCommands)
                for (int i = 0; i < numEntities; i++)
                {
                    Instance.Run(new Vector2(step * i, 720f), x =>
                    {
                        x.Sprite.ForceDraw = true;

                        var cmd           = _defaultCommands[0];
                        cmd.Properties[1] = "0.8";

                        cmd = _defaultCommands[1];
                        cmd.Properties[1] = CDGMath.RandomFloat(-180f, 180f).ToString();

                        cmd = _defaultCommands[2];
                        cmd.Properties[1] = CDGMath.RandomInt(-50, 50).ToString();
                        cmd.Properties[3] = CDGMath.RandomInt(-50, 0).ToString();

                        cmd                  = _defaultCommands[3];
                        cmd.Duration         = 0.5f;
                        cmd.InitialValues[0] = 0.8f;
                    });
                }
        }
Exemplo n.º 21
0
 public override void Update(GameTime gameTime)
 {
     if (!IsPaused)
     {
         if (!IsKilled && m_initialDelayCounter <= 0f)
         {
             var num = (float)gameTime.ElapsedGameTime.TotalSeconds;
             if (m_actualChainRadius < ChainRadius)
             {
                 m_actualChainRadius += num * 200f;
                 m_chainLinkDistance  = m_actualChainRadius / m_numChainLinks;
             }
             var num2 = 0f;
             BallAndChain.Position = CDGMath.GetCirclePosition(m_ballAngle, m_actualChainRadius,
                                                               new Vector2(X, Bounds.Top));
             for (var i = 0; i < m_chainLinksList.Count; i++)
             {
                 m_chainLinksList[i] = CDGMath.GetCirclePosition(m_ballAngle, num2, new Vector2(X, Bounds.Top));
                 num2 += m_chainLinkDistance;
             }
             num2 = 0f;
             if (Difficulty == GameTypes.EnemyDifficulty.ADVANCED)
             {
                 BallAndChain2.Position = CDGMath.GetCirclePosition(m_ballAngle * ChainSpeed2Modifier,
                                                                    m_actualChainRadius / 2f, new Vector2(X, Bounds.Top));
             }
             else if (Difficulty == GameTypes.EnemyDifficulty.EXPERT)
             {
                 BallAndChain2.Position = CDGMath.GetCirclePosition(-m_ballAngle * ChainSpeed2Modifier,
                                                                    -m_actualChainRadius / 2f, new Vector2(X, Bounds.Top));
             }
             for (var j = 0; j < m_chainLinks2List.Count; j++)
             {
                 if (Difficulty == GameTypes.EnemyDifficulty.ADVANCED)
                 {
                     m_chainLinks2List[j] = CDGMath.GetCirclePosition(m_ballAngle * ChainSpeed2Modifier, num2,
                                                                      new Vector2(X, Bounds.Top));
                 }
                 else if (Difficulty == GameTypes.EnemyDifficulty.EXPERT)
                 {
                     m_chainLinks2List[j] = CDGMath.GetCirclePosition(-m_ballAngle * ChainSpeed2Modifier, -num2,
                                                                      new Vector2(X, Bounds.Top));
                 }
                 num2 += m_chainLinkDistance;
             }
             m_ballAngle += ChainSpeed * 60f * num;
             if (!IsAnimating && CurrentSpeed != 0f)
             {
                 PlayAnimation();
             }
         }
         if (SpriteName == "EnemyFlailKnight_Character")
         {
             m_walkSound.Update();
             m_walkSound2.Update();
         }
     }
     base.Update(gameTime);
 }
Exemplo n.º 22
0
 public static void Display(Vector2 position)
 {
     lock (_defaultTweens)
         Instance.Run(position, x =>
         {
             x.TweenCommands[1].Properties[1] = CDGMath.RandomInt(-45, 45).ToString();
         });
 }
Exemplo n.º 23
0
 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");
 }
Exemplo n.º 24
0
        protected override EffectSpriteInstance CreateSprite(Vector2 position)
        {
            var sprite = base.CreateSprite(position);

            sprite.Position = CDGMath.GetCirclePosition(sprite.Rotation - 90f, 20f, sprite.Position);

            return(sprite);
        }
Exemplo n.º 25
0
 new public static void Display(Vector2 position, int numEffects = 10)
 {
     lock (_defaultTweens)
         for (int i = 0; i < numEffects; i++)
         {
             Instance.Run(new Vector2(position.X + CDGMath.RandomInt(-30, 30), position.Y + CDGMath.RandomInt(-30, 30)), Initialize);
         }
 }
Exemplo n.º 26
0
 public void AnimateJukebox()
 {
     Tween.To(m_jukeBox, 0.2f, Tween.EaseNone, "ScaleY", "2.9", "ScaleX", "3.1", "Rotation", "0");
     Tween.AddEndHandlerToLastTween(this, "AnimateJukebox2");
     Player.AttachedLevel.ImpactEffectPool.DisplayMusicNote(
         new Vector2(m_jukeBox.Bounds.Center.X + CDGMath.RandomInt(-20, 20),
                     m_jukeBox.Bounds.Top + CDGMath.RandomInt(0, 20)));
 }
Exemplo n.º 27
0
        public void TurnToPlayer()
        {
            var turnSpeed = TurnSpeed;

            TurnSpeed = 2f;
            CDGMath.TurnToFace(this, m_target.Position);
            TurnSpeed = turnSpeed;
        }
Exemplo n.º 28
0
        public void ItemSpinAnimation3()
        {
            var scale = m_itemSprite.Scale;

            m_itemSprite.Scale = Vector2.One;
            var num = 130f / m_itemSprite.Height;

            m_itemSprite.Scale = scale;
            Tween.To(m_itemSprite, 0.2f, Tween.EaseNone, "ScaleX", num.ToString(), "ScaleY", num.ToString());
            Tween.To(m_itemSprite, 0.2f, Tween.EaseNone, "X", 660.ToString(), "Y", 390.ToString());
            Tween.To(m_itemFoundText, 0.3f, Back.EaseOut, "ScaleX", "1", "ScaleY", "1");
            Tween.To(m_continueText, 0.3f, Linear.EaseNone, "Opacity", "1");
            scale             = m_tripStat1.Scale;
            m_tripStat1.Scale = Vector2.One;
            num = 130f / m_tripStat1.Height;
            m_tripStat1.Scale = scale;
            Tween.To(m_tripStat1, 0.2f, Tween.EaseNone, "ScaleX", num.ToString(), "ScaleY", num.ToString());
            Tween.To(m_tripStat1, 0.2f, Tween.EaseNone, "X", 830.ToString(), "Y", 390.ToString());
            scale             = m_tripStat2.Scale;
            m_tripStat2.Scale = Vector2.One;
            num = 130f / m_tripStat2.Height;
            m_tripStat2.Scale = scale;
            Tween.To(m_tripStat2, 0.2f, Tween.EaseNone, "ScaleX", num.ToString(), "ScaleY", num.ToString());
            Tween.To(m_tripStat2, 0.2f, Tween.EaseNone, "X", 490.ToString(), "Y", 390.ToString());
            Tween.To(m_tripStat1FoundText, 0.3f, Back.EaseOut, "ScaleX", "1", "ScaleY", "1");
            Tween.To(m_tripStat2FoundText, 0.3f, Back.EaseOut, "ScaleX", "1", "ScaleY", "1");
            for (var i = 0; i < m_levelUpParticles.Length; i++)
            {
                m_levelUpParticles[i].AnimationDelay = 0f;
                m_levelUpParticles[i].Visible        = true;
                m_levelUpParticles[i].Scale          = new Vector2(0.1f, 0.1f);
                m_levelUpParticles[i].Opacity        = 0f;
                m_levelUpParticles[i].Position       = new Vector2(660f, 360f);
                m_levelUpParticles[i].Position      += new Vector2(CDGMath.RandomInt(-100, 100), CDGMath.RandomInt(-50, 50));
                var duration = CDGMath.RandomFloat(0f, 0.5f);
                Tween.To(m_levelUpParticles[i], 0.2f, Linear.EaseNone, "delay", duration.ToString(), "Opacity", "1");
                Tween.To(m_levelUpParticles[i], 0.5f, Linear.EaseNone, "delay", duration.ToString(), "ScaleX", "2",
                         "ScaleY", "2");
                Tween.To(m_levelUpParticles[i], duration, Linear.EaseNone);
                Tween.AddEndHandlerToLastTween(m_levelUpParticles[i], "PlayAnimation", false);
            }
            m_itemFoundSprite.Position = new Vector2(660f, 190f);
            m_itemFoundSprite.Scale    = Vector2.Zero;
            m_itemFoundSprite.Visible  = true;
            Tween.To(m_itemFoundSprite, 0.5f, Back.EaseOut, "delay", "0.05", "ScaleX", "1", "ScaleY", "1");
            m_levelUpBGImage.Position = m_itemFoundSprite.Position;
            m_levelUpBGImage.Y       += 30f;
            m_levelUpBGImage.Scale    = Vector2.Zero;
            m_levelUpBGImage.Visible  = true;
            Tween.To(m_levelUpBGImage, 0.5f, Back.EaseOut, "ScaleX", "1", "ScaleY", "1");
            Tween.To(this, 0.5f, Linear.EaseNone, "BackBufferOpacity", "0.5");
            if (m_itemSpinning)
            {
                m_itemSprite.Rotation = -25f;
            }
            m_itemSpinning = false;
            Tween.RunFunction(0.5f, this, "UnlockControls");
        }
Exemplo n.º 29
0
 public static void RandomIntro(TextObj textObj, int wordWrap = 0)
 {
     textObj.Text = intro[CDGMath.RandomInt(0, intro.Length - 1)] +
                    middle[CDGMath.RandomInt(0, middle.Length - 1)] + end[CDGMath.RandomInt(0, end.Length - 1)];
     if (wordWrap > 0)
     {
         textObj.WordWrap(wordWrap);
     }
 }
Exemplo n.º 30
0
        public void SwitchRandomType()
        {
            byte b;

            for (b = m_currentAttackType; b == m_currentAttackType; b = (byte)CDGMath.RandomInt(0, 2))
            {
            }
            SwitchType(b);
        }