Skip to content

Commit

Permalink
Ускорение объектов теперь происходит независимо от FPS
Browse files Browse the repository at this point in the history
  • Loading branch information
YariKartoshe4ka committed Dec 14, 2021
1 parent ad6b7b8 commit 1160d87
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
venv
__pycache__
*.pyc
.p4a
other
tmp
build
dist
*.egg-info
.coverage
bin
.buildozer
1 change: 1 addition & 0 deletions spaceway/scenes/game/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

def init(screen, base_dir, config):
config['ns'].speed = 2
config['ns'].current_time = 0
config['ns'].score = 0

bg = Background(screen, base_dir, config)
Expand Down
5 changes: 4 additions & 1 deletion spaceway/scenes/game/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def update(screen, config, base_dir, bg, plate, astrs, boosts, score, end, pause

scene_buttons.draw()

if config['ns'].tick % (config['FPS'] * 7) == 0:
config['ns'].current_time += config['ns'].dt / 30
if config['ns'].current_time > 7:
config['ns'].current_time = 0
if 'time' in boosts:
boosts.get('time').speed += 1
else:
Expand Down Expand Up @@ -213,6 +215,7 @@ def defeat(plate, astrs, boosts, end, config, base_dir):
boosts.empty()

config['ns'].speed = 2
config['ns'].current_time = 0
config['ns'].score = 0
config['scene'] = 'game'
config['sub_scene'] = 'end'
3 changes: 2 additions & 1 deletion spaceway/scenes/settings/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def check_events(config, scene_buttons, settings_buttons, nick):
config.save()

if nick.rect.collidepoint((x, y)):
print('click nick!')
nick.is_enable = True
pygame.key.start_text_input()
else:
nick.is_enable = False
pygame.key.stop_text_input()

elif event.type == pygame.KEYDOWN and nick.is_enable:
if event.key == pygame.K_BACKSPACE:
Expand Down

0 comments on commit 1160d87

Please sign in to comment.