public void stopall()
 {
     ExplosionTimer.Stop();
     EnemyTimer.Stop();
     EnemyTimer1.Stop();
     EnemyTimer2.Stop();
     EnemyTimer3.Stop();
     EnemyTimer4.Stop();
     BombTimer.Stop();
 }
Пример #2
0
 private void OnExplosionTimerTick(object sender, EventArgs e)
 {
     ExplosionFrame += 64;
     if (ExplosionFrame == 192)
     {
         ExplosionTimer.Stop();
         ExplosionTimer.Tick -= OnExplosionTimerTick;
         Unsubscribe();
         Creator.Ammo++;
     }
     GUIForm.Invalidate(Rectangle.Inflate(Rect, 64, 64));
 }
 private void ExplosionTimer_Tick(object sender, EventArgs e)
 {
     if (bombe1tick == 5)
     {
         ExplosionTimer.Stop();
         bomb.Visible       = false;
         explosion1.Visible = false;
         explosion2.Visible = false;
         explosion3.Visible = false;
         explosion4.Visible = false;
         bomb3tick          = 0;
         bombe1tick         = 0;
     }
     bombe1tick++;
     woods();
     p1dead();
 }
 private void BombTimer_Tick(object sender, EventArgs e)
 {
     if (bomb3tick == 4)
     {
         BombTimer.Stop();
         expload.controls.play();
         explosion1.Visible  = true;
         explosion2.Visible  = true;
         explosion3.Visible  = true;
         explosion4.Visible  = true;
         explosion1.Location = new Point(bomb.Location.X, bomb.Location.Y - 50);
         explosion2.Location = new Point(bomb.Location.X + 50, bomb.Location.Y);
         explosion3.Location = new Point(bomb.Location.X, bomb.Location.Y + 50);
         explosion4.Location = new Point(bomb.Location.X - 50, bomb.Location.Y);
         ExplosionTimer.Start();
     }
     bomb3tick++;
 }
Пример #5
0
        protected virtual void OnExplosionTimerTick(object sender, EventArgs e)
        {
            ExplosionFrame += 128;
            if (ExplosionFrame == 1152)
            {
                ExplosionFrame = 0;
                ExplosionTimer.Stop();

                Dx        = 0;
                Dy        = 0;
                HP        = 1;
                Immortal  = false;
                Amphibian = false;
                Gun       = false;
                Ammo      = 1;

                Lives--;
            }
            GUIForm.Invalidate(Rectangle.Inflate(Rect, 128, 128));
        }
Пример #6
0
    private void ExplodeOthers()
    {
        if (!selfPower.destructivePower)
        {
            return;
        }
        colliders = Physics.OverlapSphere(transform.position + selfPower.offSet, selfPower.radius, selfPower.layer);
        Collider selfCollider = GetComponent <Collider>();

        foreach (Collider hit in colliders)
        {
            ExplosionTimer timer = hit.gameObject.GetComponent <ExplosionTimer>();
            if (!timer || !hit || hit == selfCollider || WallDetection(hit))
            {
                continue;
            }
            float z             = CalcZ(GetDistance(posExplosion, hit.bounds.center), mass);
            float explosionTime = z * speed;
            timer.SetExplosion(explosionTime, posExplosion, mass, gameObject, selfPower.damage);
        }
    }
Пример #7
0
        public Ship(
            IParticleEngine particleEngine,
            IRandomizer randomizer,
            ShipState?state = null)
        {
            _particleEngine = particleEngine ?? throw new ArgumentNullException(nameof(particleEngine));
            _randomizer     = randomizer ?? throw new ArgumentNullException(nameof(randomizer));
            // Size = Vector2.Zero;
            //AngularVelocity = 1f;

            EngineTimer.EveryNumOfSeconds = 0.5f;
            EngineTimer.Restart();

            ExplosionTimer.EveryNumOfSeconds = 0.3f;
            ExplosionTimer.Restart();
            if (state != null)
            {
                foreach (var spriteState in state.Balls)
                {
                    shipBullets.Add(new Ball(_randomizer, new GameTimer())
                    {
                        State = spriteState
                    });
                }
            }
            else
            {
                state = new ShipState();
                state.SpriteState.Size            = Vector2.Zero;
                state.SpriteState.AngularVelocity = 1f;
                for (int i = 0; i < 4; i++)
                {
                    var ball = new Ball(_randomizer, new GameTimer());
                    shipBullets.Add(ball);
                    state.Balls.Add(ball.State);
                }
            }
            State       = state;
            SpriteState = state.SpriteState;
        }
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            lf = true;
            if (e.KeyCode == Keys.Left && !CheckCollision())
            {
                Anime.Start();
                P1.Location = new Point(P1.Location.X - 4, P1.Location.Y);
            }
            else if (e.KeyCode == Keys.Left && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X + 4, P1.Location.Y);
            }

            if (e.KeyCode == Keys.Right && !CheckCollision())
            {
                AnimeRight.Start();
                P1.Location = new Point(P1.Location.X + 5, P1.Location.Y);
            }
            else if (e.KeyCode == Keys.Right && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X - 4, P1.Location.Y);
            }

            if (e.KeyCode == Keys.Up && !CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y - 5);
                AnimeUp.Start();
            }
            else if (e.KeyCode == Keys.Up && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y + 4);
            }

            if (e.KeyCode == Keys.Down && !CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y + 5);
                AnimeDown.Start();
            }
            else if (e.KeyCode == Keys.Down && CheckCollision())
            {
                P1.Location = new Point(P1.Location.X, P1.Location.Y - 4);
            }
            if (e.KeyCode == Keys.Z && bomb.Visible == false)
            {
                bomb.Image    = Properties.Resources.graphics_bombs_934360;
                bomb.Location = P1.Location;
                bomb.Visible  = true;
                BombTimer.Start();
            }
            if (e.KeyCode == Keys.P)
            {
                ExplosionTimer.Stop();
                EnemyTimer.Stop();
                EnemyTimer1.Stop();
                EnemyTimer2.Stop();
                EnemyTimer3.Stop();
                EnemyTimer4.Stop();
                BombTimer.Stop();
                label2.Visible       = true;
                pictureBox29.Visible = true;
                P1.Visible           = false;
                bomb.Visible         = false;
                explosion1.Visible   = false;
                explosion2.Visible   = false;
                explosion3.Visible   = false;
                explosion4.Visible   = false;
            }
            if (e.KeyCode == Keys.R)
            {
                EnemyTimer.Start();
                EnemyTimer1.Start();
                EnemyTimer2.Start();
                EnemyTimer3.Start();
                EnemyTimer4.Start();
                label2.Visible       = false;
                pictureBox29.Visible = false;
                P1.Visible           = true;
            }
            //if ((P1.Bounds.IntersectsWith(enemy1.Bounds) && enemy1.Visible == true) || (P1.Bounds.IntersectsWith(enemy2.Bounds) && enemy2.Visible == true) || (P1.Bounds.IntersectsWith(enemy3.Bounds) && enemy3.Visible == true) || (P1.Bounds.IntersectsWith(enemy4.Bounds) && enemy4.Visible == true) || (P1.Bounds.IntersectsWith(enemy5.Bounds) && enemy5.Visible == true))
            ////if (explosion1.Visible && P1.Bounds.IntersectsWith(explosion1.Bounds) || explosion2.Visible && P1.Bounds.IntersectsWith(explosion2.Bounds) || explosion3.Visible && P1.Bounds.IntersectsWith(explosion3.Bounds) || explosion4.Visible && P1.Bounds.IntersectsWith(explosion4.Bounds))
            //{
            //    DEAD3.Visible = true;
            //    P1.Dispose();
            //    stopall();
            //    MessageBox.Show("YOU SUCK!");
            //    Form home = new Form2();
            //    this.Hide();
            //    home.Show();
            //}
            else if (enemy1.Visible == false && enemy2.Visible == false && enemy3.Visible == false && enemy4.Visible == false && enemy5.Visible == false)
            {
                MessageBox.Show("YOU WON!");
                Form home = new Form2();
                this.Hide();
                home.Show();
            }
        }
Пример #9
0
 private void OnDestroyed(object sender, EventArgs e)
 {
     MoveTimer.Stop();
     ExplosionTimer.Start();
 }