Why does the mouse image stay visible? Also is there a way for the background to stretch?
By the way here is the code (I think its identical to his):
bif="bg.jpg"
mif="ball.png"
import pygame, sys
from pygame.locals import *
pygame.init()
screen=pygame.display.set_mode((1000,1000),0,32)
background=pygame.image.load(bif).convert()
mouse_c=pygame.image.load(mif).convert_alpha()
while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() screen.blit(background, (0,0)) x,y = pygame.mouse.get_pos() x -= mouse_c.get_width()/2 y -= mouse_c.get_height()/2 screen.blit(mouse_c, (x,y)) pygame.display.update()
The reason is that you have too small background image and you have sett the game display to 1000 x 1000 pixels. To fixs this you can either change your backgroud image to another picture that is 1000 x 1000 pixels, or just change
This line of code:
screen=pygame.display.set_mode((1000,1000),0,32) to
Example: If you have a pic that is 640 x 480 then change the code to this:
screen=pygame.display.set_mode((640,480),0,32)
AntimatterDisabled 7 months ago
@AntimatterDisabled thanks
14koder 5 months ago