Search code examples
pythonimagepygamegame-physics

Redrawing image isn't working?


So, i have a pygame.circle that i would like to move. I have it moving etc, but it just duplicated the image and doesn't remove the previous. I understand the concept of "Blit" and understand it copies an array of pixels over. So i thought i would try redrawing my whole game, here's what i have:

            if event.type == pygame.KEYDOWN and event.key == pygame.K_a:
                diceRoll = random.randint(1, 4)
                diceRollLabel = myFont.render(str(diceRoll), 1, black)
                window.blit(diceRollLabel, (750, 40))
                window.fill(black)
                game()

                count1 = pygame.draw.circle(window, (black),(150, countY - 72 * diceRoll), 25, 0)
                game = False
                game2 = True
                print("Test")

                player1Text = myFont.render(("Player twos turn!"), 1, black)
                window.blit(player1Text, (650, 750))
                pygame.display.update()
                break

When it calls "game()" it should recall the function that contains all of the game screen, so the texture etc. but for some reason, it doesn't do anything? The screen just goes black?

it says "Bool object not callable" but my function isn't a boolean?


Solution

  • You've set game as a Boolean

    game = False
    

    So when you call "game()" it's the same as "False()" which is the reason for your error.

    You also fill the screen black after blitting the diceRollLabel (in black), and you then seem to draw a black circle on a black screen.

    Full code would be helpful.