added labels to ui
This commit is contained in:
@ -3,7 +3,7 @@ from typing import Any
|
||||
|
||||
import pygame
|
||||
|
||||
from Classes.System.InputHandler import InputHandler
|
||||
from Classes.System.Components.InputHandler import InputHandler
|
||||
|
||||
class MonsterCard(pygame.sprite.Sprite):
|
||||
__attacks = []
|
||||
|
Binary file not shown.
@ -1,14 +1,19 @@
|
||||
import pygame
|
||||
from Classes.Objects.BoardField import BoardField
|
||||
from Classes.System.Components.Label import Label
|
||||
|
||||
class World():
|
||||
__boardFields:list
|
||||
__labels:list
|
||||
__screen:pygame.surface
|
||||
__cardWidth:int = 150
|
||||
__cardHeight:int = 200
|
||||
__cardOffset:int = 400
|
||||
|
||||
def __init__(self, cardWidth:int=300, cardHeight:int=550, cardOffset:int=400):
|
||||
def __init__(self, screen:pygame.surface, cardWidth:int=200, cardHeight:int=250, cardOffset:int=400):
|
||||
self.__boardFields = []
|
||||
self.__labels = []
|
||||
self.__screen = screen
|
||||
self.__cardWidth = cardWidth
|
||||
self.__cardHeight = cardHeight
|
||||
self.__cardOffset = cardOffset
|
||||
@ -17,26 +22,37 @@ class World():
|
||||
def buildGameWorld(self):
|
||||
# construct elements arround the playerfield
|
||||
# Todo add lifepoint label for player and enemy and make them scriptable
|
||||
eRow1Height = 75
|
||||
eRow2Height = (self.__cardHeight + 35)
|
||||
|
||||
# presets the y position later passed down to the vector2
|
||||
eRow1Height = 85
|
||||
eRow2Height = (self.__cardHeight + 45)
|
||||
pRow1Height = ((2 * self.__cardHeight) + 75)
|
||||
pRow2Height = ((2 * self.__cardHeight) + self.__cardHeight + 30)
|
||||
|
||||
|
||||
eDeckPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 0)), eRow1Height)
|
||||
eGravePos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 0)), eRow2Height)
|
||||
pGravePos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 5)), pRow1Height)
|
||||
pDeckPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 5)), pRow2Height)
|
||||
eNamePos = pygame.Vector2(15, 45)
|
||||
eHPPos = pygame.Vector2(15, 75)
|
||||
|
||||
pGravePos = pygame.Vector2((self.__cardOffset + (((self.__cardWidth + 10) - 30 ) * 5)), pRow1Height)
|
||||
pDeckPos = pygame.Vector2((self.__cardOffset + (((self.__cardWidth + 10) - 30 ) * 5)), pRow2Height)
|
||||
pNamePos = pygame.Vector2(20, pRow2Height + 195)
|
||||
pHPPos = pygame.Vector2(20, pRow2Height + 225)
|
||||
|
||||
self.__labels.append(Label("PlayerHP", self.__screen, "1000 / 1000", pHPPos))
|
||||
self.__labels.append(Label("PlayerName", self.__screen, "Player", pNamePos))
|
||||
self.__labels.append(Label("EnemyHP", self.__screen, "1000 / 1000", eHPPos))
|
||||
self.__labels.append(Label("EnemyName", self.__screen, "Enemy", eNamePos))
|
||||
self.__boardFields.append(BoardField("EnemyDeck", "Enemy", "Deck", eDeckPos, "Assets/Cards/Arena/field.png"))
|
||||
self.__boardFields.append(BoardField("EnemyGraveyard", "Enemy", "Grave", eGravePos, "Assets/Cards/Arena/field.png"))
|
||||
self.__boardFields.append(BoardField("PlayerDeck", "Player", "Deck", pDeckPos, "Assets/Cards/Arena/field.png"))
|
||||
self.__boardFields.append(BoardField("PlayerGraveyard", "Player", "Grave", pGravePos, "Assets/Cards/Arena/field.png"))
|
||||
|
||||
for i in range(5):
|
||||
pMonsterPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * i)), pRow1Height)
|
||||
pEffectPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * i)), pRow2Height)
|
||||
eMonsterPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * (i+1)), eRow1Height))
|
||||
eEffectPos = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * (i+1))), eRow2Height)
|
||||
pMonsterPos = pygame.Vector2((self.__cardOffset + (((self.__cardWidth + 10) - 30) * i)), pRow1Height)
|
||||
pEffectPos = pygame.Vector2((self.__cardOffset + (((self.__cardWidth + 10) - 30) * i)), pRow2Height)
|
||||
eMonsterPos = pygame.Vector2((self.__cardOffset + (((self.__cardWidth + 10) - 30) * (i+1)), eRow1Height))
|
||||
eEffectPos = pygame.Vector2((self.__cardOffset + (((self.__cardWidth + 10) - 30) * (i+1))), eRow2Height)
|
||||
|
||||
self.__boardFields.append(BoardField("PlayerMonsterField-"+str(i), "Player", "MonsterField", pMonsterPos, "Assets/Cards/Arena/field.png"))
|
||||
self.__boardFields.append(BoardField("PlayerEffectField-"+str(i), "Player", "EffectField", pEffectPos, "Assets/Cards/Arena/field.png"))
|
||||
@ -46,6 +62,9 @@ class World():
|
||||
def getBoardFields(self) -> list:
|
||||
return self.__boardFields
|
||||
|
||||
def getLabels(self) -> list:
|
||||
return self.__labels
|
||||
|
||||
def getCardWidth(self) -> int:
|
||||
return self.__cardWidth
|
||||
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user