Position pokeball burst effect on actual Pokemon element instead of hardcoded coordinates

This commit is contained in:
Sterling Archer
2026-05-27 14:34:56 -07:00
parent fa724a8911
commit 143bd68f5b
+4 -2
View File
@@ -1338,10 +1338,12 @@ class Game {
catchScreen.appendChild(ball); catchScreen.appendChild(ball);
setTimeout(() => { setTimeout(() => {
const pokeRect = pokemonEl.getBoundingClientRect();
const screenRect = catchScreen.getBoundingClientRect();
const burst = document.createElement('div'); const burst = document.createElement('div');
burst.className = 'pokeball-burst'; burst.className = 'pokeball-burst';
burst.style.left = '50%'; burst.style.left = (pokeRect.left - screenRect.left + pokeRect.width / 2) + 'px';
burst.style.top = '25%'; burst.style.top = (pokeRect.top - screenRect.top + pokeRect.height / 2) + 'px';
catchScreen.appendChild(burst); catchScreen.appendChild(burst);
ball.remove(); ball.remove();