[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Re: using alpha for a circle
There are two types of surfaces--the display surface and other
surfaces. For practical purposes, you can't blit the display surface
to anything. Try this (warning: psudocode...):
import pygame
from pygame.locals import *
import sys
pygame.init()
Screen = (500,500)
Surface = pygame.display.set_mode(Screen)
CircleSurface = pygame.Surface((100,100))
pygame.draw.circle(CircleSurface,(0,0,255),(50,50),50,5)
CircleSurface.set_colorkey((0,0,0))
CircleSurface.set_alpha(int(round(0.4*255)))
def GetInput():
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit(); sys.exit()
def Draw():
Surface.fill((0,0,0))
Surface.blit(CircleSurface,(Screen[0]/2-50,Screen[1]/2-50))
pygame.display.flip()
def main():
while True:
GetInput()
Draw()
if __name__ == '__main__': main()