fix transparency

This commit is contained in:
jwinterm
2025-05-17 06:42:50 -04:00
parent 52906cd893
commit 5c6342db6e
7 changed files with 837 additions and 1069 deletions
+611 -748
View File
File diff suppressed because it is too large Load Diff
+12 -10
View File
@@ -23,12 +23,13 @@ tileSet.onload = function() {
tileSet.onerror = function() {
console.error("❌ Failed to load tileset image!");
alert("Tileset image failed to load. Switching to ASCII mode.");
alert("Tileset image failed to load. Game will attempt to use ASCII mode.");
window.globalTileSetStatus = "error"; // Set a status for Game.js to check if needed
// Force ASCII mode when tileset fails to load
if (typeof Game !== 'undefined' && Game._display) {
Game.switchToAsciiMode();
}
// REMOVED: if (typeof Game !== 'undefined' && Game._display) {
// REMOVED: Game.switchToAsciiMode();
// REMOVED: }
};
// Try different possible paths (to handle serving from different directories)
@@ -45,12 +46,13 @@ setTimeout(function() {
tileSet.src = "/tiles.png"; // Try from root
setTimeout(function() {
if (!tileSetLoaded) {
if (!tileSetLoaded && window.globalTileSetStatus !== "error") { // Check if error already handled
console.error("Failed to load tileset after trying multiple paths");
alert("Could not load tileset. Switching to ASCII mode.");
if (typeof Game !== 'undefined' && Game._display) {
Game.switchToAsciiMode();
}
alert("Could not load tileset. Game will attempt to use ASCII mode.");
window.globalTileSetStatus = "error"; // Set a status
// REMOVED: if (typeof Game !== 'undefined' && Game._display) {
// REMOVED: Game.switchToAsciiMode();
// REMOVED: }
}
}, 1000);
}
@@ -60,7 +62,7 @@ setTimeout(function() {
var options = {
layout: "tile",
bg: "#000", // Black background instead of transparent for better visibility
bg: "transparent", // Black background instead of transparent for better visibility
// Adjusted dimensions for ~800x600 display
width: 25, // 25 tiles * 32px/tile = 800px
height: 19, // 19 tiles * 32px/tile = 608px