From d38e93dc1946a95ac518bd38087844f41f8a89ac Mon Sep 17 00:00:00 2001 From: Niklas Ulf Anders Cullberg Date: Thu, 11 Oct 2012 13:03:19 +0200 Subject: [PATCH] Still working on Shooting (shouldn't work yet) --- DepthsBelow/DepthsBelow/KeyboardInput.cs | 15 ++++++++++++++- DepthsBelow/DepthsBelow/Shot.cs | 1 - 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/DepthsBelow/DepthsBelow/KeyboardInput.cs b/DepthsBelow/DepthsBelow/KeyboardInput.cs index b3cf368..6d2e15d 100644 --- a/DepthsBelow/DepthsBelow/KeyboardInput.cs +++ b/DepthsBelow/DepthsBelow/KeyboardInput.cs @@ -75,7 +75,20 @@ namespace DepthsBelow } if (ks.IsKeyDown(Keys.S)) { - + foreach (var soldier in core.Squad) + { + core.Volley.Add(new Shot(core)); + foreach (var shot in core.Volley) + { + if (shot.direction == Vector2.Zero) + { + double directionX = Math.Cos(soldier.GetComponent().World.Rotation); + double directionY = Math.Sin(soldier.GetComponent().World.Rotation); + shot.direction = new Vector2((float)directionX, (float)directionY); + + } + } + } } } } diff --git a/DepthsBelow/DepthsBelow/Shot.cs b/DepthsBelow/DepthsBelow/Shot.cs index 46f58af..edd0908 100644 --- a/DepthsBelow/DepthsBelow/Shot.cs +++ b/DepthsBelow/DepthsBelow/Shot.cs @@ -17,7 +17,6 @@ namespace DepthsBelow public List Volley; - private PathFinder.Node nextNode; public Vector2 direction = Vector2.Zero; public Shot(Core core)