As the title say, its seem like the isMoving() method of Game Event (and all of Game Character Base) dont work right as expected when the display move along. Example: When i make an event move route repeat and move the display around, the isMoving expected to return true the whole time (since the event is repeat movement) but instead, its bugged (return true for some time, then 1 false, then true some time and repeat). How can i solve this? Now i'm using the _moveRouteForcing property instead, but knowing its moving or not is a betterthan only know its move route forcing.
Game Event isMoving() method dont work right
Learning JavascriptNo, that's not how it works.
A character has an x and y position, which refers to the tile position, and is a whole number. However as they are moving between tiles, the realX and realY positions will be fractional, based on the distance between the tiles and the speed of movement, and how long since they started moving.
In theory, as the character is moving between tiles, x and realX will be different, or y and realY will be different. When the move between tiles has finished, the values should be the same. This is what triggers the next step when you create a movement route with a series of steps. Only when the character has fully moved to one tile can they start moving to the next.
So if you want to know if the character is moving due to a move route, you'd look at isMoveRouteForcing()
A character has an x and y position, which refers to the tile position, and is a whole number. However as they are moving between tiles, the realX and realY positions will be fractional, based on the distance between the tiles and the speed of movement, and how long since they started moving.
In theory, as the character is moving between tiles, x and realX will be different, or y and realY will be different. When the move between tiles has finished, the values should be the same. This is what triggers the next step when you create a movement route with a series of steps. Only when the character has fully moved to one tile can they start moving to the next.
So if you want to know if the character is moving due to a move route, you'd look at isMoveRouteForcing()
I'm not entirely sure on a real solution to this problem, but to give you a better idea of what is happening here this is how isMoving() works. When your character/event moves from one tile to another while it is transitioning from one tile to another isMoving() is true, once it reaches the next tile it flips false and if you move from that tile to another tile it flips true until it reaches the next tile and flips false, it happens really fast. I encountered this problem when making a stamina system for my game and had to instead check for move button press and isDashing() combined. For an event though i'm not sure.
Off the top of my head you could just create your own status and turn it true before your event starts moving and flip it false after your event stops moving. If this is something you might want to try this is essentially how you would do it.
right before your event starts to move do something like this, or exactly this lol.
Script call: this._isMoving = true;
do all your movements. if your event eventually stops moving... right after its done moving do this.
Script call: this._isMoving = false;
you would check this by using $gameMap.event(eventId)._isMoving;
It's a bit of a work around but its exactly what i would do it and it would work very well :mrsatan:
oh shaz with an actual answer 😀
Off the top of my head you could just create your own status and turn it true before your event starts moving and flip it false after your event stops moving. If this is something you might want to try this is essentially how you would do it.
right before your event starts to move do something like this, or exactly this lol.
Script call: this._isMoving = true;
do all your movements. if your event eventually stops moving... right after its done moving do this.
Script call: this._isMoving = false;
you would check this by using $gameMap.event(eventId)._isMoving;
It's a bit of a work around but its exactly what i would do it and it would work very well :mrsatan:
oh shaz with an actual answer 😀
You could do
event.isMoving() || event.isMoveRouteForcing()
in a condition, which will return true if they're in the middle of a move route OR in the process of moving single tiles, via, say, Random Movement, to cater for the possibility that they're moving but not due to a move route.
event.isMoving() || event.isMoveRouteForcing()
in a condition, which will return true if they're in the middle of a move route OR in the process of moving single tiles, via, say, Random Movement, to cater for the possibility that they're moving but not due to a move route.
seem like a good solution :3 thanks both of you for answering me, i'm actually doing my own method to solve this (return this._moveRouteForcing || this.isJumping) but its seem your solution is better xD i will try its, thanks very much 😀
Original thread: https://forums.rpgmakerweb.com/threads/game-event-ismoving-method-dont-work-right.121756/