Pygame-Tutorials
Pygame-Tutorials copied to clipboard
Issue of Goblin Being not visible but still getting hit by bullet,hence increasing scores.
Even the bullets not passing across the goblin even after he is dead,creating an invisible line
for bullet in bullets:
if bullet.y -bullet.radius < goblin.hitbox[1]+ goblin.hitbox[3]and bullet.y+ bullet.radius > goblin.hitbox[1]:
if bullet.x + bullet.radius > goblin.hitbox[0] and bullet.x-bullet.radius < goblin.hitbox[0] + goblin.hitbox[2]:
goblin.hit()
if (goblin.visible):
bullets.pop(bullets.index(bullet))
score+=1
this is in the main loop, just add my if statement and it should do the trick
Issue is closed I guess?