예제 #1
0
        public new void Start()
        {
            _startkey = new DoubleInput(Keys.Enter, Buttons.Start, PlayerIndex.One);
            GameRef.BGColor = Color.Red;

            _bgimage = new Image(this, GameRef.Game.Content.Load<Texture2D>(@"menu/background"), Vector2.Zero)
            {
                Render = { Scale = 6f, Layer = 0f }
            };
            AddEntity(_bgimage);

            _starttext = new Text(this, new Vector2(100, 500), "Press Start or Enter to start",
                                 GameRef.Game.Content.Load<SpriteFont>("font")) { Render = { Layer = 1f } };
            AddEntity(_starttext);
        }
예제 #2
0
        public Cursor(EntityState es, Town town)
            : base(es)
        {
            Town = town;

            _aimleftkey = new DoubleInput(Keys.A, Buttons.DPadLeft, PlayerIndex.One);
            _aimrightkey = new DoubleInput(Keys.D, Buttons.DPadRight, PlayerIndex.One);
            _quickaimkey = new DoubleInput(Keys.LeftShift, Buttons.RightShoulder, PlayerIndex.One);

            Physics = new Physics(this);
            Components.Add(Physics);

            Render = new Render(this, StateRef.GameRef.Game.Content.Load<Texture2D>(@"game/cursor"))
                {
                    Layer = 1f,
                    Scale = 6f
                };
            Components.Add(Render);

            Body = new Body(this, town.Body.Position + (town.Render.Origin - Vector2.UnitY * 40 - Render.Origin) * Render.Scale, Vector2.One * 5);
            Components.Add(Body);

            Town.Health.DiedEvent += Destroy;
        }