WMICraft/logic/field.py

24 lines
714 B
Python
Raw Permalink Normal View History

import pygame
class Field(pygame.sprite.Sprite):
def __init__(self, texture_path, converted_texture, img, rect, row=0, column=0):
super().__init__()
2022-03-09 16:59:58 +01:00
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
2022-04-05 10:54:30 +02:00
2022-04-05 15:38:26 +02:00
def step_onto(self, obj): # ustawia objekt na srodku pola
2022-04-05 10:54:30 +02:00
obj.rect = obj.clamp(self.rect)
2022-04-05 15:38:26 +02:00
self.busy = True
obj.update()