mirror of
https://github.com/13hannes11/outyard-hackathon-rush-hour-co2.git
synced 2024-09-03 20:10:59 +02:00
add vacuum body
Co-authored-by: Laura Januleviciute <januleviciute.laura@gmail.com>
This commit is contained in:
13
Vacuum.py
13
Vacuum.py
@@ -1,5 +1,7 @@
|
|||||||
import pygame
|
import pygame
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
from pygame import image
|
||||||
from Bubble import Bubble
|
from Bubble import Bubble
|
||||||
|
|
||||||
class Vacuum:
|
class Vacuum:
|
||||||
@@ -11,15 +13,22 @@ class Vacuum:
|
|||||||
self.tube_width = 10
|
self.tube_width = 10
|
||||||
self.bubble_objects = bubble_objects
|
self.bubble_objects = bubble_objects
|
||||||
self.image = pygame.image.load("sprites/vacuum.png")
|
self.image = pygame.image.load("sprites/vacuum.png")
|
||||||
|
self.image_body = pygame.image.load("sprites/vacuum_body.png")
|
||||||
|
|
||||||
def draw(self, screen):
|
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))
|
screen.blit(self.image, (self.posX, self.posY))
|
||||||
pygame.draw.line(screen,
|
pygame.draw.line(screen,
|
||||||
(255, 0,0 ),
|
(49, 86, 130),
|
||||||
(400,600),
|
(screen_width / 2 - 20, screen_height - 30),
|
||||||
(self.posX + (self.width - self.tube_width) / 2 , self.posY + self.height),
|
(self.posX + (self.width - self.tube_width) / 2 , self.posY + self.height),
|
||||||
width=self.tube_width)
|
width=self.tube_width)
|
||||||
|
|
||||||
|
|
||||||
def update(self, screen):
|
def update(self, screen):
|
||||||
x, y = pygame.mouse.get_pos()
|
x, y = pygame.mouse.get_pos()
|
||||||
self.posX = x -(self.width / 2)
|
self.posX = x -(self.width / 2)
|
||||||
|
|||||||
BIN
sprites/vacuum_body.png
Normal file
BIN
sprites/vacuum_body.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
Reference in New Issue
Block a user