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

scrolling_background   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ScrollingBackground.__init__() 0 3 1
A ScrollingBackground.texture() 0 5 2
A ScrollingBackground.update() 0 2 2
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