From 77fad1c341787f11ee3b8aeaa5c58fe6ebbdebb6 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 6 Jul 2021 10:13:33 -0400 Subject: Added the ability to pan camera to a warp point --- src/camera_system.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/camera_system.cpp') diff --git a/src/camera_system.cpp b/src/camera_system.cpp index 0ef3c36..ac89a78 100644 --- a/src/camera_system.cpp +++ b/src/camera_system.cpp @@ -41,6 +41,22 @@ void CameraSystem::panToSprite(int targetId, int length) { } } +void CameraSystem::panToWarpPoint(std::string_view warpPoint, int length) { + locked_ = true; + + vec2i center = game_.getMap().getWarpPoint(warpPoint); + + if (length > 0) { + panning_ = true; + panStart_ = pos_; + panEnd_ = calculatePosWithCenter(center); + panLength_ = length; + panThus_ = 0.0; + } else { + pos_ = calculatePosWithCenter(center); + } +} + void CameraSystem::destroySprite(int spriteId) { if (followingSprite_ == spriteId) { followingSprite_ = -1; -- cgit 1.4.1