Forward movement by "W" key

Hello. I’m back with trying to create new project.

I’m started making simple game where model (train cab) should move forward by holding a “W” key on keyboard. How i can create simple script, where train must move like train - imagine you are holding a W and train is running. When you stop holding this key, train will be braking.

I want to simulate only forward and back moves. Forward for riding, but back for braking.

Camera is included inside the model - train cab and can be moved together.

I tried searching some tutorials but these vide were usually without using arrows/keys, just move like AI.

Help me please!

“searching some tutorials” is probably not going to be useful to you.

Try this method instead.

Two steps to tutorials and / or example code:

  1. do them perfectly, to the letter (zero typos, including punctuation and capitalization)
  2. stop and understand each step to understand what is going on.

If you go past anything that you don’t understand, then you’re just mimicking what you saw without actually learning, essentially wasting your own time. It’s only two steps. Don’t skip either step.

If you cannot get it from tutorials, you CERTAINLY will not get it from this text box!!!

Imphenzia: How Did I Learn To Make Games:

It was obvious, i got this reply. Uhh so, i must counting myself.

Use the force Luke

from what im understanding, this could be of some use to you:

hopefully it helps

alternatively, this script contains some input code you could copy/study. its pretty simple to understand:

ha ha. However the best option to create simple script was ai chatbot. :stuck_out_tongue: