Event/Player Collision Detection

AdamWillard

Villager
Member
Joined
Dec 2, 2013
Messages
5
Reaction score
0
First Language
English
Been trying to recreate a project made with VXAce in MV and I noticed some problems while testing the collision detection with moving events. I'm using events that are set to a route and kill the player when the event touches the player, or the player moves into the event. Problem is when setting the Player speed to max and the event speed/frequency to max I am able to pass through the event when it switches move directions.

Event touch will not work for what I am after so I am using a parallel process on the event with the conditional branch below.

$gamePlayer.x == $gameMap.event(this._eventId).x && $gamePlayer.y == $gameMap.event(this._eventId).y

I have tried multiple approaches to get a working moving enemy that causes a teleport to start of map with no luck. Anyone have any ideas or came across this collision problem yet? To be fair rpg maker vxace has this problem as well.
 

Blue001

Veteran
Veteran
Joined
Jan 13, 2014
Messages
231
Reaction score
111
First Language
English
Primarily Uses
RMMV
As far as I know, when an event moves... it's actual position doesn't really match it's sprites current X,Y

The moment a sprite starts to move, it's relative position immediately changes to the new tiles X,Y and isn't considered being in the old tile anymore. So as you say, move speed really alters how this works. Even if it takes your sprite 4 seconds to move to the left one tile, the game may already consider it being there. So if you run into it in the old tile, even though it's on top of you, it won't count.

As for how to solve this issue.... maybe someone can make a plugin to have the game consider the event at both locations at the same time?
 

AdamWillard

Villager
Member
Joined
Dec 2, 2013
Messages
5
Reaction score
0
First Language
English
In testing I have a solution to this problem by doing two more conditional checks.

IF  $gamePlayer.isMoving()

  IF  $gamePlayer.x == $gameMap.event(this._eventId).x && $gamePlayer.y -1 == $gameMap.event(this._eventId).y && $gamePlayer.direction() == 2

  IF  $gamePlayer.x == $gameMap.event(this._eventId).x && $gamePlayer.y +1 == $gameMap.event(this._eventId).y && $gamePlayer.direction() == 8

The last sets of IF statements should be repeated for all 4 directions if this is needed, in my case its only up and down.

Perhaps there is still a better way to achieve this? I worry about lag when using many of these event (enemies) such as in a room full of moving fireballs from wall to wall.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I just saw in a manga an interesting mechanic - setting up a stationary teleport beacon that one can go to no matter where one is in a dungeon. I think it'll work with a similar setup to how I did my airship transition.

Ooh what if you could set up multiple beacons and choose from a list of the beacons you set up?

Hmm...
Actor2_1 added!

Is the running performance of MZ output to Android platform smoother than MV output?
FINALLY GOT ALL 120 STARS IN SUPER MARIO 64!!!

Ok i got the model New and I will develop a little more, I think my SV is not beautiful yet.

Forum statistics

Threads
103,251
Messages
998,357
Members
134,746
Latest member
Boris-ko
Top