Ejemplo n.º 1
0
        //UPDATE
        public override void Update(GameTime gameTime)
        {
            if (velocity.Y == 0.0f && GameEnvironment.Random.NextDouble() < 0.01)
            {
                velocity = CalculatedRandomVelocity();
                Color    = CalculatedRandomColor();
            }

            //Gameworld is as property of all GameObjects referencing the root parentobject
            PainterGameWorld pgw = GameWorld as PainterGameWorld;

            //when the cans drops down the screen and color matches get 10 points else lose 1 life
            if (pgw.IsOutsideGameWorld(GlobalPosition))
            {
                if (color == targetColor)
                {
                    pgw.Score += 10;
                    //Painter.AssetManager.PlaySound("snd_collect_points");
                }
                else
                {
                    pgw.Lives--;
                }
                Reset();
            }

            Angle = (float)Math.Sin(position.Y / 50.0f) * 0.1f;

            minVelocity += 0.001f;
            base.Update(gameTime);
        }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            if (Shooting)
            {
                velocity.X *= 0.99f;
                velocity.Y += 6;
            }

            PainterGameWorld pgw = GameWorld as PainterGameWorld;

            if (pgw.IsOutsideGameWorld(GlobalPosition))
            {
                Reset();
            }

            base.Update(gameTime);
        }