← Fantasy3D assetfogon/casa-de-hongo
Casa de hongo
Drag to turn it// «Casa de hongo» · gpt-6-sol (medium)
// A fairy house built inside a giant mushroom: a thick cream stem with a round wooden door with a brass knob at the front (-y), two round windows with warm light, a little stone path and flowers at the door, and a big red cap with white spots as the roof with a tiny chimney poking out.
const cream = "#ead9ac";
const creamLight = "#f8e9c4";
const creamShade = "#c8b68e";
const red = "#c83242";
const redLight = "#e74a55";
const redShade = "#a82435";
const wood = "#684332";
const woodLight = "#895839";
const woodDark = "#493127";
const brass = "#e9bd59";
// Thick mushroom stem.
cylinder(24, 25, 0, 10, 17, cream);
ellipsoid(24, 25, 15, 12, 12, 15, cream);
forEach((x, y, z, color) => {
if (color === cream) {
const n = rand();
if (n < 0.07) {
set(x, y, z, creamShade);
} else if (n > 0.92 && z > 7) {
set(x, y, z, creamLight);
}
}
});
// Broad, rounded red cap with a shaded underside.
for (let x = 5; x <= 43; x++) {
for (let y = 6; y <= 44; y++) {
const d = ((x - 24) / 19) ** 2 + ((y - 25) / 19) ** 2;
if (d > 1) continue;
const curve = Math.sqrt(1 - d);
const bottom = Math.round(26 - 2 * curve);
const top = Math.round(28 + 11 * curve);
for (let z = bottom; z <= top; z++) {
let color;
if (z <= 26) {
color = z === bottom ? "#82634e" : "#b99167";
} else if (z <= 28) {
color = redShade;
} else {
color = z >= top - 2 ? redLight : red;
if (rand() < 0.045) color = redShade;
}
set(x, y, z, color);
}
}
}
// Cream-colored spots resting on the curved roof.
const spots = [
[10, 18, 2], [15, 12, 2], [24, 10, 2], [34, 12, 2],
[39, 20, 2], [17, 21, 2], [29, 19, 2], [11, 29, 2],
[36, 30, 2], [22, 33, 2], [30, 37, 1], [19, 8, 1],
[8, 24, 1], [40, 27, 1]
];
for (const spot of spots) {
const sx = spot[0];
const sy = spot[1];
const radius = spot[2];
for (let dx = -radius; dx <= radius; dx++) {
for (let dy = -radius; dy <= radius; dy++) {
if (dx * dx + dy * dy > radius * radius + 0.5) continue;
const x = sx + dx;
const y = sy + dy;
const d = ((x - 24) / 19) ** 2 + ((y - 25) / 19) ** 2;
if (d >= 0.97) continue;
const z = Math.round(28 + 11 * Math.sqrt(1 - d));
set(x, y, z - 1, "#f5edcf");
set(x, y, z, (dx + dy) % 3 === 0 ? "#fff9e7" : "#f5edcf");
}
}
}
// Tiny weathered-stone chimney.
box(33, 29, 35, 37, 33, 41, "#77746d");
box(32, 28, 40, 38, 34, 41, "#aaa395");
box(34, 30, 41, 36, 32, 41, "#343038");
for (let z = 36; z < 40; z += 2) {
box(33, 28, z, 37, 28, z, "#5c5956");
}
sphere(37, 32, 44, 1, "#d4cbd0");
sphere(39, 33, 45, 1, "#e1d7df");
// Round-topped wooden door on the front.
for (let z = 0; z <= 12; z++) {
const halfWidth = z <= 8
? 4
: Math.floor(Math.sqrt(Math.max(0, 16 - (z - 8) ** 2)));
for (let x = 24 - halfWidth; x <= 24 + halfWidth; x++) {
for (let y = 11; y <= 13; y++) {
let color = (x + 24) % 3 === 0 ? woodDark : wood;
if (x === 22 || x === 25) color = woodLight;
set(x, y, z, color);
}
if (x === 24 - halfWidth || x === 24 + halfWidth || z === 12) {
set(x, 10, z, "#ae8152");
}
}
}
line(19, 10, 0, 19, 10, 8, 0, woodDark);
line(29, 10, 0, 29, 10, 8, 0, woodDark);
sphere(27, 9, 5, 1, brass);
set(27, 8, 5, "#fff0a0");
// Brass rims around two circular front windows.
for (const cx of [15, 33]) {
for (let dx = -3; dx <= 3; dx++) {
for (let dz = -3; dz <= 3; dz++) {
const distance = dx * dx + dz * dz;
if (distance >= 6 && distance <= 12) {
set(cx + dx, 14, 18 + dz, "#85613e");
set(cx + dx, 13, 18 + dz, brass);
}
}
}
}
// Only the illuminated window panes animate.
part("windows", [24, 14, 18]);
for (const cx of [15, 33]) {
for (let dx = -2; dx <= 2; dx++) {
for (let dz = -2; dz <= 2; dz++) {
if (dx * dx + dz * dz > 5) continue;
set(cx + dx, 14, 18 + dz, "#ffd46e");
if (dx === 0 || dz === 0) {
set(cx + dx, 13, 18 + dz, "#ffea9a");
}
}
}
}
animate("windows", {
type: "colors",
palette: ["#ffb94e", "#ffd771", "#fff0a1"],
pattern: "pulse",
glow: 0.6
});
part("body");
// Stepping-stone path.
for (let y = 1; y <= 11; y += 2) {
const x = 24 + (y % 4 === 1 ? -1 : 1);
ellipsoid(x, y, 0, y < 5 ? 3 : 2, 1, 0, "#827f76");
set(x, y, 1, "#aaa69a");
if (x > 22) set(x - 1, y, 1, "#99978c");
}
// Flowers and moss around the entrance.
const flowerPositions = [
[18, 4], [29, 3], [17, 8], [31, 7], [18, 12],
[32, 11], [13, 14], [35, 15], [20, 2]
];
for (const position of flowerPositions) {
const x = position[0];
const y = position[1];
box(x, y, 0, x, y, 2, "#527b4d");
set(x - 1, y, 0, "#66854c");
set(x + 1, y, 0, "#66854c");
const petal = (x + y) % 2 ? "#e373c7" : "#72e4da";
set(x - 1, y, 3, petal);
set(x + 1, y, 3, petal);
set(x, y - 1, 3, petal);
set(x, y + 1, 3, petal);
set(x, y, 3, "#ffe581");
}
// Little companion mushrooms.
for (const position of [[13, 18], [36, 18], [15, 35]]) {
const x = position[0];
const y = position[1];
box(x, y, 0, x, y, 2, "#e8d8ad");
ellipsoid(x, y, 3, 2, 2, 1, "#a63860");
set(x, y - 1, 4, "#fff0d9");
}import { draw } from "./assets/voxel";
import { casaDeHongo } from "./assets/casa-de-hongo";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, casaDeHongo, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: its longest side, in px
// angle: turn on the floor, in radians
// t: seconds; if it moves, that animates it# In a terminal, in the game's folder
fogon assets add casa-de-hongo
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["casa-de-hongo"] })
# It lands in client/assets/casa-de-hongo.ts
# https://fogon.page/object/casa-de-hongo