WMICraft/logic/field.py
2022-04-05 10:54:30 +02:00

22 lines
665 B
Python

import pygame
class Field(pygame.sprite.Sprite):
def __init__(self, texture_path, converted_texture, img, rect, row=0, column=0):
super().__init__()
self.texture_path = texture_path
self.converted_texture = converted_texture
self.image = img
self.row = row
self.column = column
self.rect = rect
self.busy = False
self.busy_detection()
def busy_detection(self):
if self.texture_path == 'water.png' or self.texture_path == 'grass_with_tree.jpg':
self.busy = True
def step_onto(self, obj):#ustawia objekt na srodku pola
obj.rect = obj.clamp(self.rect)