moved card placing and keeping of cards to world class
This commit is contained in:
@ -12,7 +12,7 @@ class TrapCard(pygame.sprite.Sprite):
|
||||
__dragging:bool = False
|
||||
__offset:pygame.Vector2 = pygame.Vector2(0,0)
|
||||
__inputHandler: InputHandler
|
||||
__type:str = "SpellCard"
|
||||
__type:str = "TrapCard"
|
||||
image:pygame.image
|
||||
rect:pygame.rect
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
import pygame
|
||||
from Classes.Objects.BoardField import BoardField
|
||||
from Classes.System.Components.Label import Label
|
||||
from Classes.Objects.Cards.MonsterCard import MonsterCard
|
||||
from Classes.System.Components.InputHandler import InputHandler
|
||||
|
||||
class World():
|
||||
__boardFields:list
|
||||
__labels:list
|
||||
__cards:pygame.sprite.Group()
|
||||
__screen:pygame.surface
|
||||
__cardWidth:int = 150
|
||||
__cardHeight:int = 200
|
||||
@ -13,6 +16,7 @@ class World():
|
||||
def __init__(self, screen:pygame.surface, cardWidth:int=200, cardHeight:int=250, cardOffset:int=400):
|
||||
self.__boardFields = []
|
||||
self.__labels = []
|
||||
self.__cards = []
|
||||
self.__screen = screen
|
||||
self.__cardWidth = cardWidth
|
||||
self.__cardHeight = cardHeight
|
||||
@ -59,6 +63,7 @@ class World():
|
||||
self.__boardFields.append(BoardField("EnemyMonsterField-"+str(i), "Enemy", "MonsterField", eMonsterPos, "Assets/Cards/Arena/field.png"))
|
||||
self.__boardFields.append(BoardField("EnemySpellTrapField-"+str(i), "Enemy", "EffectField", eEffectPos, "Assets/Cards/Arena/field.png"))
|
||||
|
||||
|
||||
def getBoardFields(self) -> list:
|
||||
return self.__boardFields
|
||||
|
||||
@ -69,4 +74,10 @@ class World():
|
||||
return self.__cardWidth
|
||||
|
||||
def getCardHeight(self) -> int:
|
||||
return self.__cardHeight
|
||||
return self.__cardHeight
|
||||
|
||||
def getCards(self) -> pygame.sprite.Group:
|
||||
return self.__cards
|
||||
|
||||
def spawnCard(self, asset:str, pos:pygame.Vector2, inputHandler:InputHandler) -> MonsterCard:
|
||||
self.__cards.add(MonsterCard(pos, asset, inputHandler))
|
Reference in New Issue
Block a user