How to call a function

Hi, here I am again. please, can somebody explain to me how to call a function inside the code? Example:

Here i created a functionScreenshot_25

And here I want to call the function

In c# it works pretty same but it doesnt work in JavaSccript

You almost got it, it’s actually “this.playerStopMovement();”

Hope that helps!

1 Like

Yes that really helped! Thanks… need to learn when to use this.

1 Like

Yeah, since your function is in the PlayerMovement.prototype scope when you first defined it, then you have to use “this” to reference it from then on. You could make a global function called playerStopMovement() and call it like you had if you did var playerStopMovement = function()…, but that would probably cause a lot of problems that you wouldn’t be expecting and it’s generally bad practice.

In any case, good luck on your project!

1 Like

Thank you so much <3

1 Like