In my code I have a zombie that looks to a player and follows it, it is ok for the player to move up/down left/right or in diagonals because the person controlling is using the arrows on the keyboard, but for the zombie it feels very weird not to have a large range of directions it can go, the discrepancy got very weird when I added the fact that the zombie had a free range of motion to look at the player but not to walk directly in its direction. What changes can I make to make his movement more smooth?
this is how I move the player:
playerSprite.vel = 3
playerSprite.x += (keys[pygame.K_RIGHT] - keys[pygame.K_LEFT]) * playerSprite.vel
playerSprite.y += (keys[pygame.K_DOWN] - keys[pygame.K_UP]) * playerSprite.vel
this is how I move the zombie:
zombieSprite.vel = 1
if zombieSprite.x > playerSprite.x:
zombieSprite.x -= zombieSprite.vel
if zombieSprite.x < playerSprite.x:
zombieSprite.x += zombieSprite.vel
if zombieSprite.y > playerSprite.y:
zombieSprite.y -= zombieSprite.vel
if zombieSprite.y < playerSprite.y:
zombieSprite.y += zombieSprite.vel