BGE - Trouble with Controlled Movements

Hey Everyone,

I am working on a project where I need to have movement finely controlled. Basically, I have a player navigating through a city (on a grid). When the player presses forward, they need to move forward exactly one block (40 blender units.) When they press left or right, they need to turn exactly 90 degrees in the appropriate direction. This movement needs to be smooth, not instantaneous. No two moves can be simultaneous. It sounds simple enough, but it isn’t as simple as I would expect.

I figured that the best way to do this was using IPO curves. My first question is if that is, indeed, the best way?

I am having a couple of problems when using IPO curves. The first is that I can only have one IPO on my player. If I have two curves (one for, say, dLocX, and one for dRotZ), both are always played. I tried getting around that by parenting an empty to my player and having it make the dLocX movements, and the player doing the dRotZ. However, this means that after a turn, the player no longer moves forward, but on the empty’s X axis.

For now, I’m linking an example of one attempt I have done. I’ll link more if necessary based on the responses I get. I apologize in advance if some of the stuff is sloppy, but I am only a beginner with Python, and I am just learning.

http://dl.dropbox.com/u/6709999/SmallCity-OneIPO.blend I’ve tried to put in two IPO Curves on one object, and tried to use logic bricks to execute one part or another based on a key press.

Thank you for your help! If you need any more information/clarification, please let me know. I tried to keep this decently short, but descriptive.

Have you tried using the Tap button in the Keyboard Sensor of the Logic Window? With that button pressed the controllers are triggered only for an instant, making it possible for your character to rotate imediatelly 90º left upon one key strike. Maybe this approach would be enough…

When I try to do everything through logic bricks and python (see http://dl.dropbox.com/u/6709999/SmallCity2.blend) I can have free movement throughout the environment. When I try to constrain this by using the ‘tap’ option, it makes the movements instantaneously. For my project, it has to be smooth and realistic (it has to simulate what a person would really see when making a turn.)

Thanks for the input, though! I did play around with the ‘Tap’ option and my code more to see if I could get it to work, but it doesn’t seem to resolve my issue.

Does anyone think this would be possible using IPOs in combination with Actions? I don’t have any experience with Actions, but I figure I’m going to go through with the tutorials and see if I can come up with a solution.

IPO’s are parts of an action aren’t they? IPO’s are curves, relative to each axis, which are gathered to represent an action. Knowing this, maybe you should try running both and see which gives out the best outcome.