const {Direction, Position, Wielder} = wielder const projected = Wielder.activeItem()?.project(Position.tile, Direction.quantize(4)) if (projected?.length > 0) { const {Controlled, Emitter, Sound, Sprite} = wielder const {TileLayers} = ecs.get(1) const layer = TileLayers.layer(0) Controlled.locked = 1 const [, direction] = Sprite.animation.split(':') const dirtParticles = { behaviors: [ { type: 'moveAcceleration', config: { accel: { x: 0, y: 200, }, minStart: 0, maxStart: 0, rotate: false, } }, { type: 'moveSpeed', config: { speed: { list: [ { time: 0, value: 60 }, { time: 1, value: 10 } ] } } }, { type: 'rotation', config: { accel: 0, minSpeed: 0, maxSpeed: 0, minStart: 225, maxStart: 320 } }, { type: 'scale', config: { scale: { list: [ { value: 0.25, time: 0, }, { value: 0.125, time: 1, }, ] } } }, { type: 'textureSingle', config: { texture: 'tileset/7', } }, ], lifetime: { min: 0.25, max: 0.25, }, frequency: 0.01, emitterLifetime: 0.25, pos: { x: 0, y: 0 }, }; for (let i = 0; i < 2; ++i) { Sound.play('/assets/hoe/dig.wav'); for (const {x, y} of projected) { Emitter.emit({ ...dirtParticles, behaviors: [ ...dirtParticles.behaviors, { type: 'spawnShape', config: { type: 'rect', data: { x: x * layer.tileSize.x, y: y * layer.tileSize.y, w: layer.tileSize.x, h: layer.tileSize.y, } } } ] }) } Sprite.animation = ['moving', direction].join(':'); await wait(0.3) Sprite.animation = ['idle', direction].join(':'); await wait(0.1) } for (const position of projected) { TileLayers.layer(1).stamp(position, [[7]]) } Controlled.locked = 0; }