Untitled
unknown
python
2 years ago
663 B
8
Indexable
import pygame
from settings import map
class Block(pygame.sprite.Sprite):
def __init__(self, pos, size, block_type):
super().__init__()
self.block_type = block_type # Store the type of block (e.g., '1' or '2')
if self.block_type == '1':
self.image = pygame.image.load('ScuttleKnight/levels/Texture/slicedImages/ground1_02.png').convert()
elif self.block_type == '2':
self.image = pygame.image.load('ScuttleKnight/levels/Texture/slicedImages/ground1_76.png').convert()
self.rect = self.image.get_rect(topleft=pos)
def update(self, x_move):
self.rect.x += x_move
Editor is loading...
Leave a Comment