add vacuum body

Co-authored-by: Laura Januleviciute <januleviciute.laura@gmail.com>
This commit is contained in:
2021-11-05 22:42:53 +01:00
parent 36074ae38f
commit 36d5064cd1
2 changed files with 11 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
import pygame
import random
from pygame import image
from Bubble import Bubble
class Vacuum:
@@ -11,15 +13,22 @@ class Vacuum:
self.tube_width = 10
self.bubble_objects = bubble_objects
self.image = pygame.image.load("sprites/vacuum.png")
self.image_body = pygame.image.load("sprites/vacuum_body.png")
def draw(self, screen):
screen_width, screen_height = screen.get_size()
screen.blit(self.image_body,
((screen_width - self.image_body.get_width()) / 2,
screen_height - (self.image_body.get_height() / 3.3)))
screen.blit(self.image, (self.posX, self.posY))
pygame.draw.line(screen,
(255, 0,0 ),
(400,600),
(49, 86, 130),
(screen_width / 2 - 20, screen_height - 30),
(self.posX + (self.width - self.tube_width) / 2 , self.posY + self.height),
width=self.tube_width)
def update(self, screen):
x, y = pygame.mouse.get_pos()
self.posX = x -(self.width / 2)

BIN
sprites/vacuum_body.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB