summary refs log tree commit diff stats
path: root/res/scripts
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-21 12:31:55 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-21 12:31:55 -0500
commitecbe17b582803aaeaa9ccee88a3d093ff93a6cd3 (patch)
treeb7e14ae55b6c38992598b8571ed217bc8f249887 /res/scripts
parentf0eab98e417bf648261a9027bef91fe935af76cb (diff)
downloadtanetane-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.lua15
-rw-r--r--res/scripts/map2.lua11
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
52end 57end
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
97end 107end
98 108
99function GetPosition(spriteName) 109function GetPosition(spriteName)
@@ -120,6 +130,11 @@ function WaitForAnimation(spriteName)
120 until sprite.animFinished 130 until sprite.animFinished
121end 131end
122 132
133function Halt(spriteName)
134 local spriteId = getSpriteByAlias(spriteName)
135 character():halt(spriteId)
136end
137
123function PlaySound(filename) 138function PlaySound(filename)
124 mixer():playSound("../res/sfx/" .. filename) 139 mixer():playSound("../res/sfx/" .. filename)
125end 140end
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()
174end 174end
175
176function 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()
185end