Example #1
0
        public Image(EntityState stateref, IComponent parent, string name)
            : base(stateref, parent, name)
        {
            Body = new Body(this, "Body");
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            ImageBaseRender = new ImageRender(this, "ImageRender");
            AddComponent(ImageBaseRender);
        }
Example #2
0
        public Image(EntityState stateref, IComponent parent, string name, Texture2D texture, Vector2 position)
            : base(stateref, parent, name)
        {
            Body = new Body(this, "Body", position);
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            ImageBaseRender = new ImageRender(this, "ImageRender", texture);
            AddComponent(ImageBaseRender);
        }
        public Bullet(EntityState stateref, string name)
            : base(stateref, name)
        {
            Body = new Body(this, "Body");
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            AddComponent(Physics);

            ImageRender = new ImageRender(this, "ImageRender");
            ImageRender.LoadTexture(@"Asteroids/bullet");
            ImageRender.Layer = .2f;
            AddComponent(ImageRender);
        }
        public Ship(EntityState stateref, string name)
            : base(stateref, name)
        {
            Body = new Body(this, "Body", new Vector2(200,200));
            AddComponent(Body);

            Physics = new Physics(this, "Physics");
            Physics.Drag = 0.9f;
            AddComponent(Physics);

            ImageRender = new ImageRender(this, "ImageRender");
            ImageRender.LoadTexture(@"Asteroids/ship-small");
            ImageRender.Color = Color.White;
            ImageRender.Origin = new Vector2(ImageRender.Texture.Width * ImageRender.Scale.X / 2, ImageRender.Texture.Height * ImageRender.Scale.Y / 2);
            ImageRender.Scale = new Vector2(1, 1);
            AddComponent(ImageRender);

            Weapon = new Gun(this, "Weapon");
            AddComponent(Weapon);

            _attackkey = new DoubleInput(this, "AttackKey", Keys.Enter, Buttons.A, PlayerIndex.One);
            _upkey = new DoubleInput(this, "UpKey", Keys.W, Buttons.DPadUp, PlayerIndex.One);
            _downkey = new DoubleInput(this, "DownKey", Keys.S, Buttons.DPadDown, PlayerIndex.One);
            _leftkey = new DoubleInput(this, "LeftKey", Keys.A, Buttons.DPadLeft, PlayerIndex.One);
            _rightkey = new DoubleInput(this, "RightKey", Keys.D, Buttons.DPadRight, PlayerIndex.One);
            _debugkey = new DoubleInput(this, "DebugKey", Keys.P, Buttons.Start, PlayerIndex.One);

            AddComponent(_attackkey);
            AddComponent(_upkey);
            AddComponent(_downkey);
            AddComponent(_leftkey);
            AddComponent(_rightkey);
            AddComponent(_debugkey);

            _moveanalog = new GamePadAnalog(this, "MoveAnalog", Sticks.Left, PlayerIndex.One);
            AddComponent(_moveanalog);

            _aimanalog = new GamePadAnalog(this, "AimAnalog", Sticks.Right, PlayerIndex.One);
            AddComponent(_aimanalog);

            _shoottrigger = new GamePadTrigger(this, "ShootTrigger", Triggers.Right, PlayerIndex.One);
            AddComponent(_shoottrigger);
        }