feat: hoeing
This commit is contained in:
parent
2200332c40
commit
af541f1b7e
|
@ -14,7 +14,10 @@ export default class SpriteDirection extends System {
|
||||||
const parts = [];
|
const parts = [];
|
||||||
if (entity.Controlled) {
|
if (entity.Controlled) {
|
||||||
const {locked, moveUp, moveRight, moveDown, moveLeft} = entity.Controlled;
|
const {locked, moveUp, moveRight, moveDown, moveLeft} = entity.Controlled;
|
||||||
if (!locked && (moveUp > 0 || moveRight > 0 || moveDown > 0 || moveLeft > 0)) {
|
if (locked) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((moveUp > 0 || moveRight > 0 || moveDown > 0 || moveLeft > 0)) {
|
||||||
parts.push('moving');
|
parts.push('moving');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
const {Controlled, Position, Wielder} = wielder
|
const {Controlled, Position, Sprite, Wielder} = wielder
|
||||||
const {TileLayers} = ecs.get(1)
|
const {TileLayers} = ecs.get(1)
|
||||||
const layer = TileLayers.layer(0)
|
const layer = TileLayers.layer(0)
|
||||||
const projected = Wielder.project(Position.tile, item.tool.projection)
|
const projected = Wielder.project(Position.tile, item.tool.projection)
|
||||||
|
|
||||||
Controlled.locked = 1;
|
Controlled.locked = 1;
|
||||||
|
const [, direction] = Sprite.animation.split(':');
|
||||||
|
|
||||||
await wait(1000)
|
for (let i = 0; i < 2; ++i) {
|
||||||
|
Sprite.animation = ['moving', direction].join(':');
|
||||||
|
await wait(300)
|
||||||
|
Sprite.animation = ['idle', direction].join(':');
|
||||||
|
await wait(100)
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < projected.length; ++i) {
|
for (let i = 0; i < projected.length; ++i) {
|
||||||
if ([1, 2, 3, 4].includes(layer.tile(projected[i]))) {
|
if ([1, 2, 3, 4].includes(layer.tile(projected[i]))) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user