for now removed card class from hirarchy and added possibillity to render sprites on screen
This commit is contained in:
14
Game_Client/Classes/Objects/Cards/Card.py
Normal file
14
Game_Client/Classes/Objects/Cards/Card.py
Normal file
@ -0,0 +1,14 @@
|
||||
import json
|
||||
import pygame
|
||||
|
||||
|
||||
class Card(pygame.sprite.Sprite):
|
||||
|
||||
|
||||
def __init__(self, pos:tuple, assetDir:str):
|
||||
|
||||
if assetDir == "":
|
||||
return ValueError.add_note("Card: imagePath cannot be empty")
|
||||
|
||||
|
||||
|
43
Game_Client/Classes/Objects/Cards/MonsterCard.py
Normal file
43
Game_Client/Classes/Objects/Cards/MonsterCard.py
Normal file
@ -0,0 +1,43 @@
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
import pygame
|
||||
|
||||
class MonsterCard(pygame.sprite.Sprite):
|
||||
__attacks = []
|
||||
__name:str
|
||||
__description:str
|
||||
image:pygame.image
|
||||
rect:pygame.rect
|
||||
|
||||
def __init__(self, pos:tuple, assetDir:str):
|
||||
if assetDir == "":
|
||||
return ValueError.add_note("Card: imagePath cannot be empty")
|
||||
|
||||
pygame.sprite.Sprite.__init__(self)
|
||||
|
||||
data = json.load(open(assetDir + "/testmonstercard.json"))
|
||||
|
||||
self.__name = data["name"]
|
||||
self.image = pygame.image.load(assetDir + "/card.png").convert_alpha()
|
||||
self.rect = self.image.get_rect()
|
||||
self.rect.center = pos
|
||||
self.__description = data["description"]
|
||||
|
||||
for attack in data["attacks"]:
|
||||
self.__attacks.append(attack)
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def attacks(self):
|
||||
return self.__attacks
|
||||
|
||||
def getName(self) -> str:
|
||||
return self.__name
|
||||
|
||||
def getCardSprite(self) -> pygame.image:
|
||||
return self.__cardSprite
|
||||
|
||||
def getDescription(self):
|
||||
return self.__description
|
18
Game_Client/Classes/Objects/Cards/SpellCard.py
Normal file
18
Game_Client/Classes/Objects/Cards/SpellCard.py
Normal file
@ -0,0 +1,18 @@
|
||||
import json
|
||||
from Classes.Objects.Cards.Card import Card
|
||||
|
||||
|
||||
class SpellCard(Card):
|
||||
__description:str
|
||||
|
||||
def __init__(self, asset:str):
|
||||
data = json.load(open(asset))
|
||||
|
||||
Card.__init__(data["name"], data["image"])
|
||||
self.__description = data["description"]
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return self.__description
|
20
Game_Client/Classes/Objects/Cards/TrapCard.py
Normal file
20
Game_Client/Classes/Objects/Cards/TrapCard.py
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
from Classes.Objects.Cards.Card import Card
|
||||
import json
|
||||
|
||||
class SpellCard(Card):
|
||||
__description:str
|
||||
|
||||
def __init__(self, asset:str):
|
||||
|
||||
data = json.load(open(asset))
|
||||
|
||||
Card.__init__(data["name"], data["image"])
|
||||
self.__description = data["description"]
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return self.__description
|
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user