diff --git a/app/ecs/components/ttl.js b/app/ecs/components/ttl.js index 3311011..1e03c20 100644 --- a/app/ecs/components/ttl.js +++ b/app/ecs/components/ttl.js @@ -5,6 +5,12 @@ export default class Ttl extends Component { const {ecs} = this; return class TtlInstance extends super.instanceFromSchema() { $$elapsed = 0; + get elapsed() { + return this.$$elapsed; + } + set elapsed(elapsed) { + this.$$elapsed = elapsed; + } $$reset() { this.$$elapsed = 0; } diff --git a/public/assets/hoe/start.js b/public/assets/hoe/start.js index d466a01..2ffccbd 100644 --- a/public/assets/hoe/start.js +++ b/public/assets/hoe/start.js @@ -13,7 +13,7 @@ if (projected?.length > 0) { Sound.play('/assets/hoe/dig.wav'); for (const {x, y} of projected) { Emitter.emit({ - count: 75, + count: 30, fields: [ { path: ['Sprite', 'lightness'], @@ -21,34 +21,35 @@ if (projected?.length > 0) { }, { path: ['Sprite', 'alpha'], - value: [0.3, 1], + value: [0.5, 1], }, { - path: ['Sprite', 'scaleX'], - value: [0.05, 0.3], - }, - { - path: ['Sprite', 'scaleY'], - value: [0.05, 0.3], + path: ['Sprite', 'scale'], + value: [0.05, 0.1], }, ], - frequency: 0.004, + frequency: 0.006, shape: { type: 'filledRect', - payload: {width: 16, height: 16}, + payload: {width: 12, height: 12}, }, entity: { - Forces: {forceY: -40}, + Behaving: { + routines: { + initial: 'await delta(entity.Forces, {forceY: {delta: 640, duration: 0.125}}).promise', + }, + }, + Forces: {forceY: -80}, Position: { x: x * layer.tileSize.x + (layer.tileSize.x / 2), y: y * layer.tileSize.y + (layer.tileSize.y / 2), }, Sprite: { - scaleX: 0.2, - scaleY: 0.2, + scaleX: 0.05, + scaleY: 0.05, tint: 0x552200, }, - Ttl: {ttl: 0.125}, + Ttl: {ttl: 0.35}, } }); } diff --git a/public/assets/magic-swords/start.js b/public/assets/magic-swords/start.js index 472a895..49c9acc 100644 --- a/public/assets/magic-swords/start.js +++ b/public/assets/magic-swords/start.js @@ -38,6 +38,7 @@ for (let i = 0; i < N; ++i) { source: '/assets/magic-swords/magic-sword-shot.json', }, Ticking: {}, + Ttl: {ttl: 1.5}, VisibleAabb: {}, })); } @@ -57,6 +58,7 @@ while (shots.length > 0) { spawner += elapsed; if (creating.length > 0 && spawner >= EVERY) { const shot = creating.shift(); + shot.Ttl.elapsed = 0; shot.Sprite.alpha = 1; accumulated[shot.id] = 0; shots.push(shot) @@ -77,6 +79,7 @@ while (shots.length > 0) { shot.Direction.direction = (Math.TAU + toward) % Math.TAU; if (Math.distance(where, shot.Position) < 4) { delete accumulated[shot.id]; + shot.Ttl.elapsed = 0; shot.Sprite.alpha = 0; ecs.destroy(shot.id); destroying.push(shot); diff --git a/public/assets/watering-can/start.js b/public/assets/watering-can/start.js index 3643eb3..3a125c0 100644 --- a/public/assets/watering-can/start.js +++ b/public/assets/watering-can/start.js @@ -14,30 +14,35 @@ if (projected?.length > 0) { for (const {x, y} of projected) { Emitter.emit({ - count: 100, + count: 30, fields: [ + { + path: ['Sprite', 'alpha'], + value: [1, 1], + }, { path: ['Sprite', 'lightness'], value: [0.111, 0.666], }, ], - frequency: 0.005, + frequency: 0.01875, shape: { - type: 'filledRect', - payload: {width: 16, height: 16}, + type: 'circle', + payload: {radius: 4}, }, entity: { - Forces: {forceY: 400}, + Forces: {forceY: 100}, Position: { x: x * layer.tileSize.x + (layer.tileSize.x / 2), - y: y * layer.tileSize.y - layer.tileSize.y, + y: y * layer.tileSize.y - (layer.tileSize.y / 4), }, Sprite: { - scaleX: 0.1, - scaleY: 0.3, + alpha: 0, + scaleX: 0.05, + scaleY: 0.15, tint: 0x0022aa, }, - Ttl: {ttl: 0.0625}, + Ttl: {ttl: 0.1}, } }); }