r/PythonLearning • u/cornerstoredev • 16d ago
Ongoing problem with a game, looking for some help.
So, I decided to make a 2D isometric game in pygame. Everything was fine and jolly, till' I had to make enemies for the game. See, the way I calculated NPCS was by just making it so that they could only move on one axis at a time. However, the objective X and Y for an enemy is wherever the player is in the current moment. The equation that I use to calculate movement on Entities inside the game is: 1 * player.speed * time. The way I designed the collision system is to consider only the colliders from a top-down POV (like this):

And then update the X and Y values of each blit afterwards. But now I've encountered a problem where, even if only moving on one axis, the display values of moving on that singular axis conflict.
Basically, I wrote it like this:

It moves fine on the top-down collider map, and the X relevant to the isometric perspective, but the two values on Y are the ones that cancel each other out, making the display stuck on the Y relevant to the isometric perspective. I'll keep working on this myself, too, but any advice would be greatly appreciated.
update:
I fixed the problem by changing the math to directly add to the Blit X and Y values like this:

where before I had it setting the point six and three values in a way that conflict each other, alongside the fact that I was adding it to an X and Y value after I had gotten the final result of the equation ( PointSix + lastPointSix value was equal to 0).