diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-21 12:31:55 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-21 12:31:55 -0500 |
commit | ecbe17b582803aaeaa9ccee88a3d093ff93a6cd3 (patch) | |
tree | b7e14ae55b6c38992598b8571ed217bc8f249887 /res/scripts | |
parent | f0eab98e417bf648261a9027bef91fe935af76cb (diff) | |
download | tanetane-ecbe17b582803aaeaa9ccee88a3d093ff93a6cd3.tar.gz tanetane-ecbe17b582803aaeaa9ccee88a3d093ff93a6cd3.tar.bz2 tanetane-ecbe17b582803aaeaa9ccee88a3d093ff93a6cd3.zip |
Added sprite pausing
All sprites are now paused when a cutscene starts and unpaused when it ends. Pausing means that the CharacterSystem and BehaviourSystem will not process them in their tick. This allows specific sprites to be unpaused during cutscenes if movement is needed. The player character is halted and made non-controllable by the script when the cutscene starts and made controllable again when it ends. It is important to remember that if interacting with a sprite that might be moving, you have to manually call Halt() on them in their script to make them stop moving.
Diffstat (limited to 'res/scripts')
-rw-r--r-- | res/scripts/common.lua | 15 | ||||
-rw-r--r-- | res/scripts/map2.lua | 11 |
2 files changed, 26 insertions, 0 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 4dfa1a2..494ace9 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua | |||
@@ -49,6 +49,11 @@ function StartCutscene() | |||
49 | playerSprite.controllable = false | 49 | playerSprite.controllable = false |
50 | character():halt(playerId) | 50 | character():halt(playerId) |
51 | message():displayCutsceneBars() | 51 | message():displayCutsceneBars() |
52 | |||
53 | local allSprites = getAllSprites() | ||
54 | for k,v in pairs(allSprites) do | ||
55 | getSprite(v).paused = true | ||
56 | end | ||
52 | end | 57 | end |
53 | 58 | ||
54 | --- Queues a message for display. | 59 | --- Queues a message for display. |
@@ -94,6 +99,11 @@ function HideCutsceneBars() | |||
94 | local playerId = getPlayerSprite() | 99 | local playerId = getPlayerSprite() |
95 | local playerSprite = getSprite(playerId) | 100 | local playerSprite = getSprite(playerId) |
96 | playerSprite.controllable = true | 101 | playerSprite.controllable = true |
102 | |||
103 | local allSprites = getAllSprites() | ||
104 | for k,v in pairs(allSprites) do | ||
105 | getSprite(v).paused = false | ||
106 | end | ||
97 | end | 107 | end |
98 | 108 | ||
99 | function GetPosition(spriteName) | 109 | function GetPosition(spriteName) |
@@ -120,6 +130,11 @@ function WaitForAnimation(spriteName) | |||
120 | until sprite.animFinished | 130 | until sprite.animFinished |
121 | end | 131 | end |
122 | 132 | ||
133 | function Halt(spriteName) | ||
134 | local spriteId = getSpriteByAlias(spriteName) | ||
135 | character():halt(spriteId) | ||
136 | end | ||
137 | |||
123 | function PlaySound(filename) | 138 | function PlaySound(filename) |
124 | mixer():playSound("../res/sfx/" .. filename) | 139 | mixer():playSound("../res/sfx/" .. filename) |
125 | end | 140 | end |
diff --git a/res/scripts/map2.lua b/res/scripts/map2.lua index 3c3a5d9..cb373b4 100644 --- a/res/scripts/map2.lua +++ b/res/scripts/map2.lua | |||
@@ -172,3 +172,14 @@ function map2.approach_doria() | |||
172 | 172 | ||
173 | HideCutsceneBars() | 173 | HideCutsceneBars() |
174 | end | 174 | end |
175 | |||
176 | function map2.talk_to_ionia() | ||
177 | Halt("ionia") | ||
178 | StartCutscene() | ||
179 | SetAnimation("ionia", "talk") | ||
180 | DisplayMessage("* Kumatora!", "Ionia", SpeakerType.MAN) | ||
181 | WaitForEndOfMessage() | ||
182 | |||
183 | SetAnimation("ionia", "still") | ||
184 | HideCutsceneBars() | ||
185 | end | ||