summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-26 18:54:38 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-26 18:54:38 -0500
commitc1fc60c5a2a4b96b830afc29942648714944b9d7 (patch)
tree8460df9e93491b8ba138f7f1cba41572b65fc537 /res
parentaf49b5366d35173702a2b3bd70ac4254b8855538 (diff)
downloadtanetane-c1fc60c5a2a4b96b830afc29942648714944b9d7.tar.gz
tanetane-c1fc60c5a2a4b96b830afc29942648714944b9d7.tar.bz2
tanetane-c1fc60c5a2a4b96b830afc29942648714944b9d7.zip
Added sprite bobbing (for Lucas underwater)
Diffstat (limited to 'res')
-rw-r--r--res/scripts/common.lua15
-rw-r--r--res/scripts/underwater.lua1
-rw-r--r--res/scripts/underwater_start.lua1
3 files changed, 17 insertions, 0 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 895ad7b..825d2e5 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua
@@ -329,3 +329,18 @@ function AllowCrouching()
329 local playerSprite = getSprite(playerId) 329 local playerSprite = getSprite(playerId)
330 playerSprite.cantCrouch = false 330 playerSprite.cantCrouch = false
331end 331end
332
333--- Makes a sprite start bobbing up and down (for underwater).
334-- This only applies when the sprite is on a normal medium (so, not on ladders).
335function StartBobbing(spriteName)
336 local spriteId = getSpriteByAlias(spriteName)
337 local sprite = getSprite(spriteId)
338 sprite.bobsWhenNormal = true
339end
340
341--- Makes a sprite stop bobbing up and down.
342function StopBobbing(spriteName)
343 local spriteId = getSpriteByAlias(spriteName)
344 local sprite = getSprite(spriteId)
345 sprite.bobsWhenNormal = false
346end
diff --git a/res/scripts/underwater.lua b/res/scripts/underwater.lua index 4c5d2bb..3500079 100644 --- a/res/scripts/underwater.lua +++ b/res/scripts/underwater.lua
@@ -2,6 +2,7 @@ underwater = {}
2 2
3function underwater.leave() 3function underwater.leave()
4 AllowCrouching() 4 AllowCrouching()
5 StopBobbing("lucas")
5end 6end
6 7
7function underwater.fish2() 8function underwater.fish2()
diff --git a/res/scripts/underwater_start.lua b/res/scripts/underwater_start.lua index 98a6e67..c14f4b8 100644 --- a/res/scripts/underwater_start.lua +++ b/res/scripts/underwater_start.lua
@@ -2,6 +2,7 @@ underwater_start = {}
2 2
3function underwater_start.init() 3function underwater_start.init()
4 PreventCrouching() 4 PreventCrouching()
5 StartBobbing("lucas")
5end 6end
6 7
7function underwater_start.talk_to_fish1() 8function underwater_start.talk_to_fish1()