Hi, here I am again. please, can somebody explain to me how to call a function inside the code? Example:
Here i created a function
And here I want to call the function
In c# it works pretty same but it doesnt work in JavaSccript
Hi, here I am again. please, can somebody explain to me how to call a function inside the code? Example:
Here i created a function
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!
Yes that really helped! Thanks… need to learn when to use this.
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!
Thank you so much <3