feature: ECTS generation
- add update method to increase ECTS balance over time when player is at desk
This commit is contained in:
+10
@@ -10,3 +10,13 @@ class ECTS:
|
||||
self.ects_per_second = START_ECTS_VALUE
|
||||
# timer when last ECTS was given to player
|
||||
self.last_update_time = pygame.time.get_ticks()
|
||||
|
||||
# check if ECTS should be added
|
||||
def update(self, is_at_desk):
|
||||
current_time = pygame.time.get_ticks()
|
||||
|
||||
# if player is at desk and interval passed
|
||||
if is_at_desk and ((current_time - self.last_update_time) >= ECTS_UPDATE_INTERVAL):
|
||||
self.ects_balance += self.ects_per_second
|
||||
# reset timer
|
||||
self.last_update_time = current_time
|
||||
Reference in New Issue
Block a user