stabilized login, first successfull stream of cards accross clients

This commit is contained in:
2024-01-22 19:37:54 +01:00
parent 3b7563c5f1
commit 18dcd6cc42
63 changed files with 441 additions and 859 deletions

View File

@ -8,10 +8,10 @@ from Classes.System.Utils.Path import PathUtil
# send from the server to tell the player the game starts
# gives the client its and the opponents stats (not cards!!)
def GameStart(world: World, handCards:list, inputHandler:InputHandler, owner:Player, opponent:Player):
def GameStart(world: World, handCards:list, inputHandler:InputHandler, owner:Player):
index:int = 0
world.setEnemy(opponent)
for card in handCards:
world.AddToPlayerHand(Card(pygame.Vector2(500 + (index + 100), 1050), PathUtil.getAbsolutePathTo(f"Assets/Cards/{card}/"), inputHandler, owner))
#world.AddToPlayerHand(Card(pygame.Vector2(500 + (index * 100), 1050), PathUtil.getAbsolutePathTo(f"Assets/Cards/{card}/"), inputHandler, Player(1000, 0, "test"), dragable=True))
world.spawnCard(PathUtil.getAbsolutePathTo(f"Assets/Cards/{card}"), pygame.Vector2(500 + (index * 100), 1050), inputHandler, world.getPlayer())
index=index+1

View File

@ -2,6 +2,7 @@ import pygame
from Classes.Game.World import World
from Classes.System.Components.InputHandler import InputHandler
from Classes.Game.Cards.Card import Card
from Classes.System.Utils.Path import PathUtil
# the event the client sends to the server when it places a card
def PlaceCard(tcpClient, card:Card, player):
@ -22,9 +23,10 @@ def PlaceCard(tcpClient, card:Card, player):
tcpClient.send(payload)
# the event send from the server to display a card on the field
def CardPlaced(world:World, card:int, type:str, owner:str, pos:pygame.Vector2, inputHandler:InputHandler):
def CardPlaced(world:World, card:int, owner:str, pos:pygame.Vector2, inputHandler:InputHandler):
# todo: make this work with all cardtypes
world.spawnCard(f"Assets/Cards/{card}/", pos, inputHandler, owner)
print("placing enemy card")
world.spawnEnemyCard(PathUtil.getAbsolutePathTo(f"Assets/Cards/{card}"), pos, inputHandler, owner)
def MovedCard(world:World, card:int, type:str, owner:str, oldPos:pygame.Vector2, newPos:pygame.Vector2, inputHandler:InputHandler):
pass