Example #1
0
        public PlayerShip(int DefaultWidth, int DefaultHeight)
        {
            this.DefaultWidth  = DefaultWidth;
            this.DefaultHeight = DefaultHeight;

            this.GoodEgo = new StarShip {
                Animations.Spawn_BigGun(0, 0)
            };

            this.GoodEgoY = DefaultHeight - 20;
            this.EvilEgoY = 60;

            GoodEgo.y = GoodEgoY;

            this.EvilEgo = new StarShip {
                Animations.Spawn_UFO(0, 0)
            };

            EvilEgo.y = EvilEgoY;

            this.EvilMode = new BooleanProperty();


            this.GodMode.LinkTo(this.GoodEgo.GodMode);
            this.GodMode.LinkTo(this.EvilEgo.GodMode);



            this.GoodEgo.PositionChanged +=
                delegate
            {
                var EvilModePending = true;

                if (this.GoodEgo.x < DefaultWidth)
                {
                    if (this.GoodEgo.x > 0)
                    {
                        EvilModePending = false;
                    }
                }

                if (this.GoodEgo.MoveToTarget.Value.x > DefaultWidth / 2)
                {
                    EvilEgo.TeleportTo(this.GoodEgo.x - DefaultWidth, EvilEgoY);
                }
                else
                {
                    EvilEgo.TeleportTo(this.GoodEgo.x + DefaultWidth, EvilEgoY);
                }


                EvilMode.Value = EvilModePending;

                if (this.GoodEgo.x > DefaultWidth * 0.5)
                {
                    this.GoodEgo.MoveToTarget.Value.x -= DefaultWidth * 2;
                    this.GoodEgo.x -= DefaultWidth * 2;
                }

                if (this.GoodEgo.x < -DefaultWidth * 0.5)
                {
                    this.GoodEgo.MoveToTarget.Value.x += DefaultWidth * 2;
                    this.GoodEgo.x += DefaultWidth * 2;
                }
            };


            GoodEgo.TweenMoveTo(DefaultWidth / 2, GoodEgoY);


            GoodEgo.MaxStep = 12;
            EvilEgo.MaxStep = 12;
        }
		public PlayerShip(int DefaultWidth, int DefaultHeight)
		{
			this.DefaultWidth = DefaultWidth;
			this.DefaultHeight = DefaultHeight;

			this.GoodEgo = new StarShip { Animations.Spawn_BigGun(0, 0) };

			this.GoodEgoY = DefaultHeight - 20;
			this.EvilEgoY = 60;

			GoodEgo.y = GoodEgoY;

			this.EvilEgo = new StarShip { Animations.Spawn_UFO(0, 0) };

			EvilEgo.y = EvilEgoY;

			this.EvilMode = new BooleanProperty();


			this.GodMode.LinkTo(this.GoodEgo.GodMode);
			this.GodMode.LinkTo(this.EvilEgo.GodMode);









			this.GoodEgo.PositionChanged +=
				delegate
				{
					var EvilModePending = true;

					if (this.GoodEgo.x < DefaultWidth)
						if (this.GoodEgo.x > 0)
						{
							EvilModePending = false;
						}

					if (this.GoodEgo.MoveToTarget.Value.x > DefaultWidth / 2)
						EvilEgo.TeleportTo(this.GoodEgo.x - DefaultWidth, EvilEgoY);
					else
						EvilEgo.TeleportTo(this.GoodEgo.x + DefaultWidth, EvilEgoY);


					EvilMode.Value = EvilModePending;

					if (this.GoodEgo.x > DefaultWidth * 0.5)
					{
						this.GoodEgo.MoveToTarget.Value.x -= DefaultWidth * 2;
						this.GoodEgo.x -= DefaultWidth * 2;
					}

					if (this.GoodEgo.x < -DefaultWidth * 0.5)
					{
						this.GoodEgo.MoveToTarget.Value.x += DefaultWidth * 2;
						this.GoodEgo.x += DefaultWidth * 2;
					}
				};


			GoodEgo.TweenMoveTo(DefaultWidth / 2, GoodEgoY);


			GoodEgo.MaxStep = 12;
			EvilEgo.MaxStep = 12;

		}