added card types

This commit is contained in:
2023-12-06 12:21:51 +01:00
parent 0b5aef794a
commit 4fbd1c6663
19 changed files with 120 additions and 26 deletions

View File

@@ -0,0 +1,24 @@
import pygame
class InputHandler:
# returns pressed key
def getPressed():
return pygame.key.get_pressed()
# takes in movement inputs and maps them to x and y axis
def getInputAxis() -> tuple:
xvel:int = 0
yvel:int = 0
# construct x and y velocity input axis
if InputHandler.getPressed()[pygame.K_a] or InputHandler.getPressed()[pygame.K_LEFT]:
xvel = -1
if InputHandler.getPressed()[pygame.K_d] or InputHandler.getPressed()[pygame.K_RIGHT]:
xvel = 1
if InputHandler.getPressed()[pygame.K_w] or InputHandler.getPressed()[pygame.K_UP]:
yvel = -1
if InputHandler.getPressed()[pygame.K_s] or InputHandler.getPressed()[pygame.K_DOWN]:
yvel = 1
return tuple((xvel, yvel))