#Sprint script 2D
1 messages · Page 1 of 1 (latest)
@trim storm I want to increase the speed only when i press the button
Yes, you use that method to check if the button is pressed
You're already using a similar method, so you know how to check for input
if (Input.GetKey(KeyCode.Q))
{
moveSpeed = 30f;
}
or
if (Input.GetKeyDown(KeyCode.Q))
{
moveSpeed = 30f;
}
It stays till the end
That's not Shift is it
no, but I dont know how to do it with shift
i always have error whenever there is shift or Shift
But you know how to detect Q...
Your code already responds to the Q key
Read the docs carefully, you can figure this out. The problem is you are rushing and guessing
Aren't there 2 shifts on a keyboard?
If you need a hint: ||notice that the docs say the key can be identified by a value from the KeyCode enum. So... read the docs for KeyCode and see what key matches what you need||
The point is that whenever i press(just press) the key, my speed value change till i stop my project
That's because you're not resetting the speed if the key is not pressed
Bingo
What exactly?
When you type esle? Wdym by that? Can I see what you have right now?
that is probably the stupidest code you ve ever seen, but I am dumb
😉
oh wait
nevermind
I restarted my computer and now its worng
working*
thx so much
Excellent, glad you got it working