Passed
Push — master ( 2f29cd...4bc53c )
by Yohann
01:12
created

ScrollingBackground.__init__()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 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