render cart

This commit is contained in:
Robin Appelman 2025-06-26 16:55:55 +02:00
commit a4d835f0c6
9 changed files with 97 additions and 12 deletions

View file

@ -19,6 +19,7 @@ export function Projectile(props: ProjectileProp) {
const scaledX = () => x() / worldWidth * props.targetSize.width;
const scaledY = () => (worldHeight - y()) / worldHeight * props.targetSize.height;
const teamColor = () => (props.projectile.team === Team.Red) ? '#a75d50' : '#5b818f';
const filter = () => props.projectile.critical ? ((props.projectile.team === Team.Red) ? 'url(#sofGlowRed)' : 'url(#sofGlowBlue)') : '';
const transform = () => `translate(${scaledX()} ${scaledY()}) scale(${1 / props.scale})`;
const rotate = () => `rotate(${270 - props.projectile.angle})`;
@ -26,10 +27,12 @@ export function Projectile(props: ProjectileProp) {
return <g transform={transform()}>
<Show when={projectileIsAngled(props.projectile.projectileType)}>
<polygon points="-3,-4 0,0 3,-4 0,8" stroke="white" fill={teamColor()}
transform={rotate()}/>
transform={rotate()}
filter={filter()}/>
</Show>
<Show when={!projectileIsAngled(props.projectile.projectileType)}>
<circle r={3} stroke-width={1} stroke="white" fill={teamColor()}/>
<circle r={3} stroke-width={1} stroke="white" fill={teamColor()}
filter={filter()}/>
</Show>
</g>
} catch (e) {