diff --git a/Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs b/Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs index 2b30fcf0..08bce1b4 100644 --- a/Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs +++ b/Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs @@ -16,7 +16,7 @@ namespace Demo.SpaceGame.Entities private float _fireCooldown; public CircleF BoundingCircle; - public Vector2 Direction => Vector2.UnitX.Rotate(Rotation); + public Vector2 Direction => (-Vector2.UnitX).Rotate(-Rotation); public Vector2 Position { @@ -72,7 +72,7 @@ namespace Demo.SpaceGame.Entities public void LookAt(Vector2 point) { - Rotation = (float)Math.Atan2(point.Y - Position.Y, point.X - Position.X); + Rotation = (float)Math.Atan2(point.Y - Position.Y, Position.X - point.X); } public void Fire() @@ -83,8 +83,8 @@ namespace Demo.SpaceGame.Entities } var angle = Rotation + MathHelper.ToRadians(90); - var muzzle1Position = Position + new Vector2(14, 0).Rotate(angle); - var muzzle2Position = Position + new Vector2(-14, 0).Rotate(angle); + var muzzle1Position = Position + new Vector2(14, 0).Rotate(-angle); + var muzzle2Position = Position + new Vector2(-14, 0).Rotate(-angle); _bulletFactory.Create(muzzle1Position, Direction, angle, 550f); _bulletFactory.Create(muzzle2Position, Direction, angle, 550f); _fireCooldown = 0.2f; diff --git a/Source/Demos/Demo.SpaceGame/Game1.cs b/Source/Demos/Demo.SpaceGame/Game1.cs index afbe3acd..98376511 100644 --- a/Source/Demos/Demo.SpaceGame/Game1.cs +++ b/Source/Demos/Demo.SpaceGame/Game1.cs @@ -108,10 +108,10 @@ namespace Demo.SpaceGame _player.Accelerate(-acceleration); if (keyboardState.IsKeyDown(Keys.A) || keyboardState.IsKeyDown(Keys.Left)) - _player.Rotation -= deltaTime*3f; + _player.Rotation += deltaTime*3f; if (keyboardState.IsKeyDown(Keys.D) || keyboardState.IsKeyDown(Keys.Right)) - _player.Rotation += deltaTime*3f; + _player.Rotation -= deltaTime*3f; if (keyboardState.IsKeyDown(Keys.Space) || mouseState.LeftButton == ButtonState.Pressed) _player.Fire(); diff --git a/Source/Demos/Demo.StarWarrior/packages.config b/Source/Demos/Demo.StarWarrior/packages.config index 9b38dcf7..348c97ac 100644 --- a/Source/Demos/Demo.StarWarrior/packages.config +++ b/Source/Demos/Demo.StarWarrior/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs b/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs index c16ebe41..eb26b897 100644 --- a/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs +++ b/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs @@ -170,6 +170,7 @@ namespace MonoGame.Extended.Entities return; var entityTemplate = _dependencyResolver.Resolve(typeInfo.AsType()); + entityTemplate.Manager = this; EntityManager.AddEntityTemplate(entityTemplateAttribute.Name, entityTemplate); } }