added card types
This commit is contained in:
24
Game_Client/Classes/System/InputHandler.py
Normal file
24
Game_Client/Classes/System/InputHandler.py
Normal 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))
|
||||
|
||||
Reference in New Issue
Block a user