@hi-ashleyj/llama 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,11 +9,20 @@ export let h = 0;
9
9
  * TRUE = ANCHOR CENTER
10
10
  */
11
11
  export let centered = false;
12
+ export let opacity = 1;
12
13
  $: ax = (centered) ? x - (w / 2) : x;
13
14
  $: ay = (centered) ? y - (h / 2) : y;
14
15
  const targets = new Set();
15
16
  const draw = function ({ width, height, ctx }) {
17
+ if (opacity <= 0)
18
+ return;
19
+ if (opacity < 1) {
20
+ ctx.globalAlpha = opacity;
21
+ }
16
22
  targets.forEach(f => f.draw({ width, height, ctx }, { x: ax, y: ay, w, h }));
23
+ if (opacity < 1) {
24
+ ctx.globalAlpha = 1;
25
+ }
17
26
  };
18
27
  let register = setupDrawable({
19
28
  assign: (ctx) => {
@@ -9,6 +9,7 @@ declare const __propDef: {
9
9
  * FALSE = ANCHOR TOP LEFT
10
10
  * TRUE = ANCHOR CENTER
11
11
  */ centered?: boolean | undefined;
12
+ opacity?: number | undefined;
12
13
  };
13
14
  events: {
14
15
  [evt: string]: CustomEvent<any>;
@@ -20,7 +20,7 @@ export class Controller {
20
20
  this.keyState.set(eklc, true);
21
21
  this.events.forEach(({ key, action, call }) => {
22
22
  if ((key === eklc || key === null) && action === CONTROLLER_ACTION.DOWN)
23
- call({ key, action });
23
+ call({ key: eklc, action });
24
24
  });
25
25
  if (this.keyStores.has(eklc)) {
26
26
  this.keyStores.get(eklc)?.set(true);
@@ -31,7 +31,7 @@ export class Controller {
31
31
  this.keyState.set(eklc, false);
32
32
  this.events.forEach(({ key, action, call }) => {
33
33
  if ((key === eklc || key === null) && action === CONTROLLER_ACTION.UP)
34
- call({ key, action });
34
+ call({ key: eklc, action });
35
35
  });
36
36
  if (this.keyStores.has(eklc)) {
37
37
  this.keyStores.get(eklc)?.set(false);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hi-ashleyj/llama",
3
3
  "description": "A (Very Incomplete) 2D Canvas Game Engine powered by Svelte",
4
- "version": "0.3.4",
4
+ "version": "0.4.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",