Hi, I have a question about the game I am making in pygame. In the middle of the game screen there is the "notepad" where doodles can move around and such. Around that is the "desk" the notepad is on. I have a link to a screenshot here. But underneath the "notepad" is a black box which I don't see how I coded in. Here is the basic code...

import pygame
from pygame.locals import *


#create screen
screen = pygame.display.set_mode((1280, 720), pygame.FULLSCREEN)

#set colors
white = (255, 255, 255)

#load images
backg = pygame.image.load('backg.png')
image1 = pygame.image.load('supptruck.png')

#set transparency codes

walk = 0
done = False
close = False
x = 171
y = 0
keystate = pygame.key.get_pressed()

#main loop
while not close:

    #game loop
    while not done:
        #goto pause menu with escape key
        for event in pygame.event.get():
            if (event.type == KEYDOWN):
                print event
                if (event.key == K_ESCAPE):
                    pausemenu = True
                    done = True

            #detect movement left or right
            if (event.type == KEYDOWN):
                print event

                if (event.key == K_RIGHT):
                    walk = 1

                if (event.key == K_LEFT):
                    walk = 2

            if (event.type == KEYUP):
                print event
                if (event.key == K_RIGHT):
                    walk = 0

                if (event.key == K_LEFT):
                    walk = 0

        #change backdrop position
        if walk == 1:
            x -= 1

        if walk == 2:
            x += 1

        #paste images
        screen.blit(image1, (x, y))
        screen.blit(backg, (0,0))
        #update screen

I am wondering if any of you guys can spot anything in it that may make that box.

3 Years
Discussion Span
Last Post by 26bm

Not sure, but this could do the trick.

#you should clear the screen surface before adding new stuff
#so add this codeline before the image pasting.
screen.fill((0, 0, 0))

I am posting this from iPad so sorry for the weird formatting.

Edited by pyTony: Use Markdown syntax/menus, fixed code formatting (at least 4 space indent)


Thanks so much for replying, but the black part is still there...


the backg.png is 1408x788 and th supptruck.png is 928x680.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.