Pygame-Tutorials icon indicating copy to clipboard operation
Pygame-Tutorials copied to clipboard

Issue of Goblin Being not visible but still getting hit by bullet,hence increasing scores.

Open DEBAYAN2011 opened this issue 6 years ago • 3 comments

DEBAYAN2011 avatar Sep 19 '19 10:09 DEBAYAN2011

Even the bullets not passing across the goblin even after he is dead,creating an invisible line

DEBAYAN2011 avatar Sep 19 '19 10:09 DEBAYAN2011

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

PhaneSchema avatar Sep 24 '19 16:09 PhaneSchema

Issue is closed I guess?

PrajjwalDatir avatar May 08 '20 12:05 PrajjwalDatir