successfully added card snapping

This commit is contained in:
2023-12-12 20:45:01 +01:00
parent a25f4c3eba
commit 77fb62ca5f
8 changed files with 33 additions and 16 deletions

View File

@ -13,6 +13,7 @@ class MonsterCard(pygame.sprite.Sprite):
__dragging:bool = False
__offset:pygame.Vector2 = pygame.Vector2(0,0)
__inputHandler: InputHandler
__type:str = "MonsterCard"
image:pygame.image
rect:pygame.rect
@ -37,8 +38,6 @@ class MonsterCard(pygame.sprite.Sprite):
self.__attacks.append(attack)
def update(self):
print("card update")
print(self.getDragging())
if self.getDragging():
mouse_pos = self.__inputHandler.getMousePos()
self.__pos = mouse_pos
@ -65,8 +64,14 @@ class MonsterCard(pygame.sprite.Sprite):
def getPos(self):
return self.__pos
def getType(self):
return self.__type
def setDragging(self, dragging:bool):
self.__dragging = dragging
def setOffset(self, offset:pygame.Vector2):
self.__offset = offset
self.__offset = offset
def setPos(self, pos:pygame.Vector2):
self.__pos = pos