have colored avocados
parent
657e3a963a
commit
fdae2d2c07
|
@ -1,19 +1,21 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import pygame
|
||||
import random
|
||||
import pygame, random
|
||||
from support import operations
|
||||
|
||||
class Avocado:
|
||||
|
||||
def __init__(self, screen, color, filename='img/AvoCado_0.png'):
|
||||
print('New avocado is ' + ','.join(str(color)))
|
||||
self.screen = screen
|
||||
self.screen = screen
|
||||
self.screen_width, self.screen_height = screen.get_size()
|
||||
self.x = random.randint(0, self.screen_width)
|
||||
self.y = 0 # change this to start somewhere above the screen
|
||||
self.w = 100
|
||||
self.y = 100
|
||||
|
||||
self.i = pygame.image.load(filename).convert_alpha()
|
||||
operations.color_surface(self.i, color)
|
||||
self.image = pygame.transform.scale(self.i, (30, 30))
|
||||
self.pycard = self.image.get_rect()
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ class Lawyer:
|
|||
# WARNING!! FIXME Absolute sizes FIXME
|
||||
self.image = pygame.transform.scale(temp_image, (220, 400))
|
||||
self.rect = self.image.get_rect()
|
||||
operations.color_surface(self.image, WHITE)
|
||||
self.pos = (screen_width - self.rect.w, screen_height - self.rect.h)
|
||||
|
||||
def blitme(self):
|
||||
""" Blit this object to the screen """
|
||||
operations.color_surface(self.image, WHITE)
|
||||
self.image.blit(self.pane, (self.rect.left, self.rect.bottom / 2))
|
||||
self.screen.blit(self.image, self.pos)
|
||||
|
||||
|
@ -29,8 +29,3 @@ class Lawyer:
|
|||
and filling it with a color """
|
||||
self.pane = pygame.Surface((200, 100))
|
||||
self.pane.fill(color)
|
||||
|
||||
# Add this to self.image?!
|
||||
|
||||
# using surface.fill is faster because it can be hw accel
|
||||
#pygame.draw.rect(Surface, color, Rect, width=0)
|
||||
|
|
Loading…
Reference in New Issue