moved position system over to use vector2
This commit is contained in:
55
Game_Client/Classes/Objects/BoardField.py
Normal file
55
Game_Client/Classes/Objects/BoardField.py
Normal file
@ -0,0 +1,55 @@
|
||||
import pygame
|
||||
|
||||
class BoardField():
|
||||
__name:str
|
||||
__type:str
|
||||
__pos:pygame.Vector2
|
||||
__size:tuple
|
||||
__color:tuple = (255,255,255)
|
||||
_rect:pygame.Rect
|
||||
|
||||
def __init__(self, name:str, type:str, pos:pygame.Vector2, size:tuple, color:tuple):
|
||||
self.__name = name
|
||||
self.__type = type
|
||||
self.__pos = pos
|
||||
self.__size = size
|
||||
self.__color = color
|
||||
self.__rect = pygame.Rect(pos.x, pos.y, size[0], size[1])
|
||||
|
||||
def getName(self) -> str:
|
||||
return self.__name
|
||||
|
||||
def getType(self) -> str:
|
||||
return self.__type
|
||||
|
||||
def getPos(self) -> pygame.Vector2:
|
||||
return self.__pos
|
||||
|
||||
def getSize(self) -> tuple:
|
||||
return self.__size
|
||||
|
||||
def getColor(self) -> tuple:
|
||||
return self.__color
|
||||
|
||||
def getRect(self) -> pygame.Rect:
|
||||
return self.__rect
|
||||
|
||||
def setName(self, name:str) -> str:
|
||||
self.__name = name
|
||||
return self.__name
|
||||
|
||||
def setType(self,type:str) -> str:
|
||||
self.__type = type
|
||||
return self.__type
|
||||
|
||||
def setPos(self, pos:pygame.Vector2) -> pygame.Vector2:
|
||||
self.pos = pos
|
||||
return self.__pos
|
||||
|
||||
def setSize(self, size:tuple) -> tuple:
|
||||
self.__size = size
|
||||
return self.__size
|
||||
|
||||
def setColor(self, color:tuple) -> tuple:
|
||||
self.__color = color
|
||||
return self.__color
|
Binary file not shown.
53
Game_Client/Classes/Objects/World.py
Normal file
53
Game_Client/Classes/Objects/World.py
Normal file
@ -0,0 +1,53 @@
|
||||
import pygame
|
||||
from Classes.Objects.BoardField import BoardField
|
||||
|
||||
class World():
|
||||
__boardFields:list
|
||||
__cardWidth:int = 200
|
||||
__cardHeight:int = 250
|
||||
__cardOffset:int = 400
|
||||
|
||||
def __init__(self, cardWidth:int=200, cardHeight:int=250, cardOffset:int=400):
|
||||
self.__boardFields = []
|
||||
self.__cardWidth = cardWidth
|
||||
self.__cardHeight = cardHeight
|
||||
self.__cardOffset = cardOffset
|
||||
self.buildGameWorld()
|
||||
|
||||
def buildGameWorld(self):
|
||||
# TODO: rebuild these to use the BoardField Class and to append them to the __boardFields list
|
||||
# construct elements arround the playerfield
|
||||
# Todo add lifepoint label for player and enemy and make them scriptable
|
||||
pVector = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 0)), 15)
|
||||
self.__boardFields.append(BoardField("EnemyDeck", "Deck", pVector, (self.__cardWidth, self.__cardHeight), (0,255,0)))
|
||||
|
||||
pVector = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 0)), (self.__cardHeight + 25))
|
||||
self.__boardFields.append(BoardField("EnemyGraveyard", "Grave", pVector, (self.__cardWidth, self.__cardHeight), (0,255,0)))
|
||||
|
||||
pVector = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 5)), ((2 * self.__cardHeight) + 60))
|
||||
self.__boardFields.append(BoardField("PlayerDeck", "Deck", pVector, (self.__cardWidth, self.__cardHeight), (255,0,0)))
|
||||
|
||||
pVector = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * 5)), ((2 * self.__cardHeight) + self.__cardHeight + 70))
|
||||
self.__boardFields.append(BoardField("PlayerGraveyard", "Grave", pVector, (self.__cardWidth, self.__cardHeight), (255,0,0)))
|
||||
|
||||
for i in range(5):
|
||||
pVector = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * i)), ((2 * self.__cardHeight) + 60))
|
||||
self.__boardFields.append(BoardField("PlayerMonsterField-"+str(i),"MonsterField",pVector,(self.__cardWidth, self.__cardHeight),(255,255,255)))
|
||||
|
||||
pVector = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * i)), ((2 * self.__cardHeight) + self.__cardHeight + 70))
|
||||
self.__boardFields.append(BoardField("PlayerMonsterField-"+str(i), "EffectField", pVector, (self.__cardWidth, self.__cardHeight), (255,255,255)))
|
||||
|
||||
pVector = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * (i+1)), 15), (self.__cardWidth, self.__cardHeight))
|
||||
self.__boardFields.append(BoardField("EnemyMonsterField-"+str(i), "MonsterField", pVector, (self.__cardWidth, self.__cardHeight), (255,255,255)))
|
||||
|
||||
pVector = pygame.Vector2((self.__cardOffset + ((self.__cardWidth + 10) * (i+1))), (self.__cardHeight + 25))
|
||||
self.__boardFields.append(BoardField("EnemySpellTrapField-"+str(i), "EffectField", pVector, (self.__cardWidth, self.__cardHeight), (255,255,255)))
|
||||
|
||||
def getBoardFields(self) -> list:
|
||||
return self.__boardFields
|
||||
|
||||
def getCardWidth(self) -> int:
|
||||
return self.__cardWidth
|
||||
|
||||
def getCardHeifht(self) -> int:
|
||||
return self.__cardHeight
|
Binary file not shown.
BIN
Game_Client/Classes/Objects/__pycache__/World.cpython-312.pyc
Normal file
BIN
Game_Client/Classes/Objects/__pycache__/World.cpython-312.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user