diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-16 22:03:10 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-16 22:03:10 -0500 |
| commit | a645524d19bb9183d4eece72bf8945bba4bed3a0 (patch) | |
| tree | ca45cb80f73def5bd6bd8d7ec46bb90c826be848 /res/scripts/common.lua | |
| parent | c5a96f0ee23a3dbe1a6dab0a1062cf25b7a2aba4 (diff) | |
| download | tanetane-a645524d19bb9183d4eece72bf8945bba4bed3a0.tar.gz tanetane-a645524d19bb9183d4eece72bf8945bba4bed3a0.tar.bz2 tanetane-a645524d19bb9183d4eece72bf8945bba4bed3a0.zip | |
Added scriptable camera panning
Diffstat (limited to 'res/scripts/common.lua')
| -rw-r--r-- | res/scripts/common.lua | 23 |
1 files changed, 23 insertions, 0 deletions
| diff --git a/res/scripts/common.lua b/res/scripts/common.lua index caab86a..f88c4c1 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua | |||
| @@ -141,6 +141,29 @@ function StopShakingCamera() | |||
| 141 | effect():stopShakingCamera() | 141 | effect():stopShakingCamera() |
| 142 | end | 142 | end |
| 143 | 143 | ||
| 144 | function PanToSprite(spriteName, length) | ||
| 145 | local spriteId = getSpriteByAlias(spriteName) | ||
| 146 | camera():panToSprite(spriteId, length) | ||
| 147 | end | ||
| 148 | |||
| 149 | function WaitForPan() | ||
| 150 | while camera():isPanning() do | ||
| 151 | coroutine.yield() | ||
| 152 | end | ||
| 153 | end | ||
| 154 | |||
| 155 | function ReturnCamera(length) | ||
| 156 | local playerId = getPlayerSprite() | ||
| 157 | camera():panToSprite(playerId, length) | ||
| 158 | |||
| 159 | while camera():isPanning() do | ||
| 160 | coroutine.yield() | ||
| 161 | end | ||
| 162 | |||
| 163 | camera():setFollowingSprite(playerId) | ||
| 164 | camera():unlockCamera() | ||
| 165 | end | ||
| 166 | |||
| 144 | function SetPartyDirection(spriteId, direction) | 167 | function SetPartyDirection(spriteId, direction) |
| 145 | animation():setSpriteDirection(spriteId, direction) | 168 | animation():setSpriteDirection(spriteId, direction) |
| 146 | 169 | ||
