summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
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()