Skip to content

Tairitsu.Settings

General settings

Settings

Classes

Archive dataclass

Represents the details for the archive.

ATTRIBUTE DESCRIPTION
archivePath

The path of the archive.

TYPE: str

state

The state of the archive.

TYPE: int

Attributes
archivePath class-attribute instance-attribute
archivePath: str = './archive/archive.json'
manager class-attribute instance-attribute
manager = None
player class-attribute instance-attribute
player = None
state class-attribute instance-attribute
state: int = 0
talkType class-attribute instance-attribute
talkType = None

BattleSettings

Attributes
animationCount class-attribute instance-attribute
animationCount = 17
boxHeight class-attribute instance-attribute
boxHeight = WindowSettings.height * 3 // 4
boxStartX class-attribute instance-attribute
boxStartX = WindowSettings.width // 8
boxStartY class-attribute instance-attribute
boxStartY = WindowSettings.height // 8
boxWidth class-attribute instance-attribute
boxWidth = WindowSettings.width * 3 // 4
choiceSpeed class-attribute instance-attribute
choiceSpeed = 30
monsterCoordX class-attribute instance-attribute
monsterCoordX = WindowSettings.width * 5 // 8
monsterCoordY class-attribute instance-attribute
monsterCoordY = WindowSettings.height // 3
monsterHeight class-attribute instance-attribute
monsterHeight = MonsterSettings.monsterHeight * 4
monsterWidth class-attribute instance-attribute
monsterWidth = MonsterSettings.monsterWidth * 4
playerCoordX class-attribute instance-attribute
playerCoordX = WindowSettings.width // 8 * 2
playerCoordY class-attribute instance-attribute
playerCoordY = WindowSettings.height // 3
playerHeight class-attribute instance-attribute
playerHeight = PlayerSettings.playerHeight * 4
playerWidth class-attribute instance-attribute
playerWidth = PlayerSettings.playerWidth * 4
stepSpeed class-attribute instance-attribute
stepSpeed = 20
textMonsterEndX class-attribute instance-attribute
textMonsterEndX = WindowSettings.width // 4 * 3
textMonsterStartX class-attribute instance-attribute
textMonsterStartX = WindowSettings.width // 2 + 100
textPlayerStartX class-attribute instance-attribute
textPlayerStartX = WindowSettings.width // 4
textSize class-attribute instance-attribute
textSize = 48
textStartX class-attribute instance-attribute
textStartX = WindowSettings.width // 4
textStartY class-attribute instance-attribute
textStartY = WindowSettings.height // 4
textVerticalDist class-attribute instance-attribute
textVerticalDist = textSize

BossSettings

Attributes
coordX class-attribute instance-attribute
coordX = SceneSettings.tileXnum / 2 * SceneSettings.tileWidth - width / 2
coordY class-attribute instance-attribute
coordY = SceneSettings.tileYnum / 2 * SceneSettings.tileHeight - height / 2
height class-attribute instance-attribute
height = 300
width class-attribute instance-attribute
width = 300

DialogSettings

Attributes
boxHeight class-attribute instance-attribute
boxHeight = 180
boxStartX class-attribute instance-attribute
boxStartX = WindowSettings.width // 4
boxStartY class-attribute instance-attribute
boxStartY = WindowSettings.height // 3 * 2 + 20
boxWidth class-attribute instance-attribute
boxWidth = 800
menuVerticalDist class-attribute instance-attribute
menuVerticalDist = textSize * 1.2
npcCoordX class-attribute instance-attribute
npcCoordX = 0
npcCoordY class-attribute instance-attribute
npcCoordY = WindowSettings.height * 2 // 3 - 20
npcHeight class-attribute instance-attribute
npcHeight = WindowSettings.height // 3
npcWidth class-attribute instance-attribute
npcWidth = WindowSettings.width // 5
textSize class-attribute instance-attribute
textSize = 48
textStartX class-attribute instance-attribute
textStartX = WindowSettings.width // 4 + 10
textStartY class-attribute instance-attribute
textStartY = WindowSettings.height // 3 * 2 + 30
textVerticalDist class-attribute instance-attribute
textVerticalDist = textSize * 1.2

GameEvent

Attributes
EVENT_BATTLE class-attribute instance-attribute
EVENT_BATTLE = pygame.USEREVENT + 1
EVENT_DIALOG class-attribute instance-attribute
EVENT_DIALOG = pygame.USEREVENT + 2
EVENT_RESTART class-attribute instance-attribute
EVENT_RESTART = pygame.USEREVENT + 4
EVENT_SHOP class-attribute instance-attribute
EVENT_SHOP = pygame.USEREVENT + 5
EVENT_SWITCH class-attribute instance-attribute
EVENT_SWITCH = pygame.USEREVENT + 3

GamePath

Attributes
battle class-attribute instance-attribute
battle = {'Target': './assets/battle/Target.png', 'Choice': ['./assets/battle/TargetChoice000.png', './assets/battle/TargetChoice001.png'], 'Strike': ['./assets/battle/Strike0.png', './assets/battle/Strike1.png', './assets/battle/Strike2.png', './assets/battle/Strike3.png', './assets/battle/Strike4.png', './assets/battle/Strike5.png']}
bgm class-attribute instance-attribute
bgm = {'MENU': './assets/bgm/start.mp3', 'CITY': './assets/bgm/city.mp3', 'WILD': './assets/bgm/wild.mp3', 'BOSS': './assets/bgm/boss.mp3', 'DEATH': './assets/bgm/death.mp3', 'RYTHM': './assets/bgm/shed a light.mp3'}
boss class-attribute instance-attribute
boss = './assets/npc/boss.png'
bossTiles class-attribute instance-attribute
bossTiles = ['./assets/tiles/boss1.png', './assets/tiles/boss2.png', './assets/tiles/boss3.png', './assets/tiles/boss4.png', './assets/tiles/boss5.png', './assets/tiles/boss6.png']
bossWall class-attribute instance-attribute
bossWall = './assets/tiles/bossWall.png'
cityTiles class-attribute instance-attribute
cityTiles = ['./assets/tiles/ground1.png', './assets/tiles/ground2.png', './assets/tiles/ground3.png', './assets/tiles/ground4.png', './assets/tiles/ground5.png', './assets/tiles/ground6.png']
cityWall class-attribute instance-attribute
cityWall = './assets/tiles/cityWall.png'
groundTiles class-attribute instance-attribute
groundTiles = ['./assets/tiles/city1.png', './assets/tiles/city2.png', './assets/tiles/city3.png', './assets/tiles/city4.png', './assets/tiles/city5.png', './assets/tiles/city6.png']
logo = './assets/background/GENSHIN.png'
mapBlock class-attribute instance-attribute
mapBlock = './assets/background/map.png'
menu class-attribute instance-attribute
menu = './assets/background/menu.png'
monster class-attribute instance-attribute
monster = './assets/npc/monster/1.png'
monster2 class-attribute instance-attribute
monster2 = './assets/npc/boss.png'
npc class-attribute instance-attribute
npc = './assets/npc/npc.png'
player class-attribute instance-attribute
player = ['./assets/player/1.png', './assets/player/1.png', './assets/player/2.png', './assets/player/2.png', './assets/player/3.png', './assets/player/3.png', './assets/player/4.png', './assets/player/4.png']
portal class-attribute instance-attribute
portal = './assets/background/portal.png'
sound class-attribute instance-attribute
sound = {'MenuCursor': './assets/sound/MenuCursor.ogg', 'MenuSelect': './assets/sound/MenuSelect.ogg', 'Speak': './assets/sound/BattleText.ogg', 'Fight': './assets/sound/PlayerFight.ogg', 'Damaged': './assets/sound/PlayerDamaged.ogg'}
tree class-attribute instance-attribute
tree = './assets/tiles/tree.png'
wild class-attribute instance-attribute
wild = './assets/background/wild.png'

GameState

Bases: Enum

Attributes
GAME_OVER class-attribute instance-attribute
GAME_OVER = 3
GAME_PAUSE class-attribute instance-attribute
GAME_PAUSE = 5
GAME_PLAY_BOSS class-attribute instance-attribute
GAME_PLAY_BOSS = 8
GAME_PLAY_CITY class-attribute instance-attribute
GAME_PLAY_CITY = 7
GAME_PLAY_WILD class-attribute instance-attribute
GAME_PLAY_WILD = 6
GAME_TRANSITION class-attribute instance-attribute
GAME_TRANSITION = 2
GAME_WIN class-attribute instance-attribute
GAME_WIN = 4
MAIN_MENU class-attribute instance-attribute
MAIN_MENU = 1

GlobalSettings dataclass

Represents the global settings for the game.

ATTRIBUTE DESCRIPTION
fontPath

The path of the font.

TYPE: str

Attributes
fontPath class-attribute instance-attribute
fontPath: str = './assets/font/DottedSongtiSquareRegular.otf'
player class-attribute instance-attribute
player = None

MainmenuSettings

Attributes
boxHeight class-attribute instance-attribute
boxHeight = 200
boxStartX class-attribute instance-attribute
boxStartX = WindowSettings.width // 8
boxStartY class-attribute instance-attribute
boxStartY = WindowSettings.height // 4
boxWidth class-attribute instance-attribute
boxWidth = 800
textSize class-attribute instance-attribute
textSize = 56
textStartX class-attribute instance-attribute
textStartX = boxStartX + 10
textStartY class-attribute instance-attribute
textStartY = boxStartY + 25

MenuSettings

Attributes
blinkInterval class-attribute instance-attribute
blinkInterval = 15
textSize class-attribute instance-attribute
textSize = 36

MonsterSettings

Attributes
monster class-attribute instance-attribute
monster = 1
monsterAttack class-attribute instance-attribute
monsterAttack = 3
monsterDefence class-attribute instance-attribute
monsterDefence = 1
monsterHP class-attribute instance-attribute
monsterHP = 10
monsterHeight class-attribute instance-attribute
monsterHeight = 60
monsterWidth class-attribute instance-attribute
monsterWidth = 60

NPCSettings dataclass

This class represents the settings for a non-player character (NPC).

ATTRIBUTE DESCRIPTION
npcSpeed

The speed of the NPC.

TYPE: int

npcWidth

The width of the NPC.

TYPE: int

npcHeight

The height of the NPC.

TYPE: int

talkCD

The cooldown time for talking, in seconds.

TYPE: int

Attributes
npcHeight class-attribute instance-attribute
npcHeight = 60
npcSpeed class-attribute instance-attribute
npcSpeed = 1
npcWidth class-attribute instance-attribute
npcWidth = 60
talkCD class-attribute instance-attribute
talkCD = 30

NPCType dataclass

Bases: Enum

This Enum represents the types of non-player characters (NPCs).

ATTRIBUTE DESCRIPTION
DIALOG

Represents an NPC that the player can have a dialogue with.

TYPE: int

MONSTER

Represents an NPC that is a monster.

TYPE: int

SHOP

Represents an NPC that can have a shopping action.

TYPE: int

Attributes
DIALOG class-attribute instance-attribute
DIALOG = 1
MONSTER class-attribute instance-attribute
MONSTER = 2
SHOP class-attribute instance-attribute
SHOP = 3

PlayerSettings dataclass

This class represents the initial settings for a player.

ATTRIBUTE DESCRIPTION
playerSpeed

The speed of the player.

TYPE: int

playerWidth

The width of the player.

TYPE: int

playerHeight

The height of the player.

TYPE: int

playerHP

The health points of the player.

TYPE: int

playerAttack

The attack power of the player.

TYPE: int

playerDefence

The defence power of the player.

TYPE: int

playercoin

The initial coin of the player.

TYPE: int

Attributes
playerAttack class-attribute instance-attribute
playerAttack = 5
playerDefence class-attribute instance-attribute
playerDefence = 1
playerHP class-attribute instance-attribute
playerHP = 20
playerHeight class-attribute instance-attribute
playerHeight = 55
playerSpeed class-attribute instance-attribute
playerSpeed = 7
playerWidth class-attribute instance-attribute
playerWidth = 60
playercoin class-attribute instance-attribute
playercoin = 100

PortalSettings

Attributes
coordX class-attribute instance-attribute
coordX = SceneSettings.tileXnum - 10 * SceneSettings.tileWidth - width / 2
coordY class-attribute instance-attribute
coordY = SceneSettings.tileYnum / 2 * SceneSettings.tileHeight - height / 2
height class-attribute instance-attribute
height = 320
width class-attribute instance-attribute
width = 320

SceneSettings dataclass

Represents the settings for a scene in the game.

ATTRIBUTE DESCRIPTION
tileXnum

The number of tiles in the X direction.

TYPE: int

tileYnum

The number of tiles in the Y direction.

TYPE: int

tileWidth

The width of each tile.

TYPE: int

Attributes
obstacleDensity class-attribute instance-attribute
obstacleDensity: float = 0.1

Density to genrete obstacles

Ready to be Deprecated

Stop using this class.

tileHeight class-attribute instance-attribute
tileHeight: int = 40
tileWidth class-attribute instance-attribute
tileWidth: int = 40
tileXnum class-attribute instance-attribute
tileXnum: int = 48
tileYnum class-attribute instance-attribute
tileYnum: int = 27

SceneType

Bases: Enum

Attributes
BOSS class-attribute instance-attribute
BOSS = 3
CITY class-attribute instance-attribute
CITY = 1
TEST class-attribute instance-attribute
TEST = 4
WILD class-attribute instance-attribute
WILD = 2

ShopSettings

Attributes
boxHeight class-attribute instance-attribute
boxHeight = 200
boxStartX class-attribute instance-attribute
boxStartX = WindowSettings.width // 4
boxStartY class-attribute instance-attribute
boxStartY = WindowSettings.height // 3
boxWidth class-attribute instance-attribute
boxWidth = 800
textSize class-attribute instance-attribute
textSize = 56
textStartX class-attribute instance-attribute
textStartX = boxStartX + 10
textStartY class-attribute instance-attribute
textStartY = boxStartY + 25

TalkType

Bases: Enum

This Enum represents the types of talks.

ATTRIBUTE DESCRIPTION
NOTHING

Represents no talk.

TYPE: int

TALKING

Represents a talk.

TYPE: int

WAITING

Represents a waiting state.

TYPE: int

ENDED

Represents the end of a talk.

TYPE: int

Attributes
ENDED class-attribute instance-attribute
ENDED = 3
NOTHING class-attribute instance-attribute
NOTHING = 0
TALKING class-attribute instance-attribute
TALKING = 1
WAITING class-attribute instance-attribute
WAITING = 2

WindowSettings dataclass

Represents the settings for the window.

ATTRIBUTE DESCRIPTION
name

The name of the window.

TYPE: str

width

The width of the window.

TYPE: int

height

The height of the window.

TYPE: int

outdoorScale

The scale of the window (Necessary when camera moving).

TYPE: float

fps

The frame rate of the window.

TYPE: int

Attributes
fps class-attribute instance-attribute
fps: int = 30
height class-attribute instance-attribute
height: int = 720
name class-attribute instance-attribute
name: str = '还没想好名字呢'
outdoorScale class-attribute instance-attribute
outdoorScale: float = 1.5
width class-attribute instance-attribute
width: int = 1280