Basic python/pygame help

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
449 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jun 2, 2011

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()

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 2 dislikes

Link to this comment:

Share to:

Uploader Comments (14koder)

  • 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 thanks

    

Video Responses

see all

All Comments (3)

Sign In or Sign Up now to post a comment!
  • ur game looks great

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more