Beispiel #1
0
        public Ship(AIController ai, GameEnvironment env)
            : base()
        {
            this.ai = ai;
            this.maxSpeed = 50.0f;
            this.maxTurn = 0.025f;

            shooter = new BulletEmitter(env, BulletEmitter.BulletStrength.Medium, IsFriendly());
            env.AddChild(shooter);
        }
Beispiel #2
0
        public GymEnvironment(Controller ctrl)
            : base(ctrl)
        {
            SpecialAbility special = new SpecialAbility();
            special.LoadTexture(contentManager, "bullet");
            special.Position = new Vector2(300.0f, 100.0f);
            special.DesiredVelocity = new Vector2(0.0f, 0.0f);
            AddChild(special);

            //	emit = new BulletEmitter(this, BulletEmitter.BulletStrength.Weak, true);
            //	emit = new BulletEmitter(this, BulletEmitter.BulletStrength.Medium, true);
            emit = new BulletEmitter(this, BulletEmitter.BulletStrength.Strong, true);

            emit.Position = new Vector2(210.0f, 300.0f);
            emit.Rotation = (float)3.14 * 3 / 2;
            AddChild(emit);

            for (int i = 0; i < 20; i++)
            {
                /*AddChild(new TestShip((float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Width, (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Height,
                    0, 0,
                    (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Width, (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Height,
                    (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Width, (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Height,
                    this));*/

                Ship s = new Ship(null, this);
                s.TestShip((float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Width, (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Height,
                    0, 0,
                    (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Width, (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Height,
                    (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Width, (float)r.NextDouble() * ctrl.Graphics.GraphicsDevice.Viewport.Height,
                    this);
                AddChild(s);
            }
            Ship s2 = new Ship(null, this);
            s2.TestShip(150, 150, 0, 0, this);
            AddChild(s2);
            //AddChild(new TestShip(150, 150, 0, 0, this));
            AddChild(new Crosshair(this));

            LoadMap("gym.tmx");
        }
Beispiel #3
0
        protected virtual void initialize()
        {
            Environment.Boss = this;

            this.bm1 = new BulletEmitter(Environment, this, BulletEmitter.BulletStrength.Medium);
            this.bm2 = new BulletEmitter(Environment, this, BulletEmitter.BulletStrength.Medium);
            this.bm3 = new BulletEmitter(Environment, this, BulletEmitter.BulletStrength.Medium);

            AddChild(bm1);
            AddChild(bm2);
            AddChild(bm3);

            Registration = new Vector2(465.0f, 465.0f);
            CreateCollisionBody(Environment.CollisionWorld, BodyType.Dynamic, CollisionFlags.Default);
            Zindex = 0.3f;

            takesDamage = AddCollisionCircle(170.0f, Vector2.Zero);
            sensor = AddCollisionCircle(Texture.Width * 1.25f, Vector2.Zero);

            CollisionBody.LinearDamping = 8.0f;
            CollisionBody.IgnoreGravity = true;

            Vector2[] temp;

            if (Environment.SpawnedBossPatrolPoints.Count == 0)
            {
                temp = new Vector2[4];
                temp[0] = new Vector2(Environment.ScreenVirtualSize.X, Environment.ScreenVirtualSize.Y);
                temp[1] = new Vector2(0f, Environment.ScreenVirtualSize.Y);
                temp[2] = new Vector2(0, 0);
                temp[3] = new Vector2(Environment.ScreenVirtualSize.X, 0);
            }
            else
            {
                temp = new Vector2[Environment.SpawnedBossPatrolPoints.Count];
                for (int i = 0; i < temp.Length; ++i)
                    temp[i] = Environment.SpawnedBossPatrolPoints.ElementAt(i);

            }
            this.ai = new BossAI(Environment, this, temp);
        }
Beispiel #4
0
        private void Initialize(SpawnPoint sp)
        {
            shooter = new BulletEmitter(Environment, this,BulletEmitter.BulletStrength.Strong);
            AddChild(shooter);
            RelativeShooterPos = new Vector2(50.0f, 0.0f);

            ai = m_originalAI = new AIController(sp, Environment);
            LoadTexture(Environment.contentManager, "squaretopia");

            Registration = new Vector2(100.0f, 125.0f);
            CreateCollisionBody(Environment.CollisionWorld, BodyType.Dynamic, CollisionFlags.Default);
            AddCollisionCircle(50.0f, Vector2.Zero);
            CollisionBody.LinearDamping = 8.0f;
            this.health = this.MaxHealth = (int)(this.MaxHealth * 1.5);
            passiveShield = 20.0f;

            shield = new Entity();
            shield.Zindex = 0.0f;
            shield.Registration = new Vector2(125.0f, 115.0f);
            shield.LoadTexture(Environment.contentManager, "shield");
            shield.Position = Position;
            shield.Alpha = 0.0f;
            AddChild(shield);
        }
Beispiel #5
0
        private void Initialize(SpawnPoint sp)
        {
            shooter = new BulletEmitter(Environment, this, BulletEmitter.BulletStrength.Medium);
            AddChild(shooter);
            RelativeShooterPos = new Vector2(65.0f, -5.0f);

            ai = m_originalAI = new AIController(sp, Environment);
            LoadTexture(Environment.contentManager, "circloid");

            Registration = new Vector2(117.0f, 101.0f);
            CreateCollisionBody(Environment.CollisionWorld, BodyType.Dynamic, CollisionFlags.Default);
            AddCollisionCircle(60.0f, Vector2.Zero);
            CollisionBody.LinearDamping = 8.0f;
            CollisionBody.IgnoreGravity = true; // The circloid will not be affected by its own black hole.
            this.maxSpeed *= 1.25f;
            this.health = this.MaxHealth = (int)(this.MaxHealth * 1.25);
        }