-
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.
Co-authored-by: AkiaCode <AkiaCode@users.noreply.github.com>
- Loading branch information
1 parent
b870e3f
commit 179f717
Showing
7 changed files
with
193 additions
and
30 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,59 @@ | ||
class Maps: | ||
def __init__(): | ||
pass | ||
from characters.player import Player | ||
from characters.enemy import Enemy | ||
from characters.texture import Texture | ||
|
||
class Map: | ||
player: Player | ||
"""플레이어""" | ||
|
||
NPCs: list[Player] | ||
"""NPC 배열""" | ||
|
||
enemies: list[Enemy] | ||
"""적 배열""" | ||
|
||
obstacles: list[Player] | ||
"""장애물 배열""" | ||
|
||
sign = None | ||
"""말풍선""" | ||
|
||
background: Texture | ||
"""배경""" | ||
|
||
floor: Texture | ||
"""바닥""" | ||
|
||
def __init__( | ||
self, | ||
player: Player = None, | ||
NPCs: list[Player] = [], | ||
enemies: list[Enemy] = [], | ||
obstacles: list[Player] = [], | ||
sign = None, | ||
background: Texture = None, | ||
floor: Texture = None | ||
): | ||
""" | ||
맵 클래스를 생성합니다. | ||
:param player: 현재 플레이어 | ||
:param npcs: NPC 배열 | ||
:param enemies: 적 배열 | ||
:param obstacles: 장애물 배열 | ||
:param background: 배경 | ||
:param floor: 바닥 | ||
""" | ||
self.player = player | ||
self.NPCs = NPCs | ||
self.enemies = enemies | ||
self.obstacles = obstacles | ||
self.sign = sign | ||
self.background = background | ||
self.floor = floor | ||
|
||
def render(self): | ||
"""맵을 렌더링합니다.""" | ||
pass | ||
|
||
def __str__(self): | ||
return f"<Map Player={self.player}>" |
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
from maps import Map | ||
|
||
from characters.player import Player | ||
from characters.enemy import Enemy | ||
from characters.texture import Texture | ||
|
||
from components.events.grace_period import GracePeriod | ||
from components.events.text import TextEvent | ||
|
||
from components.text import Text | ||
from components.text.text_collection import TextCollection | ||
|
||
from components.sprites.sprite import Sprite | ||
from components.sprites.sprite_handler import SpriteHandler | ||
from components.sprites.sprite_collection import SpriteCollection | ||
|
||
class MapMain(Map): | ||
def __init__(self, player: Player, sign): | ||
super(Map, self).__init__() | ||
|
||
self.player = player | ||
|
||
# NPC | ||
self.sign = sign | ||
|
||
self.emilia = Player("assets/images/chr_emilia.png", (400, 195), 0.4) # 에밀리아 | ||
self.emilia.dialog = TextCollection( | ||
[ | ||
Text("*안녕!*"), | ||
Text("나는 에밀리아야."), | ||
Text("*J키*는 #기본공격#이야!"), | ||
Text("그럼 즐거운 여행되길 바래!") | ||
], | ||
self.sign.width | ||
) | ||
|
||
self.NPCs = [self.emilia] | ||
|
||
# 적 | ||
self.enemy = Enemy("assets/images/chr_raon.png", (1000, 222), 0.4) | ||
self.enemies = [self.enemy] | ||
|
||
for enemy in self.enemies: | ||
enemy.grace_period = GracePeriod(1500) | ||
enemy.hp = 2 | ||
|
||
# 장애물 | ||
self.spike = Player.get_from_sprite(SpriteCollection({ | ||
"default": SpriteHandler( | ||
Sprite( | ||
"assets/images/object_spike_default.png", 17, 1, size=(155, 100) | ||
) | ||
) | ||
}, | ||
"default", | ||
position=(800, 270), | ||
scale=0.4)) | ||
|
||
self.spike2 = Player.get_from_sprite(SpriteCollection({ | ||
"default": SpriteHandler( | ||
Sprite( | ||
"assets/images/object_spike_default.png", 17, 1, size=(155, 100) | ||
) | ||
) | ||
}, | ||
"default", | ||
position=(850, 270), | ||
scale=0.4)) | ||
|
||
self.obstacles = [self.spike, self.spike2] | ||
|
||
# 배경 | ||
self.background = Texture("assets/images/background_sky.png", (0, 0), 1, repeat_x=2, fit=True) | ||
self.ground = Texture("assets/images/grass.png", (0, 287), 0.4, repeat_x=2) |
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,21 @@ | ||
from characters.player import Player | ||
|
||
from maps import Map | ||
from maps.map_main import MapMain | ||
|
||
class MapManager: | ||
"""플레이어가 다니는 맵을 관리합니다.""" | ||
|
||
maps: dict[str, Map] = {} | ||
|
||
current: Map = None | ||
"""현재 맵""" | ||
|
||
@classmethod | ||
def apply(cls, map: str): | ||
""" | ||
맵을 적용합니다. | ||
:param map: 적용할 맵 | ||
""" | ||
|
||
cls.current = cls.maps[map] |
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