New building sprites

This commit is contained in:
tobspr 2020-08-14 08:20:39 +02:00
parent f69af63aa3
commit c982827d60
32 changed files with 965 additions and 950 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 74 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 241 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 KiB

After

Width:  |  Height:  |  Size: 572 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -20,7 +20,7 @@ export class MetaHubBuilding extends MetaBuilding {
return "#eb5555";
}
isRotateable() {
getIsRotateable() {
return false;
}

View File

@ -23,7 +23,7 @@ export class MetaLeverBuilding extends MetaBuilding {
return true;
}
isRotateable() {
getIsRotateable() {
return false;
}

View File

@ -57,6 +57,11 @@ export class MetaLogicGateBuilding extends MetaBuilding {
];
}
getRenderPins() {
// We already have it included
return false;
}
/**
*
* @param {Entity} entity

View File

@ -20,7 +20,7 @@ export class MetaTrashBuilding extends MetaBuilding {
super("trash");
}
isRotateable(variant) {
getIsRotateable(variant) {
return variant !== defaultBuildingVariant;
}

View File

@ -21,7 +21,7 @@ export class MetaWireTunnelBuilding extends MetaBuilding {
return true;
}
isRotateable() {
getIsRotateable() {
return false;
}

View File

@ -153,7 +153,7 @@ export class MetaBuilding {
* @param {string} variant
* @returns {boolean}
*/
isRotateable(variant) {
getIsRotateable(variant) {
return true;
}
@ -172,6 +172,14 @@ export class MetaBuilding {
return null;
}
/**
* Should return false if the pins are already included in the sprite of the building
* @returns {boolean}
*/
getRenderPins() {
return true;
}
/**
* Creates the entity without placing it
* @param {object} param0
@ -225,7 +233,7 @@ export class MetaBuilding {
* @return {{ rotation: number, rotationVariant: number, connectedEntities?: Array<Entity> }}
*/
computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, variant, layer }) {
if (!this.isRotateable(variant)) {
if (!this.getIsRotateable(variant)) {
return {
rotation: 0,
rotationVariant: 0,

View File

@ -169,26 +169,28 @@ export class WiredPinsSystem extends GameSystemWithFilter {
const tile = staticComp.localTileToWorld(slot.pos);
const worldPos = tile.toWorldSpaceCenterOfTile();
const effectiveRotation = Math.radians(
staticComp.rotation + enumDirectionToAngle[slot.direction]
);
drawRotatedSprite({
parameters,
sprite: this.pinSprites[slot.type],
x: worldPos.x,
y: worldPos.y,
angle: effectiveRotation,
size: globalConfig.tileSize + 2,
offsetX: 0,
offsetY: 0,
});
if (staticComp.getMetaBuilding().getRenderPins()) {
drawRotatedSprite({
parameters,
sprite: this.pinSprites[slot.type],
x: worldPos.x,
y: worldPos.y,
angle: effectiveRotation,
size: globalConfig.tileSize + 2,
offsetX: 0,
offsetY: 0,
});
}
// Draw contained item to visualize whats emitted
const value = slot.value;
if (value) {
const offset = new Vector(0, -5).rotated(effectiveRotation);
value.draw(worldPos.x + offset.x, worldPos.y + offset.y, parameters, 12);
const offset = new Vector(0, -9).rotated(effectiveRotation);
value.draw(worldPos.x + offset.x, worldPos.y + offset.y, parameters, 9);
}
// Debug view