From b3720c4a401f345c49eadabdb852968e273e7077 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 17 Feb 2021 15:11:37 -0500 Subject: Added expressions (currently just surprise) --- res/scripts/common.lua | 18 ++++++++++++++++++ res/scripts/map2.lua | 27 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'res/scripts') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index f88c4c1..8a9445b 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -207,3 +207,21 @@ function DestroyNamedSprite(alias) local spriteId = getSpriteByAlias(alias) destroySprite(spriteId) end + +function AliasForSpriteExpression(spriteName) + return "expression (" .. spriteName .. ")" +end + +function ShowExpression(spriteName, expression) + local spriteId = getSpriteByAlias(spriteName) + local sprite = getSprite(spriteId) + local animFrame = sprite:getCurrentFrame() + local x = sprite.loc:x() + local y = sprite.loc:y() - animFrame.center:y() + + CreateAnimatedSpriteAtPosition(AliasForSpriteExpression(spriteName), "expression", x, y, expression, Direction.DOWN, SpriteLayer.ABOVE) +end + +function RemoveExpression(spriteName) + DestroyNamedSprite(AliasForSpriteExpression(spriteName)) +end diff --git a/res/scripts/map2.lua b/res/scripts/map2.lua index c929e8d..295a0c1 100644 --- a/res/scripts/map2.lua +++ b/res/scripts/map2.lua @@ -74,12 +74,36 @@ function map2.approach_doria() gamestate.approached_doria = true StartCutscene() + SetDirection("boney", Direction.LEFT) + SetAnimation("boney", "barking") + local barkingNoise = LoopSound("barking_at_hallucination.wav") + Delay(200) + + ShowExpression("lucas", "surprise") + SetDirection("lucas", Direction.LEFT) + Delay(100) + + ShowExpression("kuma", "surprise") + ShowExpression("duster", "surprise") + SetDirection("kuma", Direction.LEFT) + SetDirection("duster", Direction.LEFT) + Delay(1000) + PanToSprite("doria", 2000) + Delay(500) + + RemoveExpression("lucas") + RemoveExpression("kuma") + RemoveExpression("duster") WaitForPan() SetDirection("doria", Direction.DOWN_RIGHT) SetAnimation("doria", "talk") + ShowExpression("doria", "surprise") DisplayMessage("* Oh my!\n\f* Is that our little Kumatora I spy? `", "Doria", SpeakerType.MAN) + Delay(1000) + + RemoveExpression("doria") WaitForEndOfMessage() SetAnimation("doria", "still") @@ -89,6 +113,9 @@ function map2.approach_doria() DisplayMessage("* Doria...?\n\f* What the hell... You're still alive?", "Kumatora", SpeakerType.WOMAN) WaitForEndOfMessage() + SetAnimation("boney", "crouch") + StopSound(barkingNoise) + PlaySound("boney_growl.wav") SetAnimation("kuma", "still") Delay(1000) -- cgit 1.4.1