hello. Ive spent a couple hours looking on the forums and i am just really confused and dont know how to properly handle this.
I have made 2 buttons. A gas pedal (gas) and a brake pedal (brake). I have added them to my gui.
I am having trouble adding these buttons to the code and making it so when the gas is pressed or held, the car goes. and when the brake is pressed or held, it starts stopping.
Here is the car game movement code
Any help would be appreciated.
Here’s how I did it in my game Get Gravel (these are GUITexture buttons):
for (var touch : Touch in Input.touches)
bBrakeButtonPressed = false;
bGasButtonPressed = true;
else if (BrakeButton.HitTest(touch.position))
bGasButtonPressed = false;
bBrakeButtonPressed = true;
bRightButtonPressed = false;
bLeftButtonPressed = true;
else if (RightButton.HitTest(touch.position))
bLeftButtonPressed = false;
bRightButtonPressed = true;
Then just use those bools to control your car.