Stop Player Passing Through Event

Ok, so basically have a sprite which is larger than the square that the event is on (!$sprite), how do I stop the player from passing through all parts of the sprite?


Note: the sprite moves also.
EDIT: Crap. I really need to stop clicking things in Recently Posted without checking WHERE they're posted. My answer is for MV; I can't say for certain if it will work in VX.


Either chop up the sprite into multiple pieces, or pad it with blank events at the same layer as the player, so that the player can't pass through.


Every time you move the main event, give identical movement commands to the other events, so that they move together. If you've set a move route on the event, you'll have to remove it, and do the movement via eventing.


I have a floating castle on one of my maps that randomly roams. I'll screenshot together my event commands, so you can have an example. I can't guarantee that it's the best way, but it works.


castle1.jpg


castle2.jpg


The event continues, but it's just the same thing for each direction from 3 - 8. Remember to include a Wait command at the end of any Parallel event to reduce lag; you'll need to experiment to see how much of a wait you want to get smooth movement at the speed you want.
This is awesome Roderick. But only works for stuff the Player can run under or through.Or can the player block one casdtle tile and the rest stops?


If you need collision for ground stuff you could try Khas Pixelmovement 1.2 Script and disable the pixelmovement.


It got a Function that lets you increase or decrease the boundaries of a sprite. Sorry dont have any other real solution for you.


But its all shown in the Demo Game which comes with the Script.
Edit the canvas of the event graphic file in a photo-editing program so that the canvas size is larger than the visible part of the sprite.  For example, if the visible sprite is 32x32 but you need it to cover a 96x64 (96 width, 64 height) area, then you should make the canvas 288x256 - always three times the event area's width for three poses, and four times the event area's height for four directions.


The new event graphic file should still begin with $ and ! and should look like the following ( - represents blank space, and v represents the visible sprite; _ and | are imagined gridlines that are here to separate the frames in your mind but don't exist in the file itself):


 -   -   - | -   -   - | -   -   -


 -   v   - | -   v   - | -   v   -


 -   -   - | -   -   - | -   -   -


 -   v   - | -   v   - | -   v   -


 -   -   - | -   -   - | -   -   -


 -   v   - | -   v   - | -   v   -


 -   -   - | -   -   - | -   -   -


 -   v   - | -   v   - | -   v   -


With this approach, you won't need to mess with any additional eventing or coding, and your event's movement will not look disjointed.


(If the event can event commands and you only want the player to be able to interact with the event where the "v" is marked, then you would need to add Conditional Branches to check the player's location, event's location, and player's direction.  You only need to do this if you want to disallow the player from interacting with any part of the event's hitbox rather than a specific part, though.)

Original thread: https://forums.rpgmakerweb.com/threads/stop-player-passing-through-event.62287/