fix texturen
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m23s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m23s
This commit is contained in:
@@ -116,20 +116,37 @@ function syncSprites(dataList, cacheMap, type, alpha) {
|
||||
usedObjects.add(obj);
|
||||
let sprite = cacheMap.get(obj);
|
||||
|
||||
// A. Erstellen (wenn neu)
|
||||
if (!sprite) {
|
||||
sprite = createPixiSprite(obj, type);
|
||||
gameLayer.addChild(sprite);
|
||||
cacheMap.set(obj, sprite);
|
||||
}
|
||||
|
||||
// B. Updaten (Interpolation)
|
||||
const def = obj.def || {};
|
||||
|
||||
// Position interpolieren
|
||||
const rX = (obj.prevX !== undefined) ? lerp(obj.prevX, obj.x, alpha) : obj.x;
|
||||
const rY = obj.y;
|
||||
|
||||
if (obj.speech) {
|
||||
let bubble = sprite.children.find(c => c.label === "bubble");
|
||||
|
||||
if (!bubble) {
|
||||
bubble = createSpeechBubble(obj.speech);
|
||||
bubble.y = -10;
|
||||
if (def.height) bubble.y = -5;
|
||||
|
||||
sprite.addChild(bubble);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Keine Sprache mehr? Blase entfernen falls vorhanden
|
||||
const bubble = sprite.children.find(c => c.label === "bubble");
|
||||
if (bubble) {
|
||||
sprite.removeChild(bubble);
|
||||
bubble.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'platform') {
|
||||
sprite.x = rX;
|
||||
sprite.y = rY;
|
||||
@@ -264,4 +281,42 @@ function drawDebugOverlay(alpha) {
|
||||
const rX = (o.prevX !== undefined) ? lerp(o.prevX, o.x, alpha) : o.x;
|
||||
g.rect(rX, o.y, def.width||30, def.height||30).stroke({ width: 1, color: 0x00FF00 });
|
||||
});
|
||||
}
|
||||
|
||||
// Helper: Erstellt eine Pixi-Sprechblase
|
||||
function createSpeechBubble(text) {
|
||||
const container = new PIXI.Container();
|
||||
|
||||
// 1. Text erstellen
|
||||
const style = new PIXI.TextStyle({
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 12,
|
||||
fontWeight: 'bold',
|
||||
fill: '#000000',
|
||||
align: 'center'
|
||||
});
|
||||
|
||||
const pixiText = new PIXI.Text({ text: text, style: style });
|
||||
pixiText.anchor.set(0.5); // Text-Mitte ist Anker
|
||||
|
||||
// Maße berechnen
|
||||
const w = pixiText.width + 10;
|
||||
const h = pixiText.height + 6;
|
||||
|
||||
// 2. Hintergrund (Blase)
|
||||
const g = new PIXI.Graphics();
|
||||
g.rect(-w/2, -h/2, w, h).fill(0xFFFFFF); // Weißer Kasten
|
||||
g.rect(-w/2, -h/2, w, h).stroke({ width: 2, color: 0x000000 }); // Schwarzer Rand
|
||||
|
||||
// Kleines Dreieck unten (optional, für den "Speech"-Look)
|
||||
g.moveTo(-5, h/2).lineTo(0, h/2 + 5).lineTo(5, h/2).fill(0xFFFFFF);
|
||||
|
||||
// Zusammenfügen
|
||||
container.addChild(g);
|
||||
container.addChild(pixiText);
|
||||
|
||||
// Name setzen, damit wir es später wiederfinden
|
||||
container.label = "bubble";
|
||||
|
||||
return container;
|
||||
}
|
||||
Reference in New Issue
Block a user