Inteligentny_Wozek/letter.py

23 lines
616 B
Python
Raw Permalink Normal View History

2023-06-02 21:14:55 +02:00
import pygame
letter_pic = pygame.image.load("images/letter.png")
class Letter(pygame.sprite.Sprite):
2023-06-05 00:45:29 +02:00
def __init__(self, img_path):
2023-06-02 21:14:55 +02:00
super().__init__()
2023-06-05 00:45:29 +02:00
self.img_path = img_path
2023-06-02 21:14:55 +02:00
self.image = pygame.transform.scale(letter_pic, (40, 40))
self.rect = self.image.get_rect()
self.x = 430
self.y = 400
self.is_in_move = False
def narysuj(self, x, y, screen):
self.x = x
self.y = y
screen.blit(self.image, (self.x, self.y))
def update_position(self, x, y):
self.x = x
self.y = y
self.rect.topleft = (x, y)