Make hit effect size configurable and adjust visual styling
- Add size parameter to drawHitEffect() with proportional inner/outer radii - Reduce hit effect duration from 500ms to 200ms for faster animation - Change hit effect color to semi-transparent black and reduce size to 10 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8674e65432
commit
9286b28192
@ -220,7 +220,7 @@ class GameEngine {
|
|||||||
this.addEffect({
|
this.addEffect({
|
||||||
type: 'hit',
|
type: 'hit',
|
||||||
position: player1.position.lerp(player2.position, 0.5),
|
position: player1.position.lerp(player2.position, 0.5),
|
||||||
duration: 500,
|
duration: 200,
|
||||||
startTime: Date.now()
|
startTime: Date.now()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -214,7 +214,7 @@ class Renderer {
|
|||||||
this.drawGoalEffect(position);
|
this.drawGoalEffect(position);
|
||||||
break;
|
break;
|
||||||
case 'hit':
|
case 'hit':
|
||||||
this.drawHitEffect(position, color);
|
this.drawHitEffect(position, '#00000038', 10);
|
||||||
break;
|
break;
|
||||||
case 'save':
|
case 'save':
|
||||||
this.drawSaveEffect(position);
|
this.drawSaveEffect(position);
|
||||||
@ -241,16 +241,19 @@ class Renderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drawHitEffect(position, color) {
|
drawHitEffect(position, color, size = 25) {
|
||||||
this.ctx.strokeStyle = color;
|
this.ctx.strokeStyle = color;
|
||||||
this.ctx.lineWidth = 4;
|
this.ctx.lineWidth = 4;
|
||||||
|
|
||||||
|
const innerRadius = size * 0.4;
|
||||||
|
const outerRadius = size;
|
||||||
|
|
||||||
for (let i = 0; i < 6; i++) {
|
for (let i = 0; i < 6; i++) {
|
||||||
const angle = (i / 6) * Math.PI * 2;
|
const angle = (i / 6) * Math.PI * 2;
|
||||||
const startX = position.x + Math.cos(angle) * 10;
|
const startX = position.x + Math.cos(angle) * innerRadius;
|
||||||
const startY = position.y + Math.sin(angle) * 10;
|
const startY = position.y + Math.sin(angle) * innerRadius;
|
||||||
const endX = position.x + Math.cos(angle) * 25;
|
const endX = position.x + Math.cos(angle) * outerRadius;
|
||||||
const endY = position.y + Math.sin(angle) * 25;
|
const endY = position.y + Math.sin(angle) * outerRadius;
|
||||||
|
|
||||||
this.ctx.beginPath();
|
this.ctx.beginPath();
|
||||||
this.ctx.moveTo(startX, startY);
|
this.ctx.moveTo(startX, startY);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user