Total Complexity | 5 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from src.utils import load |
||
2 | |||
3 | |||
4 | class ScrollingBackground: |
||
5 | _texture = None |
||
6 | |||
7 | def __init__(self, offset): |
||
8 | self.rect = self.texture.get_rect() |
||
9 | self.rect.x = offset |
||
10 | |||
11 | @property |
||
12 | def texture(self): |
||
13 | if self._texture is None: |
||
14 | self._texture = load("src/assets/images/bg.png") |
||
15 | return self._texture |
||
16 | |||
17 | def update(self): |
||
18 | self.rect.x = self.rect.x - 1 if self.rect.x > -1280 else 1280 |
||
19 |