예제 #1
0
        public override void Update()
        {
            spikeCreator();
            if (!Dragon.dead)
            {
                for (int i = Spike.Count - 1; i > -1; i--)
                {
                    if (Spike[i].position.X < -50)
                    {
                        Spike.RemoveAt(i);
                    }
                    else
                    {
                        Spike[i].Update();
                        if (!Spike[i].scored && Dragon.Position.X > Spike[i].position.X + 50)
                        {
                            Spike[i].scored = true;
                            score++;
                            this.PipePassEffect.Play();
                        }

                        if (Dragon.Bound.Intersects(Spike[i].TopBound1) || Dragon.Bound.Intersects(Spike[i].TopBound2) || Dragon.Bound.Intersects(Spike[i].TopBound3) ||
                            Dragon.Bound.Intersects(Spike[i].TopBound4) || Dragon.Bound.Intersects(Spike[i].TopBound5) || Dragon.Bound.Intersects(Spike[i].TopBound6) ||
                            Dragon.Bound.Intersects(Spike[i].ButtomBound1) || Dragon.Bound.Intersects(Spike[i].ButtomBound2) || Dragon.Bound.Intersects(Spike[i].ButtomBound3) ||
                            Dragon.Bound.Intersects(Spike[i].ButtomBound4) || Dragon.Bound.Intersects(Spike[i].ButtomBound5))
                        {
                            Dragon.dead = true;
                            this.PipeHitEffect.Play();
                        }
                    }
                }
                Dragon.Update();
                Scroll.Update();
            }

            if (Dragon.dead && Statics.INPUT.isKeyPressed(Microsoft.Xna.Framework.Input.Keys.R))
            {
                this.Reset();
            }
            base.Update();
        }
예제 #2
0
        public override void Update()
        {
            if (!Bird.dead)
            {
                wynik++;
            }
            pipeCreator();
            if (!Bird.dead)
            {
                for (int i = Pipe.Count - 1; i > -1; i--)
                {
                    if (Pipe[i].position.X < 30)
                    {
                        Pipe.RemoveAt(i);
                    }
                    else
                    {
                        Pipe[i].Update();
                        if (!Pipe[i].scored && Bird.Position.X > Pipe[i].position.X + 30)
                        {
                            Pipe[i].scored = true;
                            score++;
                        }
                        if (Bird.Bound.Intersects(Pipe[i].TopBound) || (Bird.Bound.Intersects(Pipe[i].BottomBound)))
                        {
                            Bird.dead = true;
                        }
                    }
                }
                Bird.Update();
                Scroll.Update();
            }

            if (Bird.dead && Statics.input.isKeyPressed(Microsoft.Xna.Framework.Input.Keys.R))
            {
                this.Reset();
                wynik = 0;
            }
            base.Update();
        }
        public override void Update()
        {
            tuyauxCreator();
            if (!Bird.dead)
            {
                for (int i = Tuyaux.Count - 1; i > -1; i--)
                {
                    if (Tuyaux[i].position.X < -50)
                    {
                        Tuyaux.RemoveAt(i);
                    }
                    else
                    {
                        Tuyaux[i].Update();
                        if (!Tuyaux[i].scored && Bird.Position.X > Tuyaux[i].position.X + 50)
                        {
                            Tuyaux[i].scored = true;
                            score++;
                        }

                        if (Bird.Bound.Intersects(Tuyaux[i].TopBound) || Bird.Bound.Intersects(Tuyaux[i].BottomBound))
                        {
                            Bird.dead = true;
                        }
                    }
                }

                Bird.Update();
                Scroll.Update();
            }


            if (Bird.dead && Statics.INPUT.isKeyPressed(Microsoft.Xna.Framework.Input.Keys.R))
            {
                this.Reset();
            }

            base.Update();
        }
예제 #4
0
        public override void Update()
        {
            TubeCreator();
            if (!player.dead)
            {
                for (int i = tubes.Count - 1; i > -1; i--)
                {
                    if (tubes[i].position.X < -50)
                    {
                        tubes.RemoveAt(i);
                    }
                    else
                    {
                        tubes[i].Update();
                        if (!tubes[i].scored && player.position.X > tubes[i].position.X + 50)
                        {
                            tubes[i].scored = true;
                            score++;
                        }

                        if (player.Bounds.Intersects(tubes[i].BottomBound) || player.Bounds.Intersects(tubes[i].TopBound))
                        {
                            player.dead = true;
                        }
                    }
                }
                player.Update();
                scroll.Update();
            }

            if (player.dead && Statics.INPUT.isKeyPressed(Microsoft.Xna.Framework.Input.Keys.Enter))
            {
                Reset();
            }


            base.Update();
        }