Download

Arcade like driving

Hello,

I am trying to make a basic driving game, like OutRun. Even though my idea takes place in a 3D world, I so far have a really long road to drive down. The car is a sprite, and so will everything else be. I have made it move forward, it takes some time to accelerate and when releasing the forward key, it slows to a stop. In the Character Movement values I used Max Acceleration and Braking Friction Factor to do this. No nodes yet other than input controls for forwards, left and right.

Now this is where I get confused. I am trying to prevent the player from being able to move the object left and right when it is stationary. I only want sideways movement while you are moving forwards. I really can’t figure this out and Google isn’t helping. I have tried using disable and enable inputs, I have tried telling it to detect when a key is pressed to reenable the controls but most of the time it has no effect, I can still go left and right while sitting still. Or I end up losing control totally and can’t even go forwards.

So far, I just have this really basic set up.

Here are my failed attempts.



I can’t seem to edit my post again so I will reply. I just could not figure out locking the controls so I decided to go a different route. I thought about making it a sprinting function. I made the default walk speed 0, and set up the sprint mechanic and it works. Can no longer move left and right while not moving forwards. Here is the current set up that works.



My next problem is getting animations to work right. I can get it working with idle and driving. But I’m not sure how to put in left and right sprites. When I try to set them up, depending on how I have it set up the sprites either go invisible when pressing sprint, or idle will be locked as a going left or right sprite and moving in those direction keeps the same locked sprite. So I’m not sure. I think what I am trying to ask is, how do I make it change the sprite, when two buttons are held at the same time? In this case, sprint and/or left and right. One being an axis input and the other being an action one.


A revised set up, still has the same results.