python - Collision issue in pygame -


here sample of code:

if not pygame.sprite.collide_rect(yolo,blocks):        screen.blit(mooncollect, [randomlistx[i]-stagebackground_x, randomlisty[i]]) 

i have 2 sprites , right while collide, mooncollect disappears. how can fix logic mooncollect not appear during , after collision?

appreciate help, , tell me if being unclear.
thanks

you create variable represent if moon has ever collided object

ismoon = false if pygame.sprite.collide_rect(yolo,blocks):     ismoon = true  //when rendering if (ismoon == false):     screen.blit(mooncollect, [randomlistx[i]-stagebackground_x, randomlisty[i]]) 

this way, when mooncollect not colliding object, in past has, not rendered.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -