Total Complexity | 5 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |