diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-26 18:54:38 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-26 18:54:38 -0500 |
commit | c1fc60c5a2a4b96b830afc29942648714944b9d7 (patch) | |
tree | 8460df9e93491b8ba138f7f1cba41572b65fc537 /res/scripts | |
parent | af49b5366d35173702a2b3bd70ac4254b8855538 (diff) | |
download | tanetane-c1fc60c5a2a4b96b830afc29942648714944b9d7.tar.gz tanetane-c1fc60c5a2a4b96b830afc29942648714944b9d7.tar.bz2 tanetane-c1fc60c5a2a4b96b830afc29942648714944b9d7.zip |
Added sprite bobbing (for Lucas underwater)
Diffstat (limited to 'res/scripts')
-rw-r--r-- | res/scripts/common.lua | 15 | ||||
-rw-r--r-- | res/scripts/underwater.lua | 1 | ||||
-rw-r--r-- | res/scripts/underwater_start.lua | 1 |
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 |
331 | end | 331 | end |
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). | ||
335 | function StartBobbing(spriteName) | ||
336 | local spriteId = getSpriteByAlias(spriteName) | ||
337 | local sprite = getSprite(spriteId) | ||
338 | sprite.bobsWhenNormal = true | ||
339 | end | ||
340 | |||
341 | --- Makes a sprite stop bobbing up and down. | ||
342 | function StopBobbing(spriteName) | ||
343 | local spriteId = getSpriteByAlias(spriteName) | ||
344 | local sprite = getSprite(spriteId) | ||
345 | sprite.bobsWhenNormal = false | ||
346 | end | ||
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 | ||
3 | function underwater.leave() | 3 | function underwater.leave() |
4 | AllowCrouching() | 4 | AllowCrouching() |
5 | StopBobbing("lucas") | ||
5 | end | 6 | end |
6 | 7 | ||
7 | function underwater.fish2() | 8 | function 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 | ||
3 | function underwater_start.init() | 3 | function underwater_start.init() |
4 | PreventCrouching() | 4 | PreventCrouching() |
5 | StartBobbing("lucas") | ||
5 | end | 6 | end |
6 | 7 | ||
7 | function underwater_start.talk_to_fish1() | 8 | function underwater_start.talk_to_fish1() |