All Questions

Community

C
Craig Cashman

Naming convention linear_velocity

I am confused as to why you only used the 'linear_velocity' name in the 'calculate_move_ velocity' function. I understand that 'linear_velocity' is an input into the 'move_and_slide' function, but wouldn't it have been clearer to then use 'linear_velocity' in place of 'velocity' throughout the script, or just use 'velocity'? I think that it would possibly be clearer that if a parameter called 'velocity' is being passed into the function, that the function refer to this parameter as 'velocity' rather than 'linear_velocity' - but I could be missing something.

  • Nathan Lovato replied

    Sure. It's a small thing. I used it as a function parameter name because that's how it is named in the rest of Godot. So if you name your variable velocity, the corresponding parameter is still named linear_velocity in Godot's functions.

  • C
    Craig Cashman replied

    Agreed that it is just a small thing. I just wanted to make sure that I wasn't missing anything bigger, as I am just a beginner. Thanks for your prompt response.

  • C
    Craig Cashman replied

    I should also mention that the course is fantastic. You are a natural teacher. It must take so much work to produce such high quality content. Thank-you. It is appreciated.

  • Nathan Lovato replied

    Thanks a lot :)

    Glad you're liking it.