diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2021-07-06 10:13:33 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2021-07-06 10:13:33 -0400 |
commit | 77fad1c341787f11ee3b8aeaa5c58fe6ebbdebb6 (patch) | |
tree | aa8addf2f54d3def01edb29944cacdebdcaf981b /src/camera_system.cpp | |
parent | 8aedeaf12c7dbf35f2f75f1b063b76a4fad06f30 (diff) | |
download | tanetane-77fad1c341787f11ee3b8aeaa5c58fe6ebbdebb6.tar.gz tanetane-77fad1c341787f11ee3b8aeaa5c58fe6ebbdebb6.tar.bz2 tanetane-77fad1c341787f11ee3b8aeaa5c58fe6ebbdebb6.zip |
Added the ability to pan camera to a warp point
Diffstat (limited to 'src/camera_system.cpp')
-rw-r--r-- | src/camera_system.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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) { | |||
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | void CameraSystem::panToWarpPoint(std::string_view warpPoint, int length) { | ||
45 | locked_ = true; | ||
46 | |||
47 | vec2i center = game_.getMap().getWarpPoint(warpPoint); | ||
48 | |||
49 | if (length > 0) { | ||
50 | panning_ = true; | ||
51 | panStart_ = pos_; | ||
52 | panEnd_ = calculatePosWithCenter(center); | ||
53 | panLength_ = length; | ||
54 | panThus_ = 0.0; | ||
55 | } else { | ||
56 | pos_ = calculatePosWithCenter(center); | ||
57 | } | ||
58 | } | ||
59 | |||
44 | void CameraSystem::destroySprite(int spriteId) { | 60 | void CameraSystem::destroySprite(int spriteId) { |
45 | if (followingSprite_ == spriteId) { | 61 | if (followingSprite_ == spriteId) { |
46 | followingSprite_ = -1; | 62 | followingSprite_ = -1; |