camera   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A Camera.update() 0 12 5
1
from dataclasses import dataclass
2
3
import pygame
4
5
6
@dataclass
7
class Camera:
8
    x: int
9
    y: int
10
    locked: bool
11
12
    def update(self, pressed):
13
        if pygame.K_UP in pressed:
14
            self.y -= 1
15
16
        if pygame.K_DOWN in pressed:
17
            self.y += 1
18
19
        if pygame.K_LEFT in pressed:
20
            self.x -= 1
21
22
        if pygame.K_RIGHT in pressed:
23
            self.x += 1
24
25
26
camera = Camera(0, 0, False)
27