changed game layout away from using image

This commit is contained in:
2023-12-10 21:18:41 +01:00
parent cdf6a810ec
commit 4acb99cc84
10 changed files with 57 additions and 53 deletions

View File

@ -14,7 +14,7 @@ class App:
__FPS = 60
__clock = pygame.time.Clock()
def __init__(self, width:int=1280, height:int=720, title:str="default title"):
def __init__(self, width:int=1920, height:int=1080, title:str="default title"):
self.__window = Window(width=width, height=height, title=title)
self.startGameLoop()
self.onCleanup()
@ -25,7 +25,31 @@ class App:
cards = pygame.sprite.Group()
# game word
world = World(pygame.image.load("Assets/Arenas/default.png").convert_alpha())
# the field
playerMonsterGroup = []
playerSpellGroup = []
enemyMonsterGroup = []
ememySpellGroup = []
enemyOtherGroup = []
playerOtherGroup = []
cardWith = 200
cardHeight = 250
cardOffset = 400
# player card fields
for i in range(5):
playerMonsterGroup.append(pygame.Rect(cardOffset + ((cardWith + 10) * i), (2 * cardHeight) + 60, cardWith, cardHeight))
playerSpellGroup.append(pygame.Rect(cardOffset + ((cardWith + 10) * i), (2 * cardHeight) + cardHeight + 70, cardWith, cardHeight))
enemyMonsterGroup.append(pygame.Rect(cardOffset + ((cardWith + 10) * (i+1)), 15, cardWith, cardHeight))
ememySpellGroup.append(pygame.Rect(cardOffset + ((cardWith + 10) * (i+1)), cardHeight + 25, cardWith, cardHeight))
enemyOtherGroup.append(pygame.Rect(cardOffset + ((cardWith + 10) * 0), 15, cardWith, cardHeight))
enemyOtherGroup.append(pygame.Rect(cardOffset + ((cardWith + 10) * 0), cardHeight + 25, cardWith, cardHeight))
playerOtherGroup.append(pygame.Rect(cardOffset + ((cardWith + 10) * 5), (2*cardHeight) + 60, cardWith, cardHeight))
playerOtherGroup.append(pygame.Rect(cardOffset + ((cardWith + 10) * 5), (2*cardHeight) + cardHeight + 70, cardWith, cardHeight))
testMonsterCard = MonsterCard((500,500), "Assets/Cards/MonsterCards/testmonstercard/")
cards.add(testMonsterCard)
@ -34,8 +58,26 @@ class App:
self.__clock.tick(self.__FPS)
self.__window.getScreen().fill("grey100")
world.draw(self.__window.getScreen())
self.__window.getScreen().fill((0,0,0))
# world.draw(self.__window.getScreen())
for card in playerOtherGroup:
pygame.draw.rect(self.__window.getScreen(), (0,255,0), card)
for card in playerMonsterGroup:
pygame.draw.rect(self.__window.getScreen(), (255,255,255), card)
for card in playerSpellGroup:
pygame.draw.rect(self.__window.getScreen(), (255,255,255), card)
for card in enemyOtherGroup:
pygame.draw.rect(self.__window.getScreen(), (255,0,0), card)
for card in enemyMonsterGroup:
pygame.draw.rect(self.__window.getScreen(), (255,0,255), card)
for card in ememySpellGroup:
pygame.draw.rect(self.__window.getScreen(), (255,0,255), card)
# update sprite groups
cards.update()

View File

@ -13,7 +13,7 @@ class Window:
self.__height = height
self.__title = title
self.__screen = pygame.display.set_mode((self.__width, self.__height))
self.__screen = pygame.display.set_mode((self.__width, self.__height), pygame.FULLSCREEN)
pygame.display.init()
pygame.display.set_caption = self.__title