示例#1
0
文件: AtField.cs 项目: sinshu/chaos
 public override void Tick(GameInput input)
 {
     if (parent.Removed)
     {
         Remove();
         return;
     }
     if (energy > 0)
     {
         energy--;
     }
     else
     {
         parent.AtFieldBroken();
         Remove();
         return;
     }
     if (direction == Direction.Left)
     {
         position = parent.Center + new Vector(-32 - 16, -64);
     }
     else
     {
         position = parent.Center + new Vector(32 - 16, -64);
     }
     animation = (animation + 1) % NUM_ANIMATIONS;
     if (health < previousHealth)
     {
         game.PlaySound(GameSound.AtField);
     }
     previousHealth = health;
 }
示例#2
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                StopMusic();
            }
            else if (Ticks == 60)
            {
                PlayMusic(GameMusic.Boss2);
            }

            base.Tick(input);

            if (Items.Count == 0 && Ticks % 180 == 90 && (Player.CurrentWeapon == Player.Weapon.Pistol || (Player.CurrentWeapon == Player.Weapon.Rocket && Player.Ammo <= 25) || (Player.CurrentWeapon == Player.Weapon.Machinegun && Player.Ammo <= 100) || (oyaji.CurrentState == Oyaji.State.Pattern2_5 && Player.CurrentWeapon == Player.Weapon.Rocket)))
            {
                if (oyaji.CurrentState == Oyaji.State.Pattern2_5 || Random.Next(0, 2) == 0)
                {
                    Items.AddThing(new MachinegunItem(this, new Vector(160 + Random.NextDouble() * (Map.Width - 320 - 32), 32), Vector.Zero));
                }
                else
                {
                    Items.AddThing(new RocketItem(this, new Vector(160 + Random.NextDouble() * (Map.Width - 320 - 32), 32), Vector.Zero));
                }
            }
        }
示例#3
0
文件: Kyoro.cs 项目: sinshu/chaos
 public override void Blodked_Left(GameInput input)
 {
     if (!playerDetected)
     {
         direction = Direction.Right;
     }
 }
示例#4
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                StopMusic();
            }
            else if (Ticks == 60)
            {
                PlayMusic(GameMusic.Boss1);
            }

            base.Tick(input);

            int targetColorCount = 256 - (int)Math.Round(256.0 * (double)(boss.Health - 500) / (double)(initBossHealth - 500));
            if (targetColorCount < 0) targetColorCount = 0;
            else if (targetColorCount > 255) targetColorCount = 255;
            if (skyColorCount < targetColorCount && Ticks % 4 == 0)
            {
                skyColorCount++;
            }

            if (Items.Count == 0 && Ticks % 180 == 90 && (Player.CurrentWeapon == Player.Weapon.Pistol || (Player.CurrentWeapon == Player.Weapon.Machinegun && Player.Ammo <= 50)))
            {
                Items.AddThing(new MachinegunItem(this, new Vector(32 + Random.NextDouble() * (Map.Width - 96), 32), Vector.Zero));
            }
        }
示例#5
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                StopMusic();
            }
            else if (Ticks == 60)
            {
                PlayMusic(GameMusic.Boss1);
            }

            base.Tick(input);

            if (Items.Count == 0 && Ticks % 180 == 90 && (Player.CurrentWeapon == Player.Weapon.Pistol || (Player.CurrentWeapon == Player.Weapon.Rocket && Player.Ammo <= 15) || (Player.CurrentWeapon == Player.Weapon.Machinegun && Player.Ammo <= 50)))
            {
                if (Random.Next(0, 2) == 0)
                {
                    Items.AddThing(new MachinegunItem(this, new Vector(32 + Random.NextDouble() * (Map.Width - 96), 32), Vector.Zero));
                }
                else
                {
                    Items.AddThing(new RocketItem(this, new Vector(32 + Random.NextDouble() * (Map.Width - 96), 32), Vector.Zero));
                }
            }
        }
示例#6
0
文件: ThingList.cs 项目: sinshu/chaos
 public void Tick(GameInput input)
 {
     foreach (Thing thing in things)
     {
         thing.Tick(input);
     }
 }
示例#7
0
文件: Item.cs 项目: sinshu/chaos
 public override void Tick(GameInput input)
 {
     velocity.Y += ACCELERATION_FALLING;
     if (velocity.Y > MAX_FALLING_SPEED)
     {
         velocity.Y = MAX_FALLING_SPEED;
     }
     MoveBy(input, velocity);
 }
示例#8
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                PlayMusic(GameMusic.Stage2);
            }

            base.Tick(input);
        }
示例#9
0
文件: Starman.cs 项目: sinshu/chaos
 public override void Blodked_Left(GameInput input)
 {
     double dx = game.Player.Center.X - Center.X;
     double dy = game.Player.Center.Y - Center.Y;
     if (!attacking && !(Math.Abs(dx) < 320 && Math.Abs(dy) < 128))
     {
         direction = Direction.Right;
     }
 }
示例#10
0
文件: ItemEnemy.cs 项目: sinshu/chaos
 public override void Blocked_Bottom(GameInput input)
 {
     base.Blocked_Top(input);
     velocity.X = 0;
     if (jumping)
     {
         jumping = false;
         animation = 0;
     }
 }
示例#11
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                StopMusic();
            }
            else if (Ticks == 60)
            {
                PlayMusic(GameMusic.Boss1);
            }

            base.Tick(input);
        }
示例#12
0
文件: BossRobot.cs 项目: sinshu/chaos
 public override void Blocked_Bottom(GameInput input)
 {
     if (currentState == State.Jump)
     {
         velocity = Vector.Zero;
         attackCount = 8;
         attackCount2 = 0;
         jumpCount = 0;
         currentState = State.Attack;
         game.Quake(6);
         game.PlaySound(GameSound.Hammer);
     }
 }
示例#13
0
文件: Starman.cs 项目: sinshu/chaos
 public override void Blocked_Bottom(GameInput input)
 {
     double dx = game.Player.Center.X - Center.X;
     double dy = game.Player.Center.Y - Center.Y;
     velocity = Vector.Zero;
     if (jumping)
     {
         jumping = false;
         jumpCount = game.Random.Next(30, 60);
         if (Math.Abs(dx) < 320 && Math.Abs(dy) < 96)
         {
             attacking = true;
         }
     }
 }
示例#14
0
文件: Oyaji.cs 项目: sinshu/chaos
 public void DeathTick(GameInput input)
 {
     if (numDeathTicks < 256)
     {
         if (numDeathTicks == 0)
         {
             game.EnemyBullets.BreakAll();
             game.StopMusic();
         }
         if (numDeathTicks % 8 == 0)
         {
             DoSomeExplode();
             leftEggMachine.DoSomeExplode();
             rightEggMachine.DoSomeExplode();
             game.Quake(4);
             game.PlaySound(GameSound.Shotgun);
             damageFlash = 256;
         }
         if (numDeathTicks % 16 == 0)
         {
             game.Flash(16);
         }
         numDeathTicks++;
     }
     else
     {
         for (int i = 0; i < 4; i++)
         {
             game.AddParticle(new BigExplosion(game, new Vector(Center.X - 48, Top + 0.125 * (Bottom - Top) + 0.25 * i * (Bottom - Top)), Vector.Zero));
         }
         for (int i = 0; i < 5; i++)
         {
             game.AddParticle(new BigExplosion(game, new Vector(Center.X, Top + 0.25 * i * (Bottom - Top)), Vector.Zero));
         }
         for (int i = 0; i < 4; i++)
         {
             game.AddParticle(new BigExplosion(game, new Vector(Center.X + 48, Top + 0.125 * (Bottom - Top) + 0.25 * i * (Bottom - Top)), Vector.Zero));
         }
         leftEggMachine.Die();
         rightEggMachine.Die();
         game.Quake(16);
         game.Flash(128);
         game.PlaySound(GameSound.Explode);
         SpreadDebris(64);
         Remove();
     }
 }
示例#15
0
文件: Enemy.cs 项目: sinshu/chaos
 public override void MoveBy_Up(GameInput input, double d)
 {
     position.Y += d;
     int leftCol = LeftCol;
     int rightCol = RightCol;
     int topRow = TopRow;
     Map map = game.Map;
     for (int col = leftCol; col <= rightCol; col++)
     {
         if (map.IsObstacleForEnemy(topRow, col, this))
         {
             Top = (topRow + 1) * Settings.BLOCK_WDITH;
             Blocked_Top(input);
             break;
         }
     }
 }
示例#16
0
文件: Enemy.cs 项目: sinshu/chaos
 public override void MoveBy_Right(GameInput input, double d)
 {
     position.X += d;
     int topRow = TopRow;
     int bottomRow = BottomRow;
     int rightCol = RightCol;
     Map map = game.Map;
     for (int row = topRow; row <= bottomRow; row++)
     {
         if (map.IsObstacleForEnemy(row, rightCol, this))
         {
             Right = rightCol * Settings.BLOCK_WDITH;
             Blocked_Right(input);
             break;
         }
     }
 }
示例#17
0
文件: Enemy.cs 项目: sinshu/chaos
 public override void MoveBy_Left(GameInput input, double d)
 {
     position.X += d;
     int topRow = TopRow;
     int bottomRow = BottomRow;
     int leftCol = LeftCol;
     Map map = game.Map;
     for (int row = topRow; row <= bottomRow; row++)
     {
         if (map.IsObstacleForEnemy(row, leftCol, this))
         {
             Left = (leftCol + 1) * Settings.BLOCK_WDITH;
             Blodked_Left(input);
             break;
         }
     }
 }
示例#18
0
文件: Enemy.cs 项目: sinshu/chaos
 public override void MoveBy_Down(GameInput input, double d)
 {
     position.Y += d;
     int leftCol = LeftCol;
     int rightCol = RightCol;
     int bottomRow = BottomRow;
     Map map = game.Map;
     for (int col = leftCol; col <= rightCol; col++)
     {
         if (map.IsObstacleForEnemy(bottomRow, col, this))
         {
             Bottom = bottomRow * Settings.BLOCK_WDITH;
             Blocked_Bottom(input);
             break;
         }
     }
 }
示例#19
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                PlayMusic(GameMusic.Stage2);
            }

            base.Tick(input);

            int targetColorCount = (int)Math.Round(256.0 * (double)Enemies.Count / (double)initEnemyCount);
            if (targetColorCount < 0) targetColorCount = 0;
            else if (targetColorCount > 255) targetColorCount = 255;
            if (targetColorCount < skyColorCount && Ticks % 4 == 0)
            {
                skyColorCount--;
            }
        }
示例#20
0
 public void DeathTick(GameInput input)
 {
     if (numDeathTicks < 128)
     {
         if (numDeathTicks == 0)
         {
             game.Enemies.KillAll();
             game.EnemyBullets.BreakAll();
             game.StopMusic();
         }
         if (numDeathTicks % 8 == 0)
         {
             DoSomeExplode();
             game.Quake(4);
             game.PlaySound(GameSound.Shotgun);
             damageFlash = 256;
         }
         if (numDeathTicks % 16 == 0)
         {
             game.Flash(16);
         }
         numDeathTicks++;
     }
     else
     {
         for (int i = 0; i < 4; i++)
         {
             game.AddParticle(new BigExplosion(game, new Vector(Center.X - 48, Top + 0.125 * (Bottom - Top) + 0.25 * i * (Bottom - Top) - 16), Vector.Zero));
         }
         for (int i = 0; i < 5; i++)
         {
             game.AddParticle(new BigExplosion(game, new Vector(Center.X, Top + 0.25 * i * (Bottom - Top) - 16), Vector.Zero));
         }
         for (int i = 0; i < 4; i++)
         {
             game.AddParticle(new BigExplosion(game, new Vector(Center.X + 48, Top + 0.125 * (Bottom - Top) + 0.25 * i * (Bottom - Top) - 16), Vector.Zero));
         }
         game.Quake(16);
         game.Flash(128);
         game.PlaySound(GameSound.Explode);
         SpreadDebris(64);
         game.Items.AddThing(new HealthItem(game, new Vector(32 + game.Random.NextDouble() * (game.Map.Width - 96), 32), Vector.Zero));
         Remove();
     }
 }
示例#21
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                PlayMusic(GameMusic.Stage3);
            }

            base.Tick(input);

            int targetColorCount = (int)Math.Round(256.0 * (Map.Height - Player.Center.Y) / Map.Height);
            if (targetColorCount < 0) targetColorCount = 0;
            else if (targetColorCount > 255) targetColorCount = 255;
            if (Ticks % 4 == 0)
            {
                if (skyColorCount < targetColorCount) skyColorCount++;
                else if (skyColorCount > targetColorCount) skyColorCount--;
            }
        }
示例#22
0
 public override void Blocked_Bottom(GameInput input)
 {
     velocity = Vector.Zero;
     if (attackJump)
     {
         for (int i = 0; i < 5; i++)
         {
             game.AddEnemyBullet(new BaboBullet(game, position + new Vector(32, 56), new Vector(8 * game.Random.NextDouble() - 4, 8 * game.Random.NextDouble() - 16)));
         }
         game.AddParticle(new BaboBulletExplosion(game, position + new Vector(32, 64), Vector.Zero));
         game.Quake(4);
         animation = 0;
     }
     if (normalJump)
     {
         animation = 0;
     }
     canJump    = true;
     attackJump = false;
     normalJump = false;
 }
示例#23
0
文件: Babo.cs 项目: sinshu/chaos
 public override void Blocked_Bottom(GameInput input)
 {
     velocity = Vector.Zero;
     if (attackJump)
     {
         for (int i = 0; i < 5; i++)
         {
             game.AddEnemyBullet(new BaboBullet(game, position + new Vector(32, 56), new Vector(8 * game.Random.NextDouble() - 4, 8 * game.Random.NextDouble() - 16)));
         }
         game.AddParticle(new BaboBulletExplosion(game, position + new Vector(32, 64), Vector.Zero));
         game.Quake(4);
         animation = 0;
     }
     if (normalJump)
     {
         animation = 0;
     }
     canJump = true;
     attackJump = false;
     normalJump = false;
 }
示例#24
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                PlayMusic(GameMusic.Stage2);
            }

            base.Tick(input);
            if (Ticks % 120 == 0)
            {
                AddBackgroundParticle(new Hanabi(this, new Vector(1024 * Random.NextDouble(), 256 * Random.NextDouble()), Random.Next(0, 4) == 0, HANABI_COLOR_INDEX[Random.Next(0, HANABI_COLOR_INDEX.Length)]));
            }

            int targetColorCount = (int)Math.Round(256.0 * (double)Enemies.Count / (double)initEnemyCount);
            if (targetColorCount < 0) targetColorCount = 0;
            else if (targetColorCount > 255) targetColorCount = 255;
            if (targetColorCount < skyColorCount && Ticks % 4 == 0)
            {
                skyColorCount--;
            }
        }
示例#25
0
        public override void Tick(GameInput input)
        {
            if (stateCount > 0)
            {
                stateCount--;
            }
            if (stateCount == 0)
            {
                running    = !running;
                stateCount = game.Random.Next(30, 60);
            }

            if (running)
            {
                if (direction == Direction.Left)
                {
                    velocity.X = -4;
                }
                else
                {
                    velocity.X = 4;
                }
                animation = (animation + 1) % 8;
            }
            else
            {
                velocity.X = 0;
                animation  = 0;
            }

            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#26
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                PlayMusic(GameMusic.Stage5);
            }

            base.Tick(input);

            if (Enemies.Count == 0)
            {
                spawnMafia = true;
            }
            if (spawnMafia)
            {
                if (mafiaCount > 0 && Ticks % 60 == 30)
                {
                    AddEnemy(new Mafia(this, 55, 1, Mafia.Direction.Right));
                    mafiaCount--;
                }
            }
        }
示例#27
0
文件: Mafia.cs 项目: sinshu/chaos
        public override void Tick(GameInput input)
        {
            if (stateCount > 0)
            {
                stateCount--;
            }
            if (stateCount == 0)
            {
                running = !running;
                stateCount = game.Random.Next(30, 60);
            }

            if (running)
            {
                if (direction == Direction.Left)
                {
                    velocity.X = -4;
                }
                else
                {
                    velocity.X = 4;
                }
                animation = (animation + 1) % 8;
            }
            else
            {
                velocity.X = 0;
                animation = 0;
            }

            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#28
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                PlayMusic(GameMusic.Stage5);
            }

            base.Tick(input);

            if (Enemies.Count == 0)
            {
                spawnMafia = true;
            }
            if (spawnMafia)
            {
                if (mafiaCount > 0 && Ticks % 60 == 30)
                {
                    AddEnemy(new Mafia(this, 55, 1, Mafia.Direction.Right));
                    mafiaCount--;
                }
            }
        }
示例#29
0
文件: Player.cs 项目: tamutamu/chaos
        public override void MoveBy_Down(GameInput input, double d)
        {
            position.Y += d;
            int leftCol   = LeftCol;
            int rightCol  = RightCol;
            int bottomRow = BottomRow;
            Map map       = game.Map;

            for (int col = leftCol; col <= rightCol; col++)
            {
                if (map.IsObstacle(bottomRow, col))
                {
                    Bottom = bottomRow * Settings.BLOCK_WDITH;
                    Blocked_Bottom(input);
                    break;
                }
            }
            foreach (Thing enemy in game.Enemies)
            {
                if (Overlappes(enemy, this) && enemy.Shootable)
                {
                    if (enemy.Center.X < Center.X)
                    {
                        velocity.X = 8;
                    }
                    else if (Center.X < enemy.Center.X)
                    {
                        velocity.X = -8;
                    }
                    else
                    {
                        velocity.X = game.Random.Next(0, 2) == 0 ? 8 : -8;
                    }
                    EnemyDamage(enemy);
                }
            }
        }
示例#30
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                StopMusic();
            }
            else if (Ticks == 60)
            {
                PlayMusic(GameMusic.Boss1);
            }

            base.Tick(input);
            if (!boss.Removed)
            {
                if (boss.BossHealth > 1000)
                {
                    if (Ticks % 30 == 0)
                    {
                        AddBackgroundParticle(new Hanabi(this, new Vector(1024 * Random.NextDouble(), 256 * Random.NextDouble()), Random.Next(0, 4) == 0, HANABI_COLOR_INDEX[Random.Next(0, HANABI_COLOR_INDEX.Length)]));
                    }
                }
                else
                {
                    if (Ticks % 10 == 0)
                    {
                        AddBackgroundParticle(new Hanabi(this, new Vector(1024 * Random.NextDouble(), 256 * Random.NextDouble()), Random.Next(0, 4) == 0, HANABI_COLOR_INDEX[Random.Next(0, HANABI_COLOR_INDEX.Length)]));
                    }
                }
            }
            else
            {
                if (Ticks % 120 == 0)
                {
                    AddBackgroundParticle(new Hanabi(this, new Vector(1024 * Random.NextDouble(), 256 * Random.NextDouble()), Random.Next(0, 4) == 0, HANABI_COLOR_INDEX[Random.Next(0, HANABI_COLOR_INDEX.Length)]));
                }
            }
        }
示例#31
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                StopMusic();
            }
            else if (Ticks == 60)
            {
                PlayMusic(GameMusic.Boss1);
            }

            base.Tick(input);
            if (!boss.Removed)
            {
                if (boss.BossHealth > 1000)
                {
                    if (Ticks % 30 == 0)
                    {
                        AddBackgroundParticle(new Hanabi(this, new Vector(1024 * Random.NextDouble(), 256 * Random.NextDouble()), Random.Next(0, 4) == 0, HANABI_COLOR_INDEX[Random.Next(0, HANABI_COLOR_INDEX.Length)]));
                    }
                }
                else
                {
                    if (Ticks % 10 == 0)
                    {
                        AddBackgroundParticle(new Hanabi(this, new Vector(1024 * Random.NextDouble(), 256 * Random.NextDouble()), Random.Next(0, 4) == 0, HANABI_COLOR_INDEX[Random.Next(0, HANABI_COLOR_INDEX.Length)]));
                    }
                }
            }
            else
            {
                if (Ticks % 120 == 0)
                {
                    AddBackgroundParticle(new Hanabi(this, new Vector(1024 * Random.NextDouble(), 256 * Random.NextDouble()), Random.Next(0, 4) == 0, HANABI_COLOR_INDEX[Random.Next(0, HANABI_COLOR_INDEX.Length)]));
                }
            }
        }
示例#32
0
        public override void Tick(GameInput input)
        {
            if (Ticks == 0)
            {
                PlayMusic(GameMusic.Stage1);
            }

            base.Tick(input);

            int targetColorCount = 256 - (int)Math.Round(256.0 * (double)Enemies.Count / (double)initEnemyCount);

            if (targetColorCount < 0)
            {
                targetColorCount = 0;
            }
            else if (targetColorCount > 255)
            {
                targetColorCount = 255;
            }
            if (skyColorCount < targetColorCount && Ticks % 4 == 0)
            {
                skyColorCount++;
            }
        }
示例#33
0
        public override void Tick(GameInput input)
        {
            if (attackCount2 > 0)
            {
                attackCount2--;
            }

            double dx = game.Player.Center.X - Center.X;
            double dy = game.Player.Center.Y - Center.Y;

            playerDetected = false;
            if (attacking)
            {
                velocity.X = 0;
                if (attackCount < 32)
                {
                    if (attackCount == 0)
                    {
                        game.PlaySound(GameSound.Kue);
                    }
                    attackCount++;
                    if (attackCount == 16)
                    {
                        Vector posFix;
                        if (direction == Direction.Left)
                        {
                            posFix = new Vector(16, 16);
                        }
                        else
                        {
                            posFix = new Vector(48, 16);
                        }
                        game.AddEnemyBullet(new KyoroRocket(game, position + posFix, direction == Direction.Left ? 180 + 15 : -15));
                        game.PlaySound(GameSound.Rocket);
                        playerRange = game.Random.Next(128, 320);
                    }
                }
                if (attackCount >= 32)
                {
                    attacking   = false;
                    attackCount = 0;
                }
                playerDetected = true;
                animation      = 0;
            }
            else if (Math.Abs(dx) < 320 && Math.Abs(dy) < 128)
            {
                playerDetected = true;
                if (dx < 0)
                {
                    direction = Direction.Left;
                }
                else if (dx > 0)
                {
                    direction = Direction.Right;
                }

                if (attackCount2 == 0)
                {
                    attacking    = true;
                    attackCount2 = game.Random.Next(60, 120);
                }
                else
                {
                    if (Math.Abs(Math.Abs(dx) - playerRange) < 4)
                    {
                        velocity.X = 0;
                        animation  = 0;
                    }
                    else if (Math.Abs(dx) < playerRange)
                    {
                        if (dx < 0)
                        {
                            velocity.X = 1;
                        }
                        else if (dx > 0)
                        {
                            velocity.X = -1;
                        }
                        animation = (animation + 1) % NUM_ANIMATIONS;
                    }
                    else
                    {
                        if (dx < 0)
                        {
                            velocity.X = -1;
                        }
                        else if (dx > 0)
                        {
                            velocity.X = 1;
                        }
                        animation = (animation + 1) % NUM_ANIMATIONS;
                    }
                }
            }
            else
            {
                if (direction == Direction.Left)
                {
                    velocity.X = -1;
                }
                else
                {
                    velocity.X = 1;
                }
                animation = (animation + 1) % NUM_ANIMATIONS;
            }
            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);

            base.Tick(input);

            // Console.Write(attackCount + ",");
        }
示例#34
0
        public override void Tick(GameInput input)
        {
            double dx = game.Player.Center.X - Center.X;
            double dy = game.Player.Center.Y - Center.Y;

            if (Math.Abs(dx) < 320 && Math.Abs(dy) < 128 && !attacking)
            {
                if (dx < 0)
                {
                    direction = Direction.Left;
                }
                else if (dx > 0)
                {
                    direction = Direction.Right;
                }
            }

            if (jumpCount > 0)
            {
                jumpCount--;
            }
            if (jumpCount == 0)
            {
                if (!jumping && !attacking)
                {
                    jumping = true;
                    if (Math.Abs(dx) < 320 && Math.Abs(dy) < 128)
                    {
                        double dx2 = dx - Math.Sign(dx) * attackRange;
                        if (Math.Abs(dx2) < 4)
                        {
                            velocity.X = 0;
                        }
                        else if (dx2 < 0)
                        {
                            velocity.X = -2;
                        }
                        else
                        {
                            velocity.X = 2;
                        }
                    }
                    else
                    {
                        if (direction == Direction.Left)
                        {
                            velocity.X = -2;
                        }
                        else
                        {
                            velocity.X = 2;
                        }
                    }
                    velocity.Y = -4 * game.Random.NextDouble() - 8;
                }
            }

            if (jumping)
            {
                animation = 3;
            }
            else
            {
                animation = 0;
            }

            if (attacking)
            {
                if (waveAttack)
                {
                    if (attackCount < 128)
                    {
                        if (attackCount == 0)
                        {
                            game.PlaySound(GameSound.Flame);
                        }
                        if (attackCount < 32)
                        {
                            animation = attackCount / 2 % 3;
                        }
                        else if (attackCount < 96)
                        {
                            if (attackCount % 2 == 0)
                            {
                                if (direction == Direction.Left)
                                {
                                    game.AddEnemyBullet(new StarmanBullet(game, Center + new Vector(-8, -16), direction, waveX));
                                }
                                else
                                {
                                    game.AddEnemyBullet(new StarmanBullet(game, Center + new Vector(8, -16), direction, waveX));
                                }
                            }
                            animation = attackCount % 3;
                        }
                        else
                        {
                            animation = attackCount / 2 % 3;
                        }
                        attackCount++;
                    }
                    if (attackCount == 128)
                    {
                        attacking   = false;
                        attackCount = 0;
                        attackRange = game.Random.Next(128, 256);
                        waveX       = 2 * Math.PI * game.Random.NextDouble();
                        waveAttack  = game.Random.Next(0, 2) == 0;
                    }
                }
                else
                {
                    if (attackCount < 64)
                    {
                        if (attackCount < 16)
                        {
                        }
                        else if (attackCount < 64 && attackCount % 32 == 0)
                        {
                            if (direction == Direction.Left)
                            {
                                game.AddParticle(new BigExplosion(game, position + new Vector(0, 44), Vector.Zero));
                                for (int i = 0; i < 9; i++)
                                {
                                    game.AddEnemyBullet(new PlayerBullet(game, position + new Vector(0, 44), 176 + i, true));
                                }
                            }
                            else
                            {
                                game.AddParticle(new BigExplosion(game, position + new Vector(96, 44), Vector.Zero));
                                for (int i = 0; i < 9; i++)
                                {
                                    game.AddEnemyBullet(new PlayerBullet(game, position + new Vector(96, 44), -4 + i, true));
                                }
                            }
                            game.PlaySound(GameSound.Explode2);
                        }
                        attackCount++;
                    }
                    if (attackCount == 64)
                    {
                        attacking   = false;
                        attackCount = 0;
                        attackRange = game.Random.Next(128, 256);
                        waveX       = 2 * Math.PI * game.Random.NextDouble();
                        waveAttack  = game.Random.Next(0, 2) == 0;
                    }
                }
            }

            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#35
0
 public override void Blocked_Right(GameInput input)
 {
     direction = Direction.Left;
 }
示例#36
0
文件: TestEnemy.cs 项目: sinshu/chaos
        public override void Tick(GameInput input)
        {
            if (direction == Direction.Left)
            {
                velocity.X = -2;
            }
            else
            {
                velocity.X = 2;
            }
            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);
            animation = (animation + 1) % NUM_ANIMATIONS;

            base.Tick(input);
        }
示例#37
0
 public virtual void Blocked_Top(GameInput input)
 {
     velocity.Y = 0;
 }
示例#38
0
 public virtual void Blodked_Left(GameInput input)
 {
     velocity.X = 0;
 }
示例#39
0
        public override void Tick(GameInput input)
        {
            Player player = game.Player;
            double playerRange;
            double dx = 1 * (player.Center.X - Center.X);
            double dy = 2 * (player.Center.Y - Center.Y);

            playerRange = dx * dx + dy * dy;
            if (playerRange < 256 * 256 && ((direction == Direction.Left && dx < 0) || (direction == Direction.Right && dx > 0)))
            {
                if (currentState != State.Attack)
                {
                    currentState = State.Attack;
                }
            }
            else if (playerRange < 512 * 512)
            {
                currentState = State.Move;
            }
            else
            {
                currentState = State.Sleep;
            }



            if (currentState == State.Sleep || currentState == State.Move)
            {
                if (openCount > -1)
                {
                    openCount--;
                }
            }
            else if (currentState == State.Attack)
            {
                if (openCount < 15)
                {
                    if (openCount == 12)
                    {
                        game.PlaySound(GameSound.Hi1);
                    }
                    openCount++;
                }
            }

            if (openCount == -1)
            {
                if (dx < 0)
                {
                    direction = Direction.Left;
                }
                else if (dx > 0)
                {
                    direction = Direction.Right;
                }
            }
            else
            {
                velocity.X = 0;
            }

            switch (currentState)
            {
            case State.Sleep:
                if (openCount == -1)
                {
                    velocity.X = 0;
                    animation  = 0;
                }
                break;

            case State.Move:
                if (openCount == -1)
                {
                    if (Math.Abs(dx) < 0.5)
                    {
                        velocity.X = dx;
                    }
                    else
                    {
                        if (direction == Direction.Left)
                        {
                            velocity.X = -0.5;
                        }
                        else
                        {
                            velocity.X = 0.5;
                        }
                    }
                    animation = (animation + 1) % NUM_ANIMATIONS;
                }
                break;

            case State.Attack:
                if (openCount == 15)
                {
                    if (attackCount == 0)
                    {
                        if (direction == Direction.Left)
                        {
                            game.AddEnemyBullet(new HouseBullet(game, position + new Vector(32 - 2, 24), new Vector(-4 * game.Random.NextDouble(), 4 * game.Random.NextDouble() - 8)));
                        }
                        else
                        {
                            game.AddEnemyBullet(new HouseBullet(game, position + new Vector(32 + 2, 24), new Vector(4 * game.Random.NextDouble(), 4 * game.Random.NextDouble() - 8)));
                        }
                        attackCount = 16;
                    }
                    else
                    {
                        attackCount--;
                    }
                }
                break;
            }
            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#40
0
        public override void Tick(GameInput input)
        {
            if (health <= 0)
            {
                DeathTick(input);
                base.Tick(input);
                return;
            }

            if (attackCount > 0)
            {
                attackCount--;
            }

            if (attackCount == 0 && !attacking && game.Enemies.Count < 6)
            {
                attacking = true;
                if (game.Random.Next(0, 2) == 0)
                {
                    enemy = OutEnemy.Byaa;
                }
                else
                {
                    enemy = OutEnemy.Nurunuru;
                }
            }

            if (attacking)
            {
                if (openCount < 256)
                {
                    if (openCount == 0)
                    {
                        game.PlaySound(GameSound.RobotJump);
                        game.PlaySound(GameSound.Hi2);
                    }
                    if (openCount == 248)
                    {
                        game.PlaySound(GameSound.DoorClose);
                    }
                    openCount++;
                }
                if (openCount == 128)
                {
                    if (enemy == OutEnemy.Byaa)
                    {
                        game.AddEnemy(new Byaa(game, position + new Vector(64, 0), Byaa.Direction.Left, false));
                    }
                    else if (enemy == OutEnemy.Nurunuru)
                    {
                        game.AddEnemy(new Nurunuru(game, position + new Vector(64, 0), Nurunuru.Direction.Left, false));
                    }
                }
                if (openCount >= 256)
                {
                    openCount = 0;
                    if (health > 1000)
                    {
                        attackCount = 180;
                    }
                    else
                    {
                        attackCount = 90;
                    }
                    attacking = false;
                }
            }

            /*
             * if (health < 1000 && game.Ticks % 900 == 0)
             * {
             *  game.AddEnemy(new House(game, 1, 1, House.Direction.Right));
             * }
             */

            base.Tick(input);
        }
示例#41
0
        public override void Tick(GameInput input)
        {
            if (attackCount2 > 0)
            {
                attackCount2--;
            }

            double dx = game.Player.Center.X - Center.X;
            double dy = game.Player.Center.Y - Center.Y;

            playerDetected = false;
            if (attacking)
            {
                velocity.X = 0;
                if (attackWaitCount > 0)
                {
                    attackWaitCount--;
                    fireAnimation = 0;
                }
                else if (attackCount < 64)
                {
                    Vector posFix = new Vector(0, 30);
                    int    angle  = 180;
                    if (direction == Direction.Left)
                    {
                    }
                    else
                    {
                        posFix.X = 32 - posFix.X;
                        angle    = 180 - angle;
                    }

                    switch (weapon)
                    {
                    case Weapon.Pistol:
                        if (attackCount < 48)
                        {
                            if (attackCount % 16 == 0)
                            {
                                game.AddEnemyBullet(new PlayerBullet(game, position + posFix, angle, true));
                                game.PlaySound(GameSound.Pistol);
                            }
                            fireAnimation = attackCount / 2 % 8;
                        }
                        else
                        {
                            fireAnimation = 0;
                        }
                        break;

                    case Weapon.Machinegun:
                        if (attackCount == 24)
                        {
                            if (dx < 0)
                            {
                                direction = Direction.Left;
                            }
                            else if (dx > 0)
                            {
                                direction = Direction.Right;
                            }
                        }
                        if (attackCount % 32 < 16)
                        {
                            if (attackCount % 4 == 0)
                            {
                                game.AddEnemyBullet(new PlayerBullet2(game, position + posFix, angle, true));
                                game.PlaySound(GameSound.Pistol);
                            }
                            fireAnimation = (2 * attackCount) % 8;
                        }
                        else
                        {
                            fireAnimation = 0;
                        }
                        break;

                    case Weapon.Rocket:
                        if (attackCount % 32 == 0)
                        {
                            game.AddEnemyBullet(new KyoroRocket(game, position + posFix, angle, true));
                            game.PlaySound(GameSound.Rocket);
                        }
                        fireAnimation = attackCount / 4 % 8;
                        break;

                    case Weapon.Shotgun:
                        if (attackCount == 0)
                        {
                            Random random = game.Random;
                            for (int i = 0; i < 16; i++)
                            {
                                game.AddEnemyBullet(new PlayerBullet3(game, position + posFix, angle + 10 * random.NextDouble() + 10 * random.NextDouble() - 10, 8 + 16 * random.NextDouble(), true));
                            }
                            game.Quake(4);
                            game.Flash(32);
                            game.PlaySound(GameSound.Shotgun);
                        }
                        if (attackCount < 16)
                        {
                            fireAnimation = attackCount / 2;
                        }
                        else
                        {
                            fireAnimation = 0;
                        }
                        break;

                    case Weapon.Flamethrower:
                    {
                        if (attackCount == 0)
                        {
                            game.PlaySound(GameSound.Flame);
                        }
                        if (dx < 0)
                        {
                            direction = Direction.Left;
                        }
                        else if (dx > 0)
                        {
                            direction = Direction.Right;
                        }
                        Random random = game.Random;
                        game.AddEnemyBullet(new PlayerFlame(game, position + posFix, angle + 6 * random.NextDouble() + 6 * random.NextDouble() - 6, true));
                    }
                    break;
                    }
                    attackCount++;
                }
                if (attackCount >= 64)
                {
                    playerRange   = game.Random.Next(128, 320);
                    attacking     = false;
                    attackCount   = 0;
                    attackCount2  = game.Random.Next(60, 120);
                    fireAnimation = 0;
                }
                playerDetected = true;
                animation      = 0;
            }
            else if (Math.Abs(dx) < 320 && Math.Abs(dy) < 128)
            {
                playerDetected = true;
                if (dx < 0)
                {
                    direction = Direction.Left;
                }
                else if (dx > 0)
                {
                    direction = Direction.Right;
                }

                if (attackCount2 == 0)
                {
                    attacking       = true;
                    attackWaitCount = 30;
                }
                else
                {
                    if (Math.Abs(Math.Abs(dx) - playerRange) < 4)
                    {
                        velocity.X = 0;
                        animation  = 0;
                    }
                    else if (Math.Abs(dx) < playerRange)
                    {
                        if (dx < 0)
                        {
                            velocity.X = 2;
                        }
                        else if (dx > 0)
                        {
                            velocity.X = -2;
                        }
                        animation = (animation + 1) % NUM_ANIMATIONS;
                    }
                    else
                    {
                        if (dx < 0)
                        {
                            velocity.X = -2;
                        }
                        else if (dx > 0)
                        {
                            velocity.X = 2;
                        }
                        animation = (animation + 1) % NUM_ANIMATIONS;
                    }
                }
            }
            else
            {
                if (direction == Direction.Left)
                {
                    velocity.X = -2;
                }
                else
                {
                    velocity.X = 2;
                }
                animation = (animation + 1) % NUM_ANIMATIONS;
            }
            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);

            base.Tick(input);

            // Console.Write(attackCount + ",");
        }
示例#42
0
 public override void Blocked_Right(GameInput input)
 {
     velocity.X = -velocity.X;
 }
示例#43
0
文件: Norio.cs 项目: tamutamu/chaos
        public override void Tick(GameInput input)
        {
            if (attackCount2 > 0)
            {
                attackCount2--;
            }

            double dx = game.Player.Center.X - Center.X;
            double dy = game.Player.Center.Y - Center.Y;

            if (attacking)
            {
                if (attackCount < 64)
                {
                    /*
                     * if (attackCount >= 32 && attackCount % 2 == 0)
                     * {
                     *  if (direction == Direction.Left)
                     *  {
                     *      double angle = 0.75 * Math.PI + 0.25 * Math.PI * game.Random.NextDouble() + 0.25 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                     *      // double angle = 0.75 * Math.PI + 0.5 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                     *      Vector posFix = new Vector(32, 96);
                     *      game.AddEnemyBullet(new BaakaBullet(game, position + posFix, 4 * new Vector(Math.Cos(angle), Math.Sin(angle))));
                     *  }
                     *  else
                     *  {
                     *      double angle = 0.25 * Math.PI + 0.25 * Math.PI * game.Random.NextDouble() + 0.25 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                     *      // double angle = 0.25 * Math.PI + 0.5 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                     *      Vector posFix = new Vector(96, 96);
                     *      game.AddEnemyBullet(new BaakaBullet(game, position + posFix, 4 * new Vector(Math.Cos(angle), Math.Sin(angle))));
                     *  }
                     * }
                     */
                    if (attackCount == 48)
                    {
                        for (int i = 0; i < 48; i++)
                        {
                            if (direction == Direction.Left)
                            {
                                double angle = 135 + 15 * game.Random.NextDouble() + 15 * game.Random.NextDouble() - 15;
                                // double angle = 0.75 * Math.PI + 0.5 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                                Vector posFix = new Vector(16, 112);
                                game.AddEnemyBullet(new PlayerBullet3(game, position + posFix, angle, 8 + 16 * game.Random.NextDouble()));
                            }
                            else
                            {
                                double angle = 45 + 15 * game.Random.NextDouble() + 15 * game.Random.NextDouble() - 15;
                                // double angle = 0.25 * Math.PI + 0.5 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                                Vector posFix = new Vector(112, 112);
                                game.AddEnemyBullet(new PlayerBullet3(game, position + posFix, angle, 8 + 16 * game.Random.NextDouble()));
                            }
                        }
                        game.Quake(4);
                        game.Flash(32);
                        game.PlaySound(GameSound.Shotgun);
                    }
                    attackCount++;
                }
                if (attackCount >= 64)
                {
                    if (game.Random.Next(0, 2) == 0)
                    {
                        double rand = game.Random.NextDouble();
                        attackPos = new Vector(-128 - 128 * rand, -128 - 128 * rand);
                    }
                    else
                    {
                        double rand = game.Random.NextDouble();
                        attackPos = new Vector(128 + 128 * rand, -128 - 128 * rand);
                    }
                    attacking    = false;
                    attackCount  = 0;
                    attackCount2 = game.Random.Next(30, 60);
                }
            }

            if ((Math.Abs(dx) < 256 && Math.Abs(dy) < 256) || ghost)
            {
                velocity = 0.015625 * (game.Player.Center + attackPos - Center);
                double d = Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
                if (d > 16)
                {
                    velocity = 16 / d * velocity;
                }
                if (!attacking && attackCount2 == 0)
                {
                    if (dy > 0)
                    {
                        attacking = true;
                    }
                    else
                    {
                        if (game.Random.Next(0, 2) == 0)
                        {
                            double rand = game.Random.NextDouble();
                            attackPos = new Vector(-128 - 128 * rand, -128 - 128 * rand);
                        }
                        else
                        {
                            double rand = game.Random.NextDouble();
                            attackPos = new Vector(128 + 128 * rand, -128 - 128 * rand);
                        }
                        attackCount2 = game.Random.Next(3, 60);
                    }
                }
                if (dx < 0)
                {
                    direction = Direction.Left;
                }
                else if (dx > 0)
                {
                    direction = Direction.Right;
                }
            }
            else
            {
                if (direction == Direction.Left)
                {
                    velocity.X = -2;
                }
                else
                {
                    velocity.X = 2;
                }
                if (Math.Abs(dy - 192) < 1)
                {
                    velocity.Y = dy - 192;
                }
                else if (dy - 192 < 0)
                {
                    velocity.Y = -1;
                }
                else
                {
                    velocity.Y = 1;
                }
            }

            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#44
0
文件: Player.cs 项目: tamutamu/chaos
 public override void Blocked_Top(GameInput input)
 {
     base.Blocked_Top(input);
     jumpCount = -1;
 }
示例#45
0
 public virtual void MoveBy(GameInput input, Vector d)
 {
     MoveBy_Horizontal(input, d.X);
     MoveBy_Vertical(input, d.Y);
 }
示例#46
0
文件: Robot.cs 项目: tamutamu/chaos
        public override void Tick(GameInput input)
        {
            double dx = game.Player.Center.X - Center.X;
            double dy = game.Player.Center.Y - Center.Y;

            if (attackCount2 > 0)
            {
                attackCount2--;
                if (moveCount > 0)
                {
                    moveCount--;
                }
                else
                {
                    if (currentState == State.Run && Math.Abs(dx) < 320 && Math.Abs(dy) < 128)
                    {
                        currentState = State.BeginJump;
                    }
                    else
                    {
                        moveCount  = game.Random.Next(60, 120);
                        velocity.X = game.Random.Next(0, 2) == 0 ? 1 : -1;
                    }
                }
            }

            if (dx < 0)
            {
                direction = Direction.Left;
            }
            else if (dx > 0)
            {
                direction = Direction.Right;
            }

            if (currentState == State.BeginJump)
            {
                velocity.X = 0;
                rectangle  = RECTANGLE2;
                if (jumpCount < 16)
                {
                    jumpCount++;
                }
                if (jumpCount == 16)
                {
                    currentState = State.Jump;
                    velocity.X   = game.Random.Next(0, 2) == 0 ? -4 * game.Random.NextDouble() - 4 : 4 * game.Random.NextDouble() + 4;
                    velocity.Y   = -16;
                    game.Quake(2);
                    game.PlaySound(GameSound.RobotJump);
                    rectangle = RECTANGLE1;
                }
            }

            if (currentState == State.EndJump)
            {
                rectangle = RECTANGLE1;
                if (jumpCount > 0)
                {
                    jumpCount--;
                }
                else
                {
                    moveCount    = game.Random.Next(60, 120);
                    velocity.X   = game.Random.Next(0, 2) == 0 ? 1 : -1;
                    currentState = State.Run;
                }
            }

            if (currentState == State.Run && Math.Abs(dx) < 320 && Math.Abs(dy) < 128)
            {
                if (attackCount2 == 0)
                {
                    currentState = State.Attack;
                }
            }

            if (currentState == State.Attack)
            {
                if (attackCount2 == 0)
                {
                    velocity.X = 0;
                    if (attackCount < 160)
                    {
                        if (attackCount >= 32)
                        {
                            if (attackCount < 128)
                            {
                                rectangle = RECTANGLE2;
                                if (attackCount % 32 == 0)
                                {
                                    double rocketRotate = 6 - 0.015625 * Math.Abs(dx);
                                    if (rocketRotate < 1)
                                    {
                                        rocketRotate = 1;
                                    }
                                    if (direction == Direction.Left)
                                    {
                                        game.AddEnemyBullet(new RobotRocket(game, position + new Vector(16, 208), 180, rocketRotate));
                                        game.AddParticle(new BigExplosion(game, position + new Vector(32, 208), Vector.Zero));
                                    }
                                    else
                                    {
                                        game.AddEnemyBullet(new RobotRocket(game, position + new Vector(96, 208), 0, rocketRotate));
                                        game.AddParticle(new BigExplosion(game, position + new Vector(96, 208), Vector.Zero));
                                    }
                                    game.PlaySound(GameSound.Rocket);
                                }
                            }
                            else
                            {
                                rectangle = RECTANGLE1;
                            }
                        }
                        attackCount++;
                    }
                    if (attackCount >= 160)
                    {
                        velocity.X   = game.Random.Next(0, 2) == 0 ? 1 : -1;
                        attackCount  = 0;
                        attackCount2 = game.Random.Next(30, 60);
                        currentState = State.Run;
                    }
                }
            }

            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);
            animation = (animation + 1) % 32;

            base.Tick(input);
        }
示例#47
0
 public virtual void Blocked_Right(GameInput input)
 {
     velocity.X = 0;
 }
示例#48
0
文件: TestEnemy.cs 项目: sinshu/chaos
 public override void Blodked_Left(GameInput input)
 {
     direction = Direction.Right;
 }
示例#49
0
 public virtual void Blocked_Bottom(GameInput input)
 {
     velocity.Y = 0;
 }
示例#50
0
文件: Player.cs 项目: tamutamu/chaos
        public override void Tick(GameInput input)
        {
            if (ammoHudColorCount > 0)
            {
                ammoHudColorCount--;
            }
            if (ammoNumColorCount > 0)
            {
                ammoNumColorCount--;
            }

            if (!freeze && visible)
            {
                #region 左右の動き

                if (input.Left == input.Right)
                {
                    if (landState == LandState.InAir)
                    {
                        if (Math.Abs(velocity.X) > ACCELERATION_IN_AIR / 8)
                        {
                            velocity.X -= Math.Sign(velocity.X) * ACCELERATION_IN_AIR / 8;
                        }
                        else
                        {
                            velocity.X = 0;
                        }
                    }
                    else if (landState == LandState.OnGround)
                    {
                        if (Math.Abs(velocity.X) > ACCELERATION_ON_GROUND)
                        {
                            velocity.X -= Math.Sign(velocity.X) * ACCELERATION_ON_GROUND;
                        }
                        else
                        {
                            velocity.X = 0;
                        }
                    }
                }
                else if (input.Left && !input.Right)
                {
                    direction = Direction.Left;
                    if (landState == LandState.InAir)
                    {
                        if (velocity.X > -MAX_MOVING_SPEED)
                        {
                            velocity.X -= ACCELERATION_IN_AIR;
                        }
                    }
                    else if (landState == LandState.OnGround)
                    {
                        if (velocity.X > -MAX_MOVING_SPEED)
                        {
                            velocity.X -= ACCELERATION_ON_GROUND;
                        }
                        animation = (animation + 1) % NUM_ANIMATIONS;
                    }
                }
                else if (input.Right && !input.Left)
                {
                    direction = Direction.Right;
                    if (landState == LandState.InAir)
                    {
                        if (velocity.X < MAX_MOVING_SPEED)
                        {
                            velocity.X += ACCELERATION_IN_AIR;
                        }
                    }
                    else if (landState == LandState.OnGround)
                    {
                        if (velocity.X < MAX_MOVING_SPEED)
                        {
                            velocity.X += ACCELERATION_ON_GROUND;
                        }
                        animation = (animation + 1) % NUM_ANIMATIONS;
                    }
                }

                if (Math.Abs(velocity.X) > MAX_MOVING_SPEED)
                {
                    if (Math.Abs(velocity.X) - 1 < MAX_MOVING_SPEED)
                    {
                        velocity.X = Math.Sign(velocity.X) * MAX_MOVING_SPEED;
                    }
                    else
                    {
                        velocity.X -= Math.Sign(velocity.X);
                    }
                }

                MoveBy_Horizontal(input, velocity.X);

                #endregion

                #region   の動き

                velocity.Y += ACCELERATION_FALLING;
                if (velocity.Y > MAX_FALLING_SPEED)
                {
                    velocity.Y = MAX_FALLING_SPEED;
                }
                if (landState == LandState.OnGround)
                {
                    if (input.Jump)
                    {
                        if (jumpCount != -1)
                        {
                            landState = LandState.InAir;
                            jumpCount = INIT_JUMP_COUNT;
                            animation = (animation + (NUM_ANIMATIONS / 4)) % NUM_ANIMATIONS;
                        }
                    }
                    else
                    {
                        jumpCount = 0;
                    }
                }
                if (landState == LandState.InAir)
                {
                    if (jumpCount > 0)
                    {
                        if (input.Jump)
                        {
                            velocity.Y = -JUMP_SPEED;
                            jumpCount--;
                        }
                        else
                        {
                            jumpCount = -1;
                        }
                    }
                    else
                    {
                        if (velocity.Y < 0)
                        {
                            jumpCount = -1;
                        }
                        else if (!input.Jump)
                        {
                            jumpCount = 0;
                        }
                    }
                }
                landState = LandState.InAir;
                MoveBy_Vertical(input, velocity.Y);

                #endregion

                #region 腕

                if (input.Up == input.Down)
                {
                    arm = ArmDirection.Forward;
                }
                else if (input.Up)
                {
                    arm = ArmDirection.Upper;
                }
                else if (input.Down && landState == LandState.InAir)
                {
                    arm = ArmDirection.Lower;
                }

                #endregion

                #region 弾丸発射

                if (input.Attack && fireCount <= 0)
                {
                    if (weapon == Weapon.Pistol)
                    {
                        fireCount = INIT_FIRE_COUNT;
                    }
                    else if (weapon == Weapon.Machinegun)
                    {
                        fireCount = INIT_FIRE_COUNT / 2;
                    }
                    else if (weapon == Weapon.Rocket)
                    {
                        fireCount = INIT_FIRE_COUNT * 2;
                    }
                    else if (weapon == Weapon.Shotgun)
                    {
                        fireCount = INIT_FIRE_COUNT * 4;
                    }
                    else if (weapon == Weapon.Flamethrower)
                    {
                        if (fireCount == -1)
                        {
                            game.PlaySound(GameSound.Flame);
                        }
                        fireCount = 1;
                    }

                    armAnimation = 16;
                    FireWeapon(weapon);

                    /*
                     * if (direction == Direction.Left)
                     * {
                     *  game.AddPlayerBullet(new PlayerBullet(game, position + new Vector(0, 32), 180));
                     *  // game.AddParticle(new PlayerBulletExplosion(game, position + new Vector(0, 32), velocity * 0.5));
                     * }
                     * else
                     * {
                     *  game.AddPlayerBullet(new PlayerBullet(game, position + new Vector(32, 32), 0));
                     *  // game.AddParticle(new PlayerBulletExplosion(game, position + new Vector(32, 32), velocity * 0.5));
                     * }
                     */
                }
                if (fireCount > -1)
                {
                    fireCount--;
                }
                if (armAnimation > 0)
                {
                    armAnimation--;
                }

                #endregion

                #region アイテム取得

                foreach (Thing item in game.Items)
                {
                    if (Overlappes(this, item))
                    {
                        GetItem((Item)item);
                    }
                }

                #endregion
            }

            #region カメラ位置の補正

            if (direction == Direction.Left)
            {
                focus.X -= 2;
            }
            else
            {
                focus.X += 2;
            }
            if (Math.Abs(focus.X) > Settings.SCREEN_WIDTH / 8)
            {
                focus.X = Math.Sign(focus.X) * Settings.SCREEN_WIDTH / 8;
            }
            if (Center.X + focus.X < Settings.SCREEN_WIDTH / 2)
            {
                focus.X = Settings.SCREEN_WIDTH / 2 - Center.X;
            }
            else if (Center.X + focus.X > game.Map.Width - Settings.SCREEN_WIDTH / 2)
            {
                focus.X = game.Map.Width - Settings.SCREEN_WIDTH / 2 - Center.X;
            }

            #endregion

            if (enemyDamageCount > 0)
            {
                enemyDamageCount--;
            }

            /*
             * if (drawHealth < health)
             * {
             *  drawHealth++;
             * }
             * else if (drawHealth > health)
             * {
             *  drawHealth--;
             * }
             */
            drawHealth = health + (drawHealth - health) * 3 / 4;

            if (game.DebugMode)
            {
                if (health < 100)
                {
                    health++;
                }
            }

            base.Tick(input);
        }
示例#51
0
文件: TestEnemy.cs 项目: sinshu/chaos
 public override void Blocked_Right(GameInput input)
 {
     direction = Direction.Left;
 }
示例#52
0
 public override void Blocked_Bottom(GameInput input)
 {
     base.Blocked_Bottom(input);
     velocity.X = 0;
 }
示例#53
0
        public override void Tick(GameInput input)
        {
            if (health <= 0)
            {
                DeathTick(input);
                base.Tick(input);
                return;
            }

            if (4000 < health && health <= 5500 && currentState != State.Wait2 && currentState != State.Pattern2)
            {
                currentState = State.Wait2;
                stateCount   = 0;
            }
            else if (2500 < health && health <= 4000 && currentState != State.Pattern2_5)
            {
                currentState = State.Pattern2_5;
                stateCount   = 0;
            }
            else if (1000 < health && health <= 2500 && currentState != State.Wait3 && currentState != State.Pattern3)
            {
                currentState = State.Wait3;
                stateCount   = 0;
            }
            else if (500 < health && health <= 1000 && currentState != State.Wait4 && currentState != State.Pattern4)
            {
                currentState = State.Wait4;
                stateCount   = 0;
            }
            else if (0 < health && health <= 500 && currentState != State.Wait5 && currentState != State.Pattern5)
            {
                currentState = State.Wait5;
                stateCount   = 0;
            }

            switch (currentState)
            {
            case State.Wait1:
                if (stateCount < 120)
                {
                    stateCount++;
                }
                else
                {
                    currentState = State.Pattern1;
                    stateCount   = 0;
                }
                break;

            case State.Pattern1:
                if (stateCount < 64)
                {
                    if (stateCount == 0)
                    {
                        game.PlaySound(GameSound.Shuhu);
                    }
                    animation = stateCount / 4 % 2;
                    leftEggMachine.SetAnimation(stateCount / 8);
                    rightEggMachine.SetAnimation(stateCount / 8);
                }
                else
                {
                    if (stateCount % 8 == 0)
                    {
                        leftEggMachine.FireBullet();
                        rightEggMachine.FireBullet();
                    }
                    animation = 0;
                }
                stateCount = (stateCount + 1) % 512;
                break;

            case State.Wait2:
                if (stateCount < 120)
                {
                    if (stateCount == 0)
                    {
                        leftEggMachine.BeginIdle();
                        rightEggMachine.BeginIdle();
                    }
                    stateCount++;
                }
                else
                {
                    currentState = State.Pattern2;
                    stateCount   = 0;
                }
                break;

            case State.Pattern2:
                if (stateCount < 64)
                {
                    if (stateCount == 0)
                    {
                        game.PlaySound(GameSound.Duely);
                    }
                    animation = stateCount / 4 % 2;
                }
                else
                {
                    if (stateCount % 12 == 0)
                    {
                        game.AddParticle(new OyajiThunder(game, 176 + 672 * game.Random.NextDouble()));
                    }
                    animation = 0;
                }
                stateCount = (stateCount + 1) % 256;
                break;

            case State.Pattern2_5:
                if (stateCount < 64)
                {
                    if (stateCount == 0)
                    {
                        game.PlaySound(GameSound.Shuhu);
                    }
                    animation = stateCount / 4 % 2;
                    leftEggMachine.SetAnimation(stateCount / 8);
                    rightEggMachine.SetAnimation(stateCount / 8);
                }
                else
                {
                    if (stateCount % 32 == 8)
                    {
                        leftEggMachine.FireWormEgg();
                    }
                    if (stateCount % 32 == 24)
                    {
                        rightEggMachine.FireWormEgg();
                    }
                    animation = 0;
                }
                stateCount = (stateCount + 1) % 512;
                break;

            case State.Wait3:
                foreach (Thing enemy in game.Enemies)
                {
                    if (enemy is Worm)
                    {
                        enemy.Die();
                    }
                }
                if (stateCount < 64)
                {
                    leftEggMachine.SetAnimation(stateCount / 8);
                    rightEggMachine.SetAnimation(stateCount / 8);
                }
                if (stateCount < 120)
                {
                    stateCount++;
                }
                else
                {
                    byaa = new Byaa(game, new Vector(32, 32), Byaa.Direction.Right, true);
                    nuru = new Nurunuru(game, new Vector(game.Map.Width - 128 - 32, 32), Nurunuru.Direction.Left, true);
                    game.AddEnemy(byaa);
                    game.AddEnemy(nuru);
                    currentState = State.Pattern3;
                    stateCount   = 0;
                }
                break;

            case State.Pattern3:
                foreach (Thing enemy in game.Enemies)
                {
                    if (enemy is Worm)
                    {
                        enemy.Die();
                    }
                }
                if (stateCount < 64)
                {
                    if (stateCount == 0)
                    {
                        game.PlaySound(GameSound.Horay);
                    }
                    animation = stateCount / 4 % 2;
                }
                else
                {
                    animation = 0;
                }
                if (stateCount % 64 == 16)
                {
                    leftEggMachine.FireBullet();
                }
                if (stateCount % 64 == 48)
                {
                    rightEggMachine.FireBullet();
                }

                /*
                 * if (stateCount % 128 == 64)
                 * {
                 *  double x = game.Player.Center.X + 128 * game.Random.NextDouble() - 64;
                 *  if (x < 176) x = 176;
                 *  if (x > 848) x = 848;
                 *  game.AddParticle(new OyajiThunder(game, x));
                 * }
                 */
                stateCount = (stateCount + 1) % 512;
                break;

            case State.Wait4:
                if (stateCount == 0)
                {
                    if (byaa != null)
                    {
                        byaa.Die();
                    }
                    if (nuru != null)
                    {
                        nuru.Die();
                    }
                }
                if (stateCount < 32)
                {
                    leftEggMachine.SetAnimation(stateCount / 4);
                    rightEggMachine.SetAnimation(stateCount / 4);
                }
                if (stateCount < 60)
                {
                    stateCount++;
                }
                else
                {
                    norio1 = new Norio(game, 1, 1, Norio.Direction.Right, true);
                    norio2 = new Norio(game, 1, (game.Map.Width / Settings.BLOCK_WDITH) - 5, Norio.Direction.Left, true);
                    game.AddEnemy(norio1);
                    game.AddEnemy(norio2);
                    currentState = State.Pattern4;
                    stateCount   = 0;
                }
                break;

            case State.Pattern4:
                if (stateCount % 64 == 16)
                {
                    leftEggMachine.FireBullet();
                }
                if (stateCount % 64 == 48)
                {
                    rightEggMachine.FireBullet();
                }
                stateCount = (stateCount + 1) % 64;
                break;

            case State.Wait5:
                if (stateCount < 60)
                {
                    if (stateCount == 0)
                    {
                        if (norio1 != null)
                        {
                            norio1.Die();
                        }
                        if (norio2 != null)
                        {
                            norio2.Die();
                        }
                        leftEggMachine.BeginIdle();
                        rightEggMachine.BeginIdle();
                    }
                    stateCount++;
                }
                else
                {
                    currentState = State.Pattern5;
                    stateCount   = 0;
                }
                break;

            case State.Pattern5:
                if (stateCount < 64)
                {
                    leftEggMachine.SetAnimation(stateCount / 8);
                    rightEggMachine.SetAnimation(stateCount / 8);
                }
                else
                {
                    if (stateCount % 8 == 0)
                    {
                        leftEggMachine.FireBullet();
                        rightEggMachine.FireBullet();
                    }
                    if (stateCount % 16 == 0)
                    {
                        game.AddParticle(new OyajiThunder(game, 176 + 672 * game.Random.NextDouble()));
                    }
                }
                stateCount = (stateCount + 1) % 512;
                break;
            }

            velocity.X = 0.0078125 * (game.Player.Center.X - Center.X);
            if (Math.Abs(velocity.X) > 16)
            {
                velocity.X = Math.Sign(velocity.X) * 16;
            }
            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#54
0
文件: Baaka.cs 项目: tamutamu/chaos
        public override void Tick(GameInput input)
        {
            if (atField != null)
            {
                if (atField.Removed)
                {
                    atField = null;
                }
            }

            if (atFieldCount2 > 0)
            {
                atFieldCount2--;
            }

            if (attackCount2 > 0)
            {
                attackCount2--;
            }

            Player player = game.Player;

            switch (currentState)
            {
            case State.Move:
                if (direction == Direction.Left)
                {
                    velocity.X = -2;
                }
                else
                {
                    velocity.X = 2;
                }
                if (atField != null)
                {
                    atField.Remove();
                    atField = null;
                }
                if (Math.Abs(player.Center.X - Center.X) < 320 && Math.Abs(player.Center.Y - Center.Y) < 64)
                {
                    nextState = State.ChasePlayer;
                }
                if (nextState != State.Move)
                {
                    if (nextState == State.OpenField)
                    {
                        if (atFieldCount2 == 0)
                        {
                            currentState = State.OpenField;
                        }
                    }
                    else
                    {
                        currentState = nextState;
                    }
                }
                animation = (animation + 1) % NUM_ANIMATIONS;
                break;

            case State.ChasePlayer:
                double dx = player.Center.X - Center.X;
                if (Math.Abs(dx) < 256 && attackCount2 == 0)
                {
                    nextState = State.Attack;
                }
                else if (Math.Abs(dx) < 2)
                {
                    velocity.X = dx;
                }
                else
                {
                    if (dx < 0)
                    {
                        velocity.X = -2;
                        direction  = Direction.Left;
                    }
                    else
                    {
                        velocity.X = 2;
                        direction  = Direction.Right;
                    }
                }
                if (Math.Abs(player.Center.Y - Center.Y) > 64)
                {
                    nextState = State.Move;
                }
                if (atField != null)
                {
                    atField.Remove();
                    atField = null;
                }
                if (nextState != State.ChasePlayer)
                {
                    if (nextState == State.OpenField)
                    {
                        if (atFieldCount2 == 0)
                        {
                            currentState = State.OpenField;
                        }
                    }
                    else
                    {
                        currentState = nextState;
                    }
                }
                animation = (animation + 1) % NUM_ANIMATIONS;
                break;

            case State.OpenField:
                velocity.X = 0;
                if (nextState == State.OpenField)
                {
                    if (atFieldCount < 15)
                    {
                        atFieldCount++;
                    }
                    else
                    {
                        if (atField == null)
                        {
                            atField = new AtField(game, (AtField.Direction)direction, this);
                            game.AddEnemy(atField);
                        }
                    }
                }
                else
                {
                    if (atFieldCount > 0)
                    {
                        atFieldCount--;
                    }
                    else
                    {
                        if (atField != null)
                        {
                            atField.Remove();
                            atField = null;
                        }
                        currentState = nextState;
                    }
                }
                if ((direction == Direction.Left && Center.X < player.Center.X) || (direction == Direction.Right && player.Center.X < Center.X))
                {
                    nextState = State.ChasePlayer;
                }
                animation = 0;
                break;

            case State.Attack:
                velocity.X = 0;
                if (attackCount < 20)
                {
                    if (attackCount == 0)
                    {
                        Vector attackPos = Center + new Vector(0, -20);
                        attackAngle = Math.Atan2(game.Player.Center.Y - attackPos.Y, game.Player.Center.X - attackPos.X);
                        game.PlaySound(GameSound.Baaka);
                    }
                    if (attackCount % 4 == 2)
                    {
                        game.AddEnemyBullet(new BaakaBullet(game, Center + new Vector(0, -20), 8 * new Vector(Math.Cos(attackAngle), Math.Sin(attackAngle))));
                    }
                    attackCount++;
                }
                else
                {
                    attackCount  = 0;
                    attackCount2 = game.Random.Next(60, 120);
                    nextState    = State.ChasePlayer;
                }
                if (nextState != State.Attack && attackCount == 0)
                {
                    if (nextState == State.OpenField)
                    {
                        if (atFieldCount2 == 0)
                        {
                            currentState = State.OpenField;
                        }
                    }
                    else
                    {
                        currentState = nextState;
                    }
                }
                break;
            }

            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#55
0
 public override void Blodked_Left(GameInput input)
 {
     direction = Direction.Right;
 }
示例#56
0
文件: Worm.cs 项目: sinshu/chaos
        public override void Tick(GameInput input)
        {
            double dx = game.Player.Center.X - Center.X;
            double dy = game.Player.Center.Y - Center.Y;

            if (stateCount > 0)
            {
                stateCount--;
            }
            if (stateCount == 0)
            {
                if (Math.Abs(dx) < 320 && Math.Abs(dy) < 32)
                {
                    if (dx < 0)
                    {
                        direction = Direction.Left;
                    }
                    else if (dx > 0)
                    {
                        direction = Direction.Right;
                    }
                    stateCount = game.Random.Next(15, 30);
                    running = true;
                }
                else
                {
                    stateCount = game.Random.Next(30, 60);
                    running = game.Random.Next(0, 4) != 0;
                    if (!running)
                    {
                        animation = 4;
                    }
                }
            }

            if (running)
            {
                if (direction == Direction.Left)
                {
                    velocity.X = -4;
                }
                else
                {
                    velocity.X = 4;
                }
                animation = (animation + 1) % 8;
            }
            else
            {
                velocity.X = 0;
            }
            velocity.Y += ACCELERATION_FALLING;
            if (velocity.Y > MAX_FALLING_SPEED)
            {
                velocity.Y = MAX_FALLING_SPEED;
            }
            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#57
0
        public override void Tick(GameInput input)
        {
            if (attackCount2 > 0)
            {
                attackCount2--;
            }

            double dx = game.Player.Center.X - Center.X;
            double dy = game.Player.Center.Y - Center.Y;

            if (attacking)
            {
                if (attackCount < 64)
                {
                    if (attackCount == 0)
                    {
                        game.PlaySound(GameSound.Nurunuru);
                    }
                    if (attackCount >= 32 && attackCount % 2 == 0)
                    {
                        if (direction == Direction.Left)
                        {
                            double angle = 0.75 * Math.PI + 0.25 * Math.PI * game.Random.NextDouble() + 0.25 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                            // double angle = 0.75 * Math.PI + 0.5 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                            Vector posFix = new Vector(56, 108);
                            game.AddEnemyBullet(new BaakaBullet(game, position + posFix, 4 * new Vector(Math.Cos(angle), Math.Sin(angle))));
                        }
                        else
                        {
                            double angle = 0.25 * Math.PI + 0.25 * Math.PI * game.Random.NextDouble() + 0.25 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                            // double angle = 0.25 * Math.PI + 0.5 * Math.PI * game.Random.NextDouble() - 0.25 * Math.PI;
                            Vector posFix = new Vector(72, 108);
                            game.AddEnemyBullet(new BaakaBullet(game, position + posFix, 4 * new Vector(Math.Cos(angle), Math.Sin(angle))));
                        }
                    }
                    attackCount++;
                }
                if (attackCount >= 64)
                {
                    if (game.Random.Next(0, 2) == 0)
                    {
                        attackPos = new Vector(-128 - 128 * game.Random.NextDouble(), -128 - 128 * game.Random.NextDouble());
                    }
                    else
                    {
                        attackPos = new Vector(128 + 128 * game.Random.NextDouble(), -128 - 128 * game.Random.NextDouble());
                    }
                    attacking    = false;
                    attackCount  = 0;
                    attackCount2 = game.Random.Next(60, 120);
                }
            }

            if ((Math.Abs(dx) < 256 && Math.Abs(dy) < 256) || dropItem)
            {
                velocity = 0.015625 * (game.Player.Center + attackPos - Center);
                double d = Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
                if (d > 16)
                {
                    velocity = 16 / d * velocity;
                }
                if (!attacking && attackCount2 == 0)
                {
                    if (dy > 0)
                    {
                        attacking = true;
                    }
                    else
                    {
                        if (game.Random.Next(0, 2) == 0)
                        {
                            attackPos = new Vector(-128 - 128 * game.Random.NextDouble(), -128 - 128 * game.Random.NextDouble());
                        }
                        else
                        {
                            attackPos = new Vector(128 + 128 * game.Random.NextDouble(), -128 - 128 * game.Random.NextDouble());
                        }
                        attackCount2 = game.Random.Next(60, 120);
                    }
                }
                if (dx < 0)
                {
                    direction = Direction.Left;
                }
                else if (dx > 0)
                {
                    direction = Direction.Right;
                }
            }
            else
            {
                if (direction == Direction.Left)
                {
                    velocity.X = -2;
                }
                else
                {
                    velocity.X = 2;
                }
                if (Math.Abs(dy - 192) < 1)
                {
                    velocity.Y = dy - 192;
                }
                else if (dy - 192 < 0)
                {
                    velocity.Y = -1;
                }
                else
                {
                    velocity.Y = 1;
                }
            }

            MoveBy(input, velocity);

            base.Tick(input);
        }
示例#58
0
 public override void Tick(GameInput input)
 {
     base.Tick(input);
 }
示例#59
0
        public override void Tick(GameInput input)
        {
            if (health <= 0)
            {
                rectangle  = RECTANGLE;
                stateCount = 256;
                DeathTick(input);
                base.Tick(input);
                return;
            }

            stateCount = (stateCount + 1) % 512;

            if (stateCount < 32)
            {
                rectangle = new Rectangle(new Vector(88, 256 - 4 * stateCount), new Vector(SIZE.X, 4 * stateCount));
                if (stateCount == 0)
                {
                    int nextPos = game.Random.Next(0, POSITION.Length - 1);
                    if (nextPos < currentPos)
                    {
                        position   = POSITION[nextPos];
                        currentPos = nextPos;
                    }
                    else
                    {
                        position   = POSITION[nextPos + 1];
                        currentPos = nextPos + 1;
                    }
                }
                animation = stateCount / 2;
            }
            else if (stateCount < 128)
            {
                if (stateCount == 32)
                {
                    rectangle = RECTANGLE;
                }
                animation = stateCount / 2 % 16;
            }
            else if (stateCount < 256)
            {
                if (stateCount % 32 == 0)
                {
                    game.PlaySound(GameSound.Mushroom);
                }
                if (health > INIT_HEALTH / 2)
                {
                    if (stateCount % 64 == 48)
                    {
                        SpreadSpores(8);
                    }
                }
                else
                {
                    if (stateCount % 32 == 24)
                    {
                        SpreadSpores(8);
                    }
                }
                animation = stateCount / 2 % 16;
            }
            else if (stateCount < 480)
            {
                animation = stateCount / 2 % 16;
            }
            else if (stateCount < 512)
            {
                rectangle = new Rectangle(new Vector(88, 128 + 4 * (stateCount - 480)), new Vector(SIZE.X, 128 - 4 * (stateCount - 480)));
                animation = 15 - (stateCount - 480) / 2;
            }

            base.Tick(input);
        }
示例#60
0
 public override void Tick(GameInput input)
 {
     base.Tick(input);
     animation = (animation + 1) % 16;
 }