0
\$\begingroup\$

I trying to create 2-D car game in unity for mobile where player controls acceleration by sliding the pedal in touch screen.Mine idea of implementation is using UI slider. Is there any other good I can use? Please suggest me any other implementation if any available.I'm new to this field.

\$\endgroup\$
  • \$\begingroup\$ Your slider idea sounds like it should work just fine. How have you tried implementing this so far? How do the results compare against your goals for the feature? Anything specific we need to fix or improve? \$\endgroup\$ – DMGregory Mar 27 at 17:02
  • \$\begingroup\$ A UI Slider is a great solution. Another option is a mobile joystick: youtube.com/watch?v=VW58CT27LsM or youtube.com/watch?v=bp2PiFC9sSs. My only advice when using the UI slider is to make it such that when the player lets go, it returns to a neutral position (i.e. not accelerating). \$\endgroup\$ – Sirius 5 Mar 27 at 17:19
0
\$\begingroup\$

I don't know how is your programming skills but i will try to explain it simple.
you can define a float variable for your car which is always effecting the logic ( or the code ) that moves the car.
you can get and set slider current value , max value and min value which they are also the float type, take a look at Slider in docs.
to put things simple i will make it into steps:

1- define a function that will moves the car. ( basically with Translate)
2- Put the slider in the game.
3- Create a script that will pass the slider value to speed value of moving function.
4- Tune the speed by playing with values.

if you have some basic programming skills or watched unity scripting tutorials then you should be able to do it easily, if not then i recommend to stop making game for now and start watching unity tutorials at least.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.