summaryrefslogtreecommitdiffstats
path: root/Game/decor.py
blob: 46d5c3e488d818f395209cc965fe5479af6631f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from setup import *


class Decor:
    collision_cushion = 50

    def __init__(self, type, x, y):
        if type == 'bush':
            self.texture = pygame.image.load("textures/bush.png")
        else:
            self.texture = pygame.image.load("textures/grass.png")
        self.position = pygame.Vector2(x, y)
        self.position += (100 * random.randint(-10, 10), 100 * random.randint(-10, 10))

    def resolve_collision(self, player_x, player_y):
        if abs(player_x-self.position.x) <= self.collision_cushion:
            if abs(player_y-self.position.y) <= self.collision_cushion:
                self.rustle()

    def rustle(self):
        ...
        #self.texture = self.texture.transform.rotate(self.texture, 45)
    def update(self, delta_time):
        ...

    def draw(self, window, offset_x, offset_y):
        window.blit(self.texture, (self.position.x - offset_x, self.position.y - offset_y))