Skip to content

Commit

Permalink
hotfix: fixes when adding instance to layer not recieving config
Browse files Browse the repository at this point in the history
  • Loading branch information
doubleactii committed Nov 14, 2024
1 parent cd239b8 commit 90a2f71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parallax",
"version": "1.1.0",
"version": "1.1.1",
"description": "A parallax module that will enable effortless integration of depth effects into your game.",
"main": "src/parallax.mjs",
"scripts": {
Expand Down
9 changes: 8 additions & 1 deletion src/layer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,15 @@ export class Layer {
* @prop {boolean} pConfig.loop - Whether this instance will be treated as a background and loop seamlessly.
*/
add(pInstance, pConfig) {
if (this.config.instances.has(pInstance)) return;
this.config.instances.add(pInstance);
Parallax.add(pInstance, pConfig);
const config = pConfig
? pConfig
: {
x: this.config.horizontalSpeed,
y: this.config.verticalSpeed
}
Parallax.add(pInstance, config);
}
/**
* Removes the instance from the parallax layer.
Expand Down

0 comments on commit 90a2f71

Please sign in to comment.