- Joined
- Oct 26, 2015
- Messages
- 32
- Reaction score
- 16
- First Language
- German
- Primarily Uses
- RMMV
Hello!
I'm looking for a way to stop the player from moving when the OK button is being pressed. I still want the player to be able to change the direction by using the arrow keys (as well as all other keys), I just want him to stay on the spot as long as the button is being pressed.
For starters I found a solution somewhere to at least make the player stop doing anything while the OK button is being pressed (here by activating a switch upon button press):
But it doesn't work properly at all, after a few minutes I'm getting a Maximum call stack size exceeded error message:

Any ideas how to implement this?
Btw., my knowledge of JavaScript is very very basic...
I'm looking for a way to stop the player from moving when the OK button is being pressed. I still want the player to be able to change the direction by using the arrow keys (as well as all other keys), I just want him to stay on the spot as long as the button is being pressed.
For starters I found a solution somewhere to at least make the player stop doing anything while the OK button is being pressed (here by activating a switch upon button press):
JavaScript:
(function(alias) {
Game_Player.prototype.getInputDirection = function() {
if ($gameSwitches.value(10)) return 0;
else return alias.apply(this, arguments);
};
})(Game_Player.prototype.getInputDirection);
But it doesn't work properly at all, after a few minutes I'm getting a Maximum call stack size exceeded error message:

Any ideas how to implement this?
Btw., my knowledge of JavaScript is very very basic...