import { HCenter, Main } from "./common.tsx"; import { debug_render } from "./html.ts"; import { Component } from "./jsx/jsx-runtime.ts"; const Eggbug: Component = () => ( eggbug, smiling ); function health_style(current: number, last: number, max: number) { const inc_width = 100 / max; const dhealth = last - current; console.log(inc_width, dhealth); return `transform: translateX(${-(inc_width * dhealth)}%); width: ${ last * inc_width }%;`; } // could be generalized // might be worthwhile later since is BAN const Health: Component = ({ current, last, max }) => ( console.log({ current, last, max }), (
{Math.floor(current).toString()} /{max.toString()}
) ); // one-time animations of hit numbers of health flying off the screen const BattleFrame: Component = ({ health, last_health, max_health, msg }) => (
); const Defeated: Component = ({ last_health, max_health }) => (
defeated...
); const Battle: Component = ({ max_health = 100, health = max_health, last_health = health, damage_multiplier = 10, damage_bonus = 1, ...rest }) => health > 0 ? (
) : ( ); debug_render(
);