I am trying to make a top down shooter in pygame. I when I added the code to make the player move in the direction they are facing. The player would move in weird directions. This is the code I am using:
if pygame.key.get_pressed()[K_UP]:
playerX = playerX - math.cos(playerFacing)
playerY = playerY - math.sin(playerFacing)
if pygame.key.get_pressed()[K_DOWN]:
playerX = playerX + math.cos(playerFacing)
playerY = playerY + math.sin(playerFacing)
I tried just typing in math.cos(90) and it equaled -0.299515394756 but my calculator is telling me it equals 0. I am probably just making a stupid mistake, but can anyone tell me what I am doing wrong. Thanks Xeno