-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 스프라이트 체계화 및 정리 - 다중 스프라이트 지원 (#7) - 체력 깎이는 코드 추가 - 체력 깎일 때 플레이어 무적 시간 지원 - 사망 이벤트 추가 - Reload 기능 추가 (메뉴화면에서 Ctrl + R) - ESC 화면 추가 (돌아가기, 설정, 전체화면, 음소거, 메뉴화면으로) - 설정 추가 (해상도 변경, FPS 표시, 소리 조절) - 메뉴 화면 UI 수정 - 애셋 (나가기 버튼, 전체화면 버튼, 창 버튼) 추가 및 변경 - SFX (피공격, 음소거 해제) 추가 - 플레이어 좌표 동기화 안되는 버그 수정 - 바운드 버그 수정 - 바운드 y좌표 지원 - 버튼 Optional Text 기능 및 Text Offset 기능 추가 - 코드 최적화 및 정리
- Loading branch information
1 parent
937ec68
commit 5a40580
Showing
23 changed files
with
773 additions
and
120 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from datetime import datetime | ||
|
||
from components.config import debug | ||
|
||
class GracePeriod: | ||
"""무적 시간""" | ||
period = 3000 # 무적시간: 3000ms | ||
|
||
last_graced: datetime = datetime(2023, 1, 1, 12, 0, 0) | ||
|
||
@classmethod | ||
def is_grace_period(cls) -> bool: | ||
""" | ||
무적 시간인가? | ||
""" | ||
delta = datetime.now() - cls.last_graced | ||
return delta.total_seconds() * 1000.0 < cls.period | ||
|
||
@classmethod | ||
def update(cls): | ||
""" | ||
무적 시간을 현재 시간으로 업데이트 | ||
""" | ||
cls.last_graced = datetime.now() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,46 @@ | ||
import pygame.mixer as mixer | ||
|
||
|
||
class SFX(object): | ||
INTRO: mixer.Sound | ||
UNMUTED: mixer.Sound | ||
ATTACKED: mixer.Sound | ||
|
||
sounds: list[mixer.Sound] | ||
|
||
muted = False | ||
volume: float = 1.0 | ||
|
||
@classmethod | ||
def init(cls): | ||
cls.INTRO = mixer.Sound('assets/audio/sfx_intro.ogg') | ||
cls.INTRO = mixer.Sound('assets/audio/sfx_intro.ogg') | ||
cls.UNMUTED = mixer.Sound('assets/audio/sfx_unmuted.ogg') | ||
cls.ATTACKED = mixer.Sound('assets/audio/sfx_attacked.ogg') | ||
|
||
cls.sounds = [ | ||
cls.INTRO, | ||
cls.UNMUTED, | ||
cls.ATTACKED | ||
] | ||
|
||
@classmethod | ||
def control_mute(cls): | ||
cls.muted = not cls.muted | ||
cls.volume = 0.0 if cls.muted else 1.0 | ||
|
||
cls.set_volume(cls.volume) | ||
|
||
@classmethod | ||
def set_volume(cls, volume: float): | ||
volume_rounded = round(volume, 1) # 소수점 계산 문제 방지 | ||
|
||
if volume_rounded == 0.0: | ||
cls.muted = True | ||
else: | ||
cls.muted = False | ||
|
||
cls.volume = volume | ||
|
||
mixer.music.set_volume(volume) | ||
|
||
for sound in cls.sounds: | ||
sound.set_volume(volume) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.