Python

Moderators: None (Apply to moderate this forum)
Number of threads: 473
Number of posts: 1172

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Image Transparency issue Posted by Maple1eaf on 8 Nov 2012 at 6:17 AM
Hello!

How can i get rid of the background color on a sprite?

here's my code

import pygame, sys
from pygame.locals import *



BasicSword = "Basic Sword.png"

pygame.init()


BasicSwordX = 100
BasicSwordY = 100

screen = pygame.display.set_mode((800,600),0,32)

BasicSword = pygame.image.load(BasicSword).convert_alpha()

while True:

for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()


pygame.draw.rect(screen,(255,0,0),Rect((0,0),(800,600)))
screen.blit(BasicSword, (BasicSwordX, BasicSwordY))




pygame.display.update()



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.