From ad87e0e201ff8b09ea51a1c3ca89fd3c58a83f6b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 21 Aug 2020 06:48:10 +0000 Subject: [PATCH] chore(release): 13.4.0 [skip ci] # [13.4.0](https://github.com/seleb/bitsy-hacks/compare/v13.3.7...v13.4.0) (2020-08-21) ### Features * add sprite effects hack ([#165](https://github.com/seleb/bitsy-hacks/issues/165)) ([0de423a](https://github.com/seleb/bitsy-hacks/commit/0de423a8cc9c753525dfe93b8d0647b7647520c8)) --- CHANGELOG.md | 7 + README.md | 1 + dist/3d.js | 2 +- dist/avatar-by-room.js | 2 +- dist/basic-sfx.js | 2 +- dist/bitsymuse.js | 2 +- dist/canvas-replacement.js | 2 +- dist/character-portraits-animated.js | 2 +- dist/character-portraits.js | 2 +- dist/close-on-ending.js | 2 +- dist/corrupt.js | 2 +- dist/custom-exit-effects.js | 2 +- dist/custom-keyhandlers.js | 2 +- dist/custom-text-effect.js | 2 +- dist/dialog-audio-vocal-synth.js | 2 +- dist/dialog-audio.js | 2 +- dist/dialog-box-transition.js | 2 +- dist/dialog-choices.js | 2 +- dist/dialog-jump.js | 2 +- dist/dialog-pause.js | 2 +- dist/dialog-prompt.js | 2 +- dist/direction-in-dialog.js | 2 +- dist/directional-avatar.js | 2 +- dist/dynamic-background.js | 2 +- dist/edit-dialog-from-dialog.js | 2 +- dist/edit-image-from-dialog.js | 2 +- dist/edit-player-from-dialog.js | 2 +- dist/edit-room-from-dialog.js | 2 +- dist/end-from-dialog.js | 2 +- dist/exit-from-dialog.js | 2 +- dist/external-game-data.js | 2 +- dist/favicon-from-sprite.js | 2 +- dist/follower.js | 2 +- dist/gamepad-input.js | 2 +- dist/gravity.js | 2 +- dist/itsy-bitsy.js | 2 +- dist/javascript-dialog.js | 2 +- dist/logic-operators-extended.js | 2 +- dist/long-dialog.js | 2 +- dist/multi-sprite-avatar.js | 2 +- dist/noclip.js | 2 +- dist/online.js | 2 +- dist/opaque-tiles.js | 2 +- dist/palette-maps.js | 2 +- dist/paragraph-break.js | 2 +- dist/permanent-items.js | 2 +- dist/push-sprites.js | 2 +- dist/replace-drawing.js | 2 +- dist/save.js | 2 +- dist/smooth-moves.js | 2 +- dist/solid-items.js | 2 +- dist/sprite-effects.js | 514 +++++++++++++++++++++++++++ dist/stopwatch.js | 2 +- dist/text-to-speech.js | 2 +- dist/textbox-styler.js | 2 +- dist/tracery-processing.js | 2 +- dist/transitions.js | 2 +- dist/transparent-dialog.js | 2 +- dist/transparent-sprites.js | 2 +- dist/twine-bitsy-comms.js | 2 +- dist/unique-items.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 63 files changed, 582 insertions(+), 60 deletions(-) create mode 100644 dist/sprite-effects.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 307c47f5..21af5025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [13.4.0](https://github.com/seleb/bitsy-hacks/compare/v13.3.7...v13.4.0) (2020-08-21) + + +### Features + +* add sprite effects hack ([#165](https://github.com/seleb/bitsy-hacks/issues/165)) ([0de423a](https://github.com/seleb/bitsy-hacks/commit/0de423a8cc9c753525dfe93b8d0647b7647520c8)) + ## [13.3.7](https://github.com/seleb/bitsy-hacks/compare/v13.3.6...v13.3.7) (2020-08-06) diff --git a/README.md b/README.md index 9c43e77e..c02f271b 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ A collection of re-usable scripts for [Adam Le Doux](https://twitter.com/adamled - 💾 [save](/dist/save.js): save/load your game - 🏃 [smooth moves](/dist/smooth-moves.js): ease the player's movement - 🛑 [solid items](/dist/solid-items.js): treat some items like sprites that can be placed multiple times +- 💃 [sprite effects](/dist/sprite-effects.js): like text effects, but for sprites - ⏱️ [stopwatch](/dist/stopwatch.js): time player actions - 🗣 [text-to-speech](/dist/text-to-speech.js): text-to-speech for bitsy dialog - 📐 [textbox styler](/dist/textbox-styler.js): customize the style and properties of the textbox diff --git a/dist/3d.js b/dist/3d.js index f780ad90..317cdd73 100644 --- a/dist/3d.js +++ b/dist/3d.js @@ -3,7 +3,7 @@ @file 3d @summary bitsy in three dee @license MIT -@version 13.3.7 +@version 13.4.0 @requires 6.3 @author Sean S. LeBlanc & Elkie Nova diff --git a/dist/avatar-by-room.js b/dist/avatar-by-room.js index 5be6fa42..bc462432 100644 --- a/dist/avatar-by-room.js +++ b/dist/avatar-by-room.js @@ -3,7 +3,7 @@ @file avatar by room @summary change the avatar in certain rooms @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.3 @author Sean S. LeBlanc diff --git a/dist/basic-sfx.js b/dist/basic-sfx.js index ce4c4a80..2e3c7b05 100644 --- a/dist/basic-sfx.js +++ b/dist/basic-sfx.js @@ -3,7 +3,7 @@ @file basic sfx @summary "walk" and "talk" sound effect support @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/bitsymuse.js b/dist/bitsymuse.js index f9fffe30..3bd61312 100644 --- a/dist/bitsymuse.js +++ b/dist/bitsymuse.js @@ -3,7 +3,7 @@ @file bitsymuse @summary A variety of Bitsy sound and music handlers @license MIT -@version 13.3.7 +@version 13.4.0 @requires 4.8, 4.9 @author David Mowatt diff --git a/dist/canvas-replacement.js b/dist/canvas-replacement.js index 4f9603da..0d7cc41c 100644 --- a/dist/canvas-replacement.js +++ b/dist/canvas-replacement.js @@ -3,7 +3,7 @@ @file canvas replacement @summary WebGLazy bitsy integration (this one's mostly just for me) @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/character-portraits-animated.js b/dist/character-portraits-animated.js index 5ebb1bfb..ffadc10b 100644 --- a/dist/character-portraits-animated.js +++ b/dist/character-portraits-animated.js @@ -3,7 +3,7 @@ @file character portraits animated @summary high quality anime gifs @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 5.3 @author Sean S. LeBlanc diff --git a/dist/character-portraits.js b/dist/character-portraits.js index 3c00e2d6..be006372 100644 --- a/dist/character-portraits.js +++ b/dist/character-portraits.js @@ -3,7 +3,7 @@ @file character portraits @summary high quality anime jpegs (or pngs i guess) @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 5.3 @author Sean S. LeBlanc diff --git a/dist/close-on-ending.js b/dist/close-on-ending.js index fb70b154..da5852a9 100644 --- a/dist/close-on-ending.js +++ b/dist/close-on-ending.js @@ -3,7 +3,7 @@ @file close on ending @summary Prevents from playing past an ending @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/corrupt.js b/dist/corrupt.js index 08bc35e1..b28d6919 100644 --- a/dist/corrupt.js +++ b/dist/corrupt.js @@ -3,7 +3,7 @@ @file corrupt @summary corrupts gamedata at runtime @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.5 @author Sean S. LeBlanc diff --git a/dist/custom-exit-effects.js b/dist/custom-exit-effects.js index fcd95db8..808c8261 100644 --- a/dist/custom-exit-effects.js +++ b/dist/custom-exit-effects.js @@ -3,7 +3,7 @@ @file custom-exit-effects @summary make custom exit transition effects @license MIT -@version 13.3.7 +@version 13.4.0 @requires 6.0 @author Sean S. LeBlanc diff --git a/dist/custom-keyhandlers.js b/dist/custom-keyhandlers.js index aa76b812..e0456bb2 100644 --- a/dist/custom-keyhandlers.js +++ b/dist/custom-keyhandlers.js @@ -3,7 +3,7 @@ @file custom-keyhandlers @summary run custom code on key inputs @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 7.0 @author Sean S. LeBlanc diff --git a/dist/custom-text-effect.js b/dist/custom-text-effect.js index 9920ad82..d2a26c3b 100644 --- a/dist/custom-text-effect.js +++ b/dist/custom-text-effect.js @@ -3,7 +3,7 @@ @file custom text effect @summary make {custom}text effects{custom} @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.3 @author Sean S. LeBlanc diff --git a/dist/dialog-audio-vocal-synth.js b/dist/dialog-audio-vocal-synth.js index 1919d1e1..a764ea04 100644 --- a/dist/dialog-audio-vocal-synth.js +++ b/dist/dialog-audio-vocal-synth.js @@ -3,7 +3,7 @@ @file dialog audio vocal synth @summary animal crossing-style audio powered by the pink trombone vocal synth @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/dialog-audio.js b/dist/dialog-audio.js index dfc3ab23..2da4d5d5 100644 --- a/dist/dialog-audio.js +++ b/dist/dialog-audio.js @@ -3,7 +3,7 @@ @file dialog audio @summary animal crossing-style audio @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/dialog-box-transition.js b/dist/dialog-box-transition.js index 51f1a0f5..638aeec9 100644 --- a/dist/dialog-box-transition.js +++ b/dist/dialog-box-transition.js @@ -3,7 +3,7 @@ @file dialog box transition @summary adds an easing transition animation to display the dialog box text @license MIT -@version 13.3.7 +@version 13.4.0 @requires 4.8, 4.9 @author Delacannon diff --git a/dist/dialog-choices.js b/dist/dialog-choices.js index 0b63788c..2bf60925 100644 --- a/dist/dialog-choices.js +++ b/dist/dialog-choices.js @@ -3,7 +3,7 @@ @file dialog choices @summary binary dialog choices @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/dialog-jump.js b/dist/dialog-jump.js index 70f3863b..631af783 100644 --- a/dist/dialog-jump.js +++ b/dist/dialog-jump.js @@ -3,7 +3,7 @@ @file dialog jump @summary jump from one dialog entry to another @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/dialog-pause.js b/dist/dialog-pause.js index 03932424..e0461d89 100644 --- a/dist/dialog-pause.js +++ b/dist/dialog-pause.js @@ -3,7 +3,7 @@ @file dialog pause @summary add pauses in between printing text @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/dialog-prompt.js b/dist/dialog-prompt.js index a779c20c..9c006ee9 100644 --- a/dist/dialog-prompt.js +++ b/dist/dialog-prompt.js @@ -3,7 +3,7 @@ @file dialog prompt @summary prompt the user for text input in dialog @license MIT -@version 13.3.7 +@version 13.4.0 @requires 6.4 @author Sean S. LeBlanc diff --git a/dist/direction-in-dialog.js b/dist/direction-in-dialog.js index 361add0a..89ecf965 100644 --- a/dist/direction-in-dialog.js +++ b/dist/direction-in-dialog.js @@ -3,7 +3,7 @@ @file direction in dialog @summary provides a variable with player direction @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.3 @author Sean S. LeBlanc diff --git a/dist/directional-avatar.js b/dist/directional-avatar.js index 6dadfba5..152707c6 100644 --- a/dist/directional-avatar.js +++ b/dist/directional-avatar.js @@ -3,7 +3,7 @@ @file directional avatar @summary flips the player's sprite based on directional movement @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.3 @author Sean S. LeBlanc diff --git a/dist/dynamic-background.js b/dist/dynamic-background.js index 271a2e7d..df3c6aea 100644 --- a/dist/dynamic-background.js +++ b/dist/dynamic-background.js @@ -3,7 +3,7 @@ @file dynamic background @summary HTML background matching bitsy background @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/edit-dialog-from-dialog.js b/dist/edit-dialog-from-dialog.js index 5feec4f4..c05a61fe 100644 --- a/dist/edit-dialog-from-dialog.js +++ b/dist/edit-dialog-from-dialog.js @@ -3,7 +3,7 @@ @file edit dialog from dialog @summary edit dialog from dialog (yes really) @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/edit-image-from-dialog.js b/dist/edit-image-from-dialog.js index 94b641ea..34d04be0 100644 --- a/dist/edit-image-from-dialog.js +++ b/dist/edit-image-from-dialog.js @@ -3,7 +3,7 @@ @file edit image from dialog @summary edit sprites, items, and tiles from dialog @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.3 @author Sean S. LeBlanc diff --git a/dist/edit-player-from-dialog.js b/dist/edit-player-from-dialog.js index 83e4cb70..5ae10ca9 100644 --- a/dist/edit-player-from-dialog.js +++ b/dist/edit-player-from-dialog.js @@ -3,7 +3,7 @@ @file edit player from dialog @summary change which sprite is controlled by the player @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/edit-room-from-dialog.js b/dist/edit-room-from-dialog.js index c4d1d9da..1826b49d 100644 --- a/dist/edit-room-from-dialog.js +++ b/dist/edit-room-from-dialog.js @@ -3,7 +3,7 @@ @file edit room from dialog @summary modify the content of a room from dialog @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 6.1 @author Dana Holdampf diff --git a/dist/end-from-dialog.js b/dist/end-from-dialog.js index 164fc924..f8bca811 100644 --- a/dist/end-from-dialog.js +++ b/dist/end-from-dialog.js @@ -3,7 +3,7 @@ @file end-from-dialog @summary trigger an ending from dialog, including narration text @license WTFPL (do WTF you want) -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 7.0 @author @mildmojo diff --git a/dist/exit-from-dialog.js b/dist/exit-from-dialog.js index d7e20cf0..59d0750f 100644 --- a/dist/exit-from-dialog.js +++ b/dist/exit-from-dialog.js @@ -3,7 +3,7 @@ @file exit-from-dialog @summary exit to another room from dialog, including conditionals @license WTFPL (do WTF you want) -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 7.0 @author @mildmojo diff --git a/dist/external-game-data.js b/dist/external-game-data.js index 2e115a92..60f6a905 100644 --- a/dist/external-game-data.js +++ b/dist/external-game-data.js @@ -3,7 +3,7 @@ @file external-game-data @summary separate Bitsy game data from your (modded) HTML for easier development @license WTFPL (do WTF you want) -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 4.5, 4.6 @author @mildmojo diff --git a/dist/favicon-from-sprite.js b/dist/favicon-from-sprite.js index 576cef3d..6ef0b02d 100644 --- a/dist/favicon-from-sprite.js +++ b/dist/favicon-from-sprite.js @@ -3,7 +3,7 @@ @file favicon-from-sprite @summary generate a browser favicon (tab icon) from a Bitsy sprite, including animation! @license WTFPL (do WTF you want) -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 5.5 @author @mildmojo diff --git a/dist/follower.js b/dist/follower.js index bca51e22..af4bc4b3 100644 --- a/dist/follower.js +++ b/dist/follower.js @@ -3,7 +3,7 @@ @file follower @summary makes a single sprite follow the player @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/gamepad-input.js b/dist/gamepad-input.js index 2e4d8e3a..2b738bfd 100644 --- a/dist/gamepad-input.js +++ b/dist/gamepad-input.js @@ -3,7 +3,7 @@ @file gamepad input @summary HTML5 gamepad support @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 5.1 @author Sean S. LeBlanc diff --git a/dist/gravity.js b/dist/gravity.js index 18a90d4e..e97e236b 100644 --- a/dist/gravity.js +++ b/dist/gravity.js @@ -3,7 +3,7 @@ @file gravity @summary Pseudo-platforming/gravity/physics @license MIT -@version 13.3.7 +@version 13.4.0 @requires 6.3 @author Cole Sea diff --git a/dist/itsy-bitsy.js b/dist/itsy-bitsy.js index 366d0acd..02820c9b 100644 --- a/dist/itsy-bitsy.js +++ b/dist/itsy-bitsy.js @@ -3,7 +3,7 @@ @file itsy-bitsy @summary for when bitsy's not small enough @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 5.1 @author Sean S. LeBlanc diff --git a/dist/javascript-dialog.js b/dist/javascript-dialog.js index 859f170e..e3b3c581 100644 --- a/dist/javascript-dialog.js +++ b/dist/javascript-dialog.js @@ -3,7 +3,7 @@ @file javascript dialog @summary execute arbitrary javascript from dialog @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 4.5, 4.6 @author Sean S. LeBlanc diff --git a/dist/logic-operators-extended.js b/dist/logic-operators-extended.js index 9ee44283..785bfdde 100644 --- a/dist/logic-operators-extended.js +++ b/dist/logic-operators-extended.js @@ -2,7 +2,7 @@ 🔀 @file logic-operators-extended @summary adds conditional logic operators -@version 13.3.7 +@version 13.4.0 @author @mildmojo @description diff --git a/dist/long-dialog.js b/dist/long-dialog.js index ea37621b..a93ccc97 100644 --- a/dist/long-dialog.js +++ b/dist/long-dialog.js @@ -3,7 +3,7 @@ @file long dialog @summary put more words onscreen @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/multi-sprite-avatar.js b/dist/multi-sprite-avatar.js index ce6c48c8..348c1902 100644 --- a/dist/multi-sprite-avatar.js +++ b/dist/multi-sprite-avatar.js @@ -3,7 +3,7 @@ @file multi-sprite avatar @summary make the player big @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/noclip.js b/dist/noclip.js index 69abc378..addb4d9c 100644 --- a/dist/noclip.js +++ b/dist/noclip.js @@ -3,7 +3,7 @@ @file noclip @summary walk through wall tiles, sprites, items, exits, and endings @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/online.js b/dist/online.js index d0fb3613..554c515d 100644 --- a/dist/online.js +++ b/dist/online.js @@ -3,7 +3,7 @@ @file online @summary multiplayer bitsy @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc @description diff --git a/dist/opaque-tiles.js b/dist/opaque-tiles.js index 65ffb26f..936f6c89 100644 --- a/dist/opaque-tiles.js +++ b/dist/opaque-tiles.js @@ -3,7 +3,7 @@ @file opaque tiles @summary tiles which hide the player @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/palette-maps.js b/dist/palette-maps.js index f8f0f69c..d4e11140 100644 --- a/dist/palette-maps.js +++ b/dist/palette-maps.js @@ -3,7 +3,7 @@ @file palette maps @summary allows color pallettes to be defined on a tile-by-tile basis @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 6.1 @author Dana Holdampf diff --git a/dist/paragraph-break.js b/dist/paragraph-break.js index b2984b5b..aaef332d 100644 --- a/dist/paragraph-break.js +++ b/dist/paragraph-break.js @@ -3,7 +3,7 @@ @file paragraph-break @summary Adds paragraph breaks to the dialogue parser @license WTFPL (do WTF you want) -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 5.0, 5.1 @author Sean S. LeBlanc, David Mowatt diff --git a/dist/permanent-items.js b/dist/permanent-items.js index 4bae0650..26afbc2f 100644 --- a/dist/permanent-items.js +++ b/dist/permanent-items.js @@ -3,7 +3,7 @@ @file permanent items @summary prevent some items from being picked up @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/push-sprites.js b/dist/push-sprites.js index b2ea3535..66942f7b 100644 --- a/dist/push-sprites.js +++ b/dist/push-sprites.js @@ -3,7 +3,7 @@ @file push sprites @summary sokoban-style sprite pushing @license MIT -@version 13.3.7 +@version 13.4.0 @requires 6.4 @author jan0sc diff --git a/dist/replace-drawing.js b/dist/replace-drawing.js index b81c770d..45bca577 100644 --- a/dist/replace-drawing.js +++ b/dist/replace-drawing.js @@ -3,7 +3,7 @@ @file replace drawing @summary add name-tags to replace drawings when the game is loading @license MIT -@version 13.3.7 +@version 13.4.0 @requires 6.3 @author Elkie Nova diff --git a/dist/save.js b/dist/save.js index 3233dfb5..66461bcc 100644 --- a/dist/save.js +++ b/dist/save.js @@ -3,7 +3,7 @@ @file save @summary save/load your game @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.4 @author Sean S. LeBlanc diff --git a/dist/smooth-moves.js b/dist/smooth-moves.js index 54e09a93..b829c9d8 100644 --- a/dist/smooth-moves.js +++ b/dist/smooth-moves.js @@ -3,7 +3,7 @@ @file smooth moves @summary ease the player's movement @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 6.3 @author Sean S. LeBlanc diff --git a/dist/solid-items.js b/dist/solid-items.js index 1a39ea44..b2417a99 100644 --- a/dist/solid-items.js +++ b/dist/solid-items.js @@ -3,7 +3,7 @@ @file solid items @summary treat some items like sprites that can be placed multiple times @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/sprite-effects.js b/dist/sprite-effects.js new file mode 100644 index 00000000..0ffae789 --- /dev/null +++ b/dist/sprite-effects.js @@ -0,0 +1,514 @@ +/** +💃 +@file sprite effects +@summary like text effects, but for sprites +@license MIT +@version 13.4.0 +@requires 7.1 +@author Sean S. LeBlanc + +@description +Adds support for applying effects to sprites, items, and tiles. + +Usage: + {spriteEffect "SPR,A,wvy"} + {spriteEffectNow "TIL,a,shk"} + +To disable a text effect, call the dialog command again with the same parameters. + +Note that if a name is used instead of an id, +only the first tile with that name is affected. + +HOW TO USE: +1. Copy-paste this script into a script tag after the bitsy source +2. Update the `hackOptions` object at the top of the script with your custom effects + +EFFECT NOTES: +Each effect looks like: + key: function(pos, time, context) { + ... + } + +The key is the name of the effect, used in the dialog command to apply it. + +The function is called every frame before rendering the images it is applied to. +The function arguments are: + pos: has the properties `x` and `y`; can be used to modify rendered position + time: the current time in milliseconds; can be used to animate effects over time + context: the 2D canvas rendering context; can be used for various advanced effects + (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) +*/ +this.hacks = this.hacks || {}; +(function (exports, bitsy) { +'use strict'; +var hackOptions = { + // map of custom effects + effects: { + wvy: function (pos, time) { + // sample effect based on bitsy's {wvy} text + pos.y += (Math.sin(time / 250 - pos.x / 2) * 4) / bitsy.mapsize; + }, + shk: function (pos, time) { + // sample effect based on bitsy's {shk} text + function disturb(func, offset, mult1, mult2) { + return func(time * mult1 - offset * mult2); + } + var y = (3 / bitsy.mapsize) * disturb(Math.sin, pos.x, 0.1, 0.5) * disturb(Math.cos, pos.x, 0.3, 0.2) * disturb(Math.sin, pos.y, 2.0, 1.0); + var x = (3 / bitsy.mapsize) * disturb(Math.cos, pos.y, 0.1, 1.0) * disturb(Math.sin, pos.x, 3.0, 0.7) * disturb(Math.cos, pos.x, 0.2, 0.3); + pos.x += x; + pos.y += y; + }, + rbw: function (pos, time, context) { + // sample effect based on bitsy's {rbw} text + // note that this uses CSS filters (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter) + var t = Math.sin(time / 600 - (pos.x + pos.y) / 8); + context.filter = 'grayscale() sepia() saturate(2) hue-rotate(' + t + 'turn)'; + }, + invert: function (pos, time, context) { + context.filter = 'invert()'; + }, + }, + // reset function called after drawing a tile + // this can be used to undo any modifications to the canvas or context + reset: function (img, context) { + context.filter = 'none'; + }, +}; + +bitsy = bitsy && Object.prototype.hasOwnProperty.call(bitsy, 'default') ? bitsy['default'] : bitsy; + +/** +@file utils +@summary miscellaneous bitsy utilities +@author Sean S. LeBlanc +*/ + +/* +Helper used to replace code in a script tag based on a search regex +To inject code without erasing original string, using capturing groups; e.g. + inject(/(some string)/,'injected before $1 injected after') +*/ +function inject(searchRegex, replaceString) { + // find the relevant script tag + var scriptTags = document.getElementsByTagName('script'); + var scriptTag; + var code; + for (var i = 0; i < scriptTags.length; ++i) { + scriptTag = scriptTags[i]; + var matchesSearch = scriptTag.textContent.search(searchRegex) !== -1; + var isCurrentScript = scriptTag === document.currentScript; + if (matchesSearch && !isCurrentScript) { + code = scriptTag.textContent; + break; + } + } + + // error-handling + if (!code) { + throw new Error('Couldn\'t find "' + searchRegex + '" in script tags'); + } + + // modify the content + code = code.replace(searchRegex, replaceString); + + // replace the old script tag with a new one using our modified code + var newScriptTag = document.createElement('script'); + newScriptTag.textContent = code; + scriptTag.insertAdjacentElement('afterend', newScriptTag); + scriptTag.remove(); +} + +/* +Helper for getting image by name or id + +Args: + name: id or name of image to return + map: map of images (e.g. `sprite`, `tile`, `item`) + +Returns: the image in the given map with the given name/id + */ +function getImage(name, map) { + var id = Object.prototype.hasOwnProperty.call(map, name) ? name : Object.keys(map).find(function (e) { + return map[e].name === name; + }); + return map[id]; +} + +/** + * Helper for getting an array with unique elements + * @param {Array} array Original array + * @return {Array} Copy of array, excluding duplicates + */ +function unique(array) { + return array.filter(function (item, idx) { + return array.indexOf(item) === idx; + }); +} + +/** + +@file kitsy-script-toolkit +@summary makes it easier and cleaner to run code before and after Bitsy functions or to inject new code into Bitsy script tags +@license WTFPL (do WTF you want) +@requires Bitsy Version: 4.5, 4.6 +@author @mildmojo + +@description +HOW TO USE: + import {before, after, inject, addDialogTag, addDeferredDialogTag} from "./helpers/kitsy-script-toolkit"; + + before(targetFuncName, beforeFn); + after(targetFuncName, afterFn); + inject(searchRegex, replaceString); + addDialogTag(tagName, dialogFn); + addDeferredDialogTag(tagName, dialogFn); + + For more info, see the documentation at: + https://github.com/seleb/bitsy-hacks/wiki/Coding-with-kitsy +*/ + +// Ex: inject(/(names.sprite.set\( name, id \);)/, '$1console.dir(names)'); +function inject$1(searchRegex, replaceString) { + var kitsy = kitsyInit(); + if ( + !kitsy.queuedInjectScripts.some(function (script) { + return searchRegex.toString() === script.searchRegex.toString() && replaceString === script.replaceString; + }) + ) { + kitsy.queuedInjectScripts.push({ + searchRegex: searchRegex, + replaceString: replaceString, + }); + } else { + console.warn('Ignored duplicate inject'); + } +} + +// Ex: before('load_game', function run() { alert('Loading!'); }); +// before('show_text', function run(text) { return text.toUpperCase(); }); +// before('show_text', function run(text, done) { done(text.toUpperCase()); }); +function before(targetFuncName, beforeFn) { + var kitsy = kitsyInit(); + kitsy.queuedBeforeScripts[targetFuncName] = kitsy.queuedBeforeScripts[targetFuncName] || []; + kitsy.queuedBeforeScripts[targetFuncName].push(beforeFn); +} + +// Ex: after('load_game', function run() { alert('Loaded!'); }); +function after(targetFuncName, afterFn) { + var kitsy = kitsyInit(); + kitsy.queuedAfterScripts[targetFuncName] = kitsy.queuedAfterScripts[targetFuncName] || []; + kitsy.queuedAfterScripts[targetFuncName].push(afterFn); +} + +function kitsyInit() { + // return already-initialized kitsy + if (bitsy.kitsy) { + return bitsy.kitsy; + } + + // Initialize kitsy + bitsy.kitsy = { + queuedInjectScripts: [], + queuedBeforeScripts: {}, + queuedAfterScripts: {}, + }; + + var oldStartFunc = bitsy.startExportedGame; + bitsy.startExportedGame = function doAllInjections() { + // Only do this once. + bitsy.startExportedGame = oldStartFunc; + + // Rewrite scripts and hook everything up. + doInjects(); + applyAllHooks(); + + // Start the game + bitsy.startExportedGame.apply(this, arguments); + }; + + return bitsy.kitsy; +} + +function doInjects() { + bitsy.kitsy.queuedInjectScripts.forEach(function (injectScript) { + inject(injectScript.searchRegex, injectScript.replaceString); + }); + reinitEngine(); +} + +function applyAllHooks() { + var allHooks = unique(Object.keys(bitsy.kitsy.queuedBeforeScripts).concat(Object.keys(bitsy.kitsy.queuedAfterScripts))); + allHooks.forEach(applyHook); +} + +function applyHook(functionName) { + var functionNameSegments = functionName.split('.'); + var obj = bitsy; + while (functionNameSegments.length > 1) { + obj = obj[functionNameSegments.shift()]; + } + var lastSegment = functionNameSegments[0]; + var superFn = obj[lastSegment]; + var superFnLength = superFn ? superFn.length : 0; + var functions = []; + // start with befores + functions = functions.concat(bitsy.kitsy.queuedBeforeScripts[functionName] || []); + // then original + if (superFn) { + functions.push(superFn); + } + // then afters + functions = functions.concat(bitsy.kitsy.queuedAfterScripts[functionName] || []); + + // overwrite original with one which will call each in order + obj[lastSegment] = function () { + var returnVal; + var args = [].slice.call(arguments); + var i = 0; + + function runBefore() { + // All outta functions? Finish + if (i === functions.length) { + return returnVal; + } + + // Update args if provided. + if (arguments.length > 0) { + args = [].slice.call(arguments); + } + + if (functions[i].length > superFnLength) { + // Assume funcs that accept more args than the original are + // async and accept a callback as an additional argument. + return functions[i++].apply(this, args.concat(runBefore.bind(this))); + } + // run synchronously + returnVal = functions[i++].apply(this, args); + if (returnVal && returnVal.length) { + args = returnVal; + } + return runBefore.apply(this, args); + } + + return runBefore.apply(this, arguments); + }; +} + +function reinitEngine() { + // recreate the script and dialog objects so that they'll be + // referencing the code with injections instead of the original + bitsy.scriptModule = new bitsy.Script(); + bitsy.scriptInterpreter = bitsy.scriptModule.CreateInterpreter(); + + bitsy.dialogModule = new bitsy.Dialog(); + bitsy.dialogRenderer = bitsy.dialogModule.CreateRenderer(); + bitsy.dialogBuffer = bitsy.dialogModule.CreateBuffer(); +} + +// Rewrite custom functions' parentheses to curly braces for Bitsy's +// interpreter. Unescape escaped parentheticals, too. +function convertDialogTags(input, tag) { + return input + .replace(new RegExp('\\\\?\\((' + tag + '(\\s+(".*?"|.+?))?)\\\\?\\)', 'g'), function (match, group) { + if (match.substr(0, 1) === '\\') { + return '(' + group + ')'; // Rewrite \(tag "..."|...\) to (tag "..."|...) + } + return '{' + group + '}'; // Rewrite (tag "..."|...) to {tag "..."|...} + }); +} + +function addDialogFunction(tag, fn) { + var kitsy = kitsyInit(); + kitsy.dialogFunctions = kitsy.dialogFunctions || {}; + if (kitsy.dialogFunctions[tag]) { + console.warn('The dialog function "' + tag + '" already exists.'); + return; + } + + // Hook into game load and rewrite custom functions in game data to Bitsy format. + before('parseWorld', function (gameData) { + return [convertDialogTags(gameData, tag)]; + }); + + kitsy.dialogFunctions[tag] = fn; +} + +function injectDialogTag(tag, code) { + inject$1( + /(var functionMap = new Map\(\);[^]*?)(this.HasFunction)/m, + '$1\nfunctionMap.set("' + tag + '", ' + code + ');\n$2', + ); +} + +/** + * Adds a custom dialog tag which executes the provided function. + * For ease-of-use with the bitsy editor, tags can be written as + * (tagname "parameters") in addition to the standard {tagname "parameters"} + * + * Function is executed immediately when the tag is reached. + * + * @param {string} tag Name of tag + * @param {Function} fn Function to execute, with signature `function(environment, parameters, onReturn){}` + * environment: provides access to SetVariable/GetVariable (among other things, see Environment in the bitsy source for more info) + * parameters: array containing parameters as string in first element (i.e. `parameters[0]`) + * onReturn: function to call with return value (just call `onReturn(null);` at the end of your function if your tag doesn't interact with the logic system) + */ +function addDialogTag(tag, fn) { + addDialogFunction(tag, fn); + injectDialogTag(tag, 'kitsy.dialogFunctions["' + tag + '"]'); +} + +/** + * Adds a custom dialog tag which executes the provided function. + * For ease-of-use with the bitsy editor, tags can be written as + * (tagname "parameters") in addition to the standard {tagname "parameters"} + * + * Function is executed after the dialog box. + * + * @param {string} tag Name of tag + * @param {Function} fn Function to execute, with signature `function(environment, parameters){}` + * environment: provides access to SetVariable/GetVariable (among other things, see Environment in the bitsy source for more info) + * parameters: array containing parameters as string in first element (i.e. `parameters[0]`) + */ +function addDeferredDialogTag(tag, fn) { + addDialogFunction(tag, fn); + bitsy.kitsy.deferredDialogFunctions = bitsy.kitsy.deferredDialogFunctions || {}; + var deferred = bitsy.kitsy.deferredDialogFunctions[tag] = []; + injectDialogTag(tag, 'function(e, p, o){ kitsy.deferredDialogFunctions["' + tag + '"].push({e:e,p:p}); o(null); }'); + // Hook into the dialog finish event and execute the actual function + after('onExitDialog', function () { + while (deferred.length) { + var args = deferred.shift(); + bitsy.kitsy.dialogFunctions[tag](args.e, args.p, args.o); + } + }); + // Hook into the game reset and make sure data gets cleared + after('clearGameData', function () { + deferred.length = 0; + }); +} + +/** + * Adds two custom dialog tags which execute the provided function, + * one with the provided tagname executed after the dialog box, + * and one suffixed with 'Now' executed immediately when the tag is reached. + * + * i.e. helper for the (exit)/(exitNow) pattern. + * + * @param {string} tag Name of tag + * @param {Function} fn Function to execute, with signature `function(environment, parameters){}` + * environment: provides access to SetVariable/GetVariable (among other things, see Environment in the bitsy source for more info) + * parameters: array containing parameters as string in first element (i.e. `parameters[0]`) + */ +function addDualDialogTag(tag, fn) { + addDialogTag(tag + 'Now', function (environment, parameters, onReturn) { + fn(environment, parameters); + onReturn(null); + }); + addDeferredDialogTag(tag, fn); +} + + + + + +var activeEffects = { + tile: {}, + sprite: {}, + item: {}, +}; + +// create a map of the images to be rendered for reference +// note: this is being done after `drawRoom` to avoid interfering +// with transparent sprites, which needs to pre-process first +var tileMap = { + tile: {}, + sprite: {}, + item: {}, +}; +function buildMap(map, room) { + var m = tileMap[map]; + Object.keys(activeEffects[map]).forEach(function (id) { + var tile = bitsy[map][id]; + if (!tile) { + return; + } + var t = (m[id] = m[id] || {}); + var p = (t[room.pal] = t[room.pal] || {}); + new Array(tile.animation.frameCount).fill(0).forEach(function (_, frame) { + p[frame] = bitsy.getTileImage(tile, room.pal, frame); + }); + }); +} +after('drawRoom', function (room) { + buildMap('tile', room); + buildMap('sprite', room); + buildMap('item', room); +}); + +// apply effects before rendering tiles +function preprocess(map, img, x, y, context) { + var m = tileMap[map]; + var foundEffects = Object.entries(activeEffects[map]).find(function (entry) { + var t = m && m[entry[0]]; + var p = t && t[bitsy.room[bitsy.curRoom].pal]; + return ( + p + && Object.values(p).some(function (frame) { + return frame === img; + }) + ); + }); + var effects = foundEffects ? foundEffects[1] : []; + + var totalPos = { x: Number(x), y: Number(y) }; + Object.keys(effects).forEach(function (effect) { + var pos = { x: totalPos.x, y: totalPos.y }; + hackOptions.effects[effect](pos, Date.now(), context); + totalPos = pos; + }); + return [img, totalPos.x.toString(), totalPos.y.toString(), context]; +} +before('drawTile', function (img, x, y, context) { + return preprocess('tile', img, x, y, context); +}); +before('drawSprite', function (img, x, y, context) { + return preprocess('sprite', img, x, y, context); +}); +before('drawItem', function (img, x, y, context) { + return preprocess('item', img, x, y, context); +}); + +// reset after having drawn a tile +after('drawTile', function (img, x, y, context) { + hackOptions.reset(img, context); +}); + +// setup dialog commands +var mapMap = { + spr: 'sprite', + sprite: 'sprite', + itm: 'item', + item: 'item', + til: 'tile', + tile: 'tile', +}; +addDualDialogTag('spriteEffect', function (environment, parameters) { + var params = parameters[0].split(/,\s?/); + var map = mapMap[(params[0] || '').toLowerCase()]; + var id = getImage(params[1] || '', bitsy[map]).id; + var effect = params[2] || ''; + if (!hackOptions.effects[effect]) { + throw new Error('Tried to use sprite effect "' + effect + '", but it does not exist'); + } + var tile = (activeEffects[map][id] = activeEffects[map][id] || {}); + if (tile && tile[effect]) { + delete tile[effect]; + } else { + tile[effect] = true; + } +}); + +exports.hackOptions = hackOptions; + +}(this.hacks.sprite_effects = this.hacks.sprite_effects || {}, window)); diff --git a/dist/stopwatch.js b/dist/stopwatch.js index a0d9e1e6..4dd3b808 100644 --- a/dist/stopwatch.js +++ b/dist/stopwatch.js @@ -3,7 +3,7 @@ @file stopwatch @summary time player actions @license MIT -@version 13.3.7 +@version 13.4.0 @author Lenny Magner @description diff --git a/dist/text-to-speech.js b/dist/text-to-speech.js index d52c6bb3..86aff099 100644 --- a/dist/text-to-speech.js +++ b/dist/text-to-speech.js @@ -3,7 +3,7 @@ @file text-to-speech @summary text-to-speech for bitsy dialog @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.5 @author Sean S. LeBlanc diff --git a/dist/textbox-styler.js b/dist/textbox-styler.js index 258fb5df..46ab5db5 100644 --- a/dist/textbox-styler.js +++ b/dist/textbox-styler.js @@ -3,7 +3,7 @@ @file textbox styler @summary customize the style and properties of the textbox @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 6.1 @author Dana Holdampf & Sean S. LeBlanc diff --git a/dist/tracery-processing.js b/dist/tracery-processing.js index e85c7d96..b72a2b70 100644 --- a/dist/tracery-processing.js +++ b/dist/tracery-processing.js @@ -3,7 +3,7 @@ @file tracery processing @summary process all dialog text with a tracery grammar @license MIT -@version 13.3.7 +@version 13.4.0 @requires 7.0 @author Sean S. LeBlanc diff --git a/dist/transitions.js b/dist/transitions.js index 8434c2ba..b2cec6a2 100644 --- a/dist/transitions.js +++ b/dist/transitions.js @@ -3,7 +3,7 @@ @file transitions @summary customizable WebGL transitions @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/transparent-dialog.js b/dist/transparent-dialog.js index 16a65ff6..d0d54c5d 100644 --- a/dist/transparent-dialog.js +++ b/dist/transparent-dialog.js @@ -3,7 +3,7 @@ @file transparent dialog @summary makes the dialog box have a transparent background @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/dist/transparent-sprites.js b/dist/transparent-sprites.js index 1627737f..b60e8f6e 100644 --- a/dist/transparent-sprites.js +++ b/dist/transparent-sprites.js @@ -3,7 +3,7 @@ @file transparent sprites @summary makes all sprites have transparent backgrounds @license MIT -@version 13.3.7 +@version 13.4.0 @requires Bitsy Version: 6.1 @author Sean S. LeBlanc diff --git a/dist/twine-bitsy-comms.js b/dist/twine-bitsy-comms.js index 2f1f3984..363c8989 100644 --- a/dist/twine-bitsy-comms.js +++ b/dist/twine-bitsy-comms.js @@ -3,7 +3,7 @@ @file twine bitsy comms @summary interprocess communication for twine and bitsy @license MIT -@version 13.3.7 +@version 13.4.0 @requires 5.4 @author Sean S. LeBlanc diff --git a/dist/unique-items.js b/dist/unique-items.js index 92ad5e21..9a4b0fe1 100644 --- a/dist/unique-items.js +++ b/dist/unique-items.js @@ -3,7 +3,7 @@ @file unique items @summary items which, when picked up, remove all other instances of that item from the game @license MIT -@version 13.3.7 +@version 13.4.0 @author Sean S. LeBlanc @description diff --git a/package-lock.json b/package-lock.json index 5136e68a..a0bef749 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@bitsy/hecks", - "version": "13.3.7", + "version": "13.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 208a14cb..bc1dac9f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "hacks" ], "main": "index.mjs", - "version": "13.3.7", + "version": "13.4.0", "scripts": { "build": "rollup -c", "test": "jest --runInBand",