Exemple #1
0
        public Player(Layer layer, Vector2 position) : base(layer)
        {
            _playerSprite = ResourceHub.GetResource <Sprite>("DefaultSprites", "Player");

            // You can add components right in the constructor.
            _position = AddComponent(new PositionComponent(position));
            _actor    = AddComponent(new ActorComponent(_playerSprite));
        }
Exemple #2
0
        public Bot(Layer layer) : base(layer)
        {
            var botSprite = ResourceHub.GetResource <Sprite>("DefaultSprites", "Bot");

            AddComponent(new PositionComponent(Vector2.Zero));
            _actor = AddComponent(new ActorComponent(botSprite));

            // It is recommended to reuse random objects.
            TurningSpeed = ECDemoFactory.Random.Next(120, 240);
        }