From 3c0f099448c878c0614a1c1b21cf889e93015048 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sun, 20 Aug 2017 13:20:52 +0300 Subject: [PATCH] Entities can be nudged with the arrow keys in the sub editor --- Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs index e50c5d7d3..aa9849dfe 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs @@ -234,6 +234,19 @@ namespace Barotrauma if (highLightedEntity != null) highLightedEntity.isHighlighted = true; } + Vector2 nudgeAmount = Vector2.Zero; + if (PlayerInput.KeyHit(Keys.Up)) nudgeAmount.Y = 1f; + if (PlayerInput.KeyHit(Keys.Down)) nudgeAmount.Y = -1f; + if (PlayerInput.KeyHit(Keys.Left)) nudgeAmount.X = -1f; + if (PlayerInput.KeyHit(Keys.Right)) nudgeAmount.X = 1f; + if (nudgeAmount != Vector2.Zero) + { + foreach (MapEntity entityToNudge in selectedList) + { + entityToNudge.Move(nudgeAmount); + } + } + //started moving selected entities if (startMovingPos != Vector2.Zero) {