dadgasil.blogg.se

Pygame image convert alpha
Pygame image convert alpha









pygame image convert alpha

The returned Surface will contain the same color format, colorkey and alpha transparency as the file it came from. However, the pygame documentation notes that:

pygame image convert alpha

A Surface can be created from an image with : my_image_surface = ( 'my_image.jpg') Player2.fire_direction = are represented by “pygame.Surface” objects. If event.key = pygame.K_UP and player2.toggle = False: If event.key = pygame.K_DOWN and player2.toggle = False: If event.key = pygame.K_LEFT and player2.toggle = False:

pygame image convert alpha

If event.key = pygame.K_RIGHT and player2.toggle = False: If event.key = pygame.K_w and player1.toggle = False: If event.key = pygame.K_s and player1.toggle = False: If event.key = pygame.K_a and player1.toggle = False:

pygame image convert alpha

If event.key = pygame.K_d and player1.toggle = False: If event.key = pygame.K_SPACE and player2.toggle = False:īullet = Sprites.Bullet(, 2(player2.fire_direction), Fetch('player', 'player2', 'bullet', None, None)) If event.key = pygame.K_e and player1.toggle = False:īullet = Sprites.Bullet(, 2(player1.fire_direction), Fetch('player', 'player1', 'bullet', None, None)) Textstatic4 = ('Enter to restart', True, Global.white) Textstatic3 = ('Escape to leave', True, Global.white) Textstatic2 = ('Player 2', True, Global.white) Textstatic1 = ('Player 1', True, Global.white) TextS4 = ('Player 2: ', True, Global.white) TextS3 = ('Player 1: ', True, Global.white) TextS2 = ('Space To Continue', True, Global.white) TextS1 = ('Choose Your Character', True, Global.white) Text2 = Fetch('text', 'player2', None, None, None) Text1 = Fetch('text', 'player1', None, None, None) _caption('Rects Fight!')ĭef Fetch(typeOfFetch, playerType, toReturn, fill1, fill2): Start = (os.path.join('media', 'start.wav')) Select = (os.path.join('media', 'select.wav')) Music = (os.path.join('media', 'music.wav')) Pause = (os.path.join('media', 'pause.wav'))įight = (os.path.join('media', 'fight.wav')) Icon = (os.path.join('media', 'icon.png')).convert_alpha()Įtge = (os.path.join('media', 'egtg.png')).convert_alpha() Wall = (os.path.join('media', 'wall.png')).convert_alpha() Title = (os.path.join('media', 'title.png')).convert_alpha() Paused = (os.path.join('media', 'paused.png')).convert_alpha() Shoot = (os.path.join('media', 'shoot.wav')) Red = (os.path.join('media', 'red.png')).convert_alpha()īulletred = (os.path.join('media', 'bulletred.png')).convert_alpha() Purple = (os.path.join('media', 'purple.png')).convert_alpha()īulletpurple = (os.path.join('media', 'bulletpurple.png')).convert_alpha() Green = (os.path.join('media', 'green.png')).convert_alpha()īulletgreen = (os.path.join('media', 'bulletgreen.png')).convert_alpha() Orange = (os.path.join('media', 'orange.png')).convert_alpha()īulletorange = (os.path.join('media', 'bulletorange.png')).convert_alpha() I've been working on a fighting game using python and pygame and its quite finished, currently I'm looking for some constructive feedback about any issues/functions I should change in my code.











Pygame image convert alpha