public override void LoadContent() { SetTitle(nameof(S01JoystickScene)); var touchJoystickPosition = new Vector2(50, ScreenHeight - 450); var joystickBackgroundTexture = GameCore.Content.Load <Texture2D>("Common/JoystickBackground"); var joystickHandleTexture = GameCore.Content.Load <Texture2D>("Common/JoystickHandle"); _touchJoystickComponent = new TouchJoystickComponent( GameCore, new JoystickConfiguration(400, touchJoystickPosition) { BackgroundTexture = joystickBackgroundTexture, HandleTexture = joystickHandleTexture, InvertY_Axis = true, }); AddGameComponent(_touchJoystickComponent); var playerTexture = new Texture2D(GameCore.GraphicsDevice, 1, 1); playerTexture.SetData(new Color[] { Color.DodgerBlue }); _playerEntity = CreateEntity("player", ScreenCenter) .AddComponent(new SpriteComponent(texture: playerTexture, scale: new Vector2(200f))); base.LoadContent(); }
public override void LoadContent() { SetTitle(nameof(S02TopDownCarMovementScene)); var joystickPosition = new Vector2(50, ScreenHeight - 450); var joystickBackgroundTexture = GameCore.Content.Load <Texture2D>("Common/JoystickBackground"); var joystickHandleTexture = GameCore.Content.Load <Texture2D>("Common/JoystickHandle"); _touchJoystickComponent = new TouchJoystickComponent( GameCore, new JoystickConfiguration(400, joystickPosition) { BackgroundTexture = joystickBackgroundTexture, HandleTexture = joystickHandleTexture, }); AddGameComponent(_touchJoystickComponent); var carTexture = GameCore.Content.Load <Texture2D>("Sample02/Car"); _bodyComponent = new BodyComponent(carTexture.Width, carTexture.Height, EntityType.Dynamic, EntityShape.Rectangle) { IgnoreGravity = true, }; _carEntity = CreateEntity("player", ScreenCenter) .AddComponent(_bodyComponent) .AddComponent(new SpriteComponent(texture: carTexture)); var spriteFont = GameCore.Content.Load <SpriteFont>("Common/FontArial18"); _textComponent = new TextComponent(spriteFont, "", color: Color.Black); _textEntity = CreateEntity("text", ScreenCenter) .AddComponent(_textComponent); base.LoadContent(); }