Skip to content

Commit

Permalink
feat: add transparent background hack
Browse files Browse the repository at this point in the history
  • Loading branch information
seleb committed Jan 2, 2021
1 parent 1552386 commit 3713fef
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/transparent background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
🔳
@file transparent background
@summary makes the game have a transparent background
@license MIT
@version auto
@requires Bitsy Version: 7.2
@author Cephalopodunk & Sean S. LeBlanc
@description
Makes the game background transparent, showing whatever would be visible behind it in the html document.
Note: also includes transparent sprites
HOW TO USE:
1. Copy-paste this script into a script tag after the bitsy source
2. Edit hackOptions below as needed
*/
import { inject } from './helpers/kitsy-script-toolkit';
import { hackOptions as transparentSprites } from './transparent sprites';

export var hackOptions = {
// transparent sprites option
isTransparent: function (drawing) {
// return drawing.name == 'tea'; // specific transparent drawing
// return ['tea', 'flower', 'hat'].indexOf(drawing.name) !== -1; // specific transparent drawing list
// return drawing.name && drawing.name.indexOf('TRANSPARENT') !== -1; // transparent drawing flag in name
return true; // all drawings are transparent
},
};

transparentSprites.isTransparent = function (drawing) {
return hackOptions.isTransparent(drawing);
};

inject(/ctx.fillRect(\(0,0,canvas.width,canvas.height\);)/g, 'ctx.clearRect$1');
inject(/context.fillRect(\(0,0,canvas.width,canvas.height\);)/g, 'context.clearRect$1');

0 comments on commit 3713fef

Please sign in to comment.