Status
Not open for further replies.

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
420
Reaction score
837
First Language
English
Primarily Uses
RMMV
So I have a problem of my character clipping thru events when they jump in front of them. I'm not sure how to make it so the player keeps priority when jumping in front of events.

Jump event.PNG

as you can see, the shadow of the character is visible but you can't see the player as they've clipped behind the event.
this only seems to happen though when the player jumps. is there anyway for the player to stay in front of event's priority wise when in a situation like this?
 

AeroFunk80

Veteran
Veteran
Joined
Aug 25, 2016
Messages
171
Reaction score
51
First Language
English
Primarily Uses
RMMV
What is your event's Priority set to? It isn't "Above characters," is it? If you set it to "Same As Character" or "Below," the player shouldn't go underneath the event. I'm guessing you need to set it to Same As Character so your player doesn't walk over it.

1632175018922.png
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
420
Reaction score
837
First Language
English
Primarily Uses
RMMV
it's set to same as character. I've noticed it doesn't cilp through the base of the event, meaning the very bottom of it. the higher I go up though the more likely I'll clip through the top of the event though.
 

AeroFunk80

Veteran
Veteran
Joined
Aug 25, 2016
Messages
171
Reaction score
51
First Language
English
Primarily Uses
RMMV
The image for your event. Is it from your tileset with an invisible event on top of it? Or is the image set from within the event?

If the image is from your tileset and the event is same as character with no image... check your tileset icon to make sure it's passage isn't set to "above" (the star icon).
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
420
Reaction score
837
First Language
English
Primarily Uses
RMMV
It's an image set from within the event. I've noticed no matter the size, the player clips through the top of the image when jumping. so even events the same size of the player, it happens. I'm not sure if the game is registering how big my event image is.
 

JorgeMaker

Veteran
Veteran
Joined
Jan 14, 2020
Messages
57
Reaction score
52
First Language
Português - BR
Primarily Uses
RMMZ
If I understand your problem correctly, this should fix:

JavaScript:
//=============================================================================
// ** RPG Maker MV - DragonMV_FixJumpDisplay.js
//=============================================================================

var Dragon                      = Dragon                  || {};
Dragon.Fixs                     = Dragon.Fixs             || {};
Dragon.Fixs.JumpDisplay         = Dragon.Fixs.JumpDisplay || {};
Dragon.Fixs.JumpDisplay.VERSION = [1, 0, 0];

/*:
 * @plugindesc [RPG Maker MV] - Correction of character sprites display when jumping. (v.1.0.0)
 * @help http://dragonrefuge.net
 * @author The Dragon (Jorge Feitosa)
 */

//-----------------------------------------------------------------------------
// Game_CharacterBase
//
// The superclass of Game_Character. It handles basic information, such as
// coordinates and images, shared by all characters.

Game_CharacterBase.prototype.jumpHeight = function() {
    if (this.isJumping()) {
        return (this._jumpPeak * this._jumpPeak - Math.pow(this._jumpCount - this._jumpPeak, 2)) / 2;
    } else {
        return 0;
    }
};

//-----------------------------------------------------------------------------
// Tilemap
//
// The tilemap which displays 2D tile-based game map.

Tilemap.prototype._compareChildOrder = function(a, b) {
    if (a.z !== b.z) return a.z - b.z;
    var
    aY = a.y + (a._character ? a._character.jumpHeight() : 0),
    bY = b.y + (b._character ? b._character.jumpHeight() : 0);
    if (aY !== bY) return aY - bY;
    return a.spriteId - b.spriteId;
};
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
420
Reaction score
837
First Language
English
Primarily Uses
RMMV
If I understand your problem correctly, this should fix:

JavaScript:
//=============================================================================
// ** RPG Maker MV - DragonMV_FixJumpDisplay.js
//=============================================================================

var Dragon                      = Dragon                  || {};
Dragon.Fixs                     = Dragon.Fixs             || {};
Dragon.Fixs.JumpDisplay         = Dragon.Fixs.JumpDisplay || {};
Dragon.Fixs.JumpDisplay.VERSION = [1, 0, 0];

/*:
 * @plugindesc [RPG Maker MV] - Correction of character sprites display when jumping. (v.1.0.0)
 * @help http://dragonrefuge.net
 * @author The Dragon (Jorge Feitosa)
 */

//-----------------------------------------------------------------------------
// Game_CharacterBase
//
// The superclass of Game_Character. It handles basic information, such as
// coordinates and images, shared by all characters.

Game_CharacterBase.prototype.jumpHeight = function() {
    if (this.isJumping()) {
        return (this._jumpPeak * this._jumpPeak - Math.pow(this._jumpCount - this._jumpPeak, 2)) / 2;
    } else {
        return 0;
    }
};

//-----------------------------------------------------------------------------
// Tilemap
//
// The tilemap which displays 2D tile-based game map.

Tilemap.prototype._compareChildOrder = function(a, b) {
    if (a.z !== b.z) return a.z - b.z;
    var
    aY = a.y + (a._character ? a._character.jumpHeight() : 0),
    bY = b.y + (b._character ? b._character.jumpHeight() : 0);
    if (aY !== bY) return aY - bY;
    return a.spriteId - b.spriteId;
};
Ahh thanks! this works perfectly. my character can now jump in front of events without clipping through the top of them. much appreciated. I'm curious though if you don't mind me asking, what exactly does this do? like what is it changing? It's mostly me asking because I'm wondering why it clips in the first place.
 

JorgeMaker

Veteran
Veteran
Joined
Jan 14, 2020
Messages
57
Reaction score
52
First Language
Português - BR
Primarily Uses
RMMZ
By default, characters are sorted by their Y position on the screen, that is, the higher the Y position, the higher the character's priority.
When the player jumped behind the event, he would naturally appear from behind because of his Y position, which at that moment would be smaller than that of the other entity.
What I did was just also consider the jump height in the ordering: char.y + char.jumpHeight.
 

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
420
Reaction score
837
First Language
English
Primarily Uses
RMMV
ahh ok, I see what you saying. I never thought about that. thanks again though.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,243
Reaction score
9,011
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

There are so many coding terms that are complete gibberish to me. Like what the heck is "Return" or "Array"??
Sometimes I forget how tiny and fun working in 16x16 is (or with 18x18 if ya counting the white outline LOL) and before you ask Yes. Yes this is an appropriate ratio of drinks to all the other stuff. :popcorn:
f37ac128dedc8a53af7deb2b12e8ea81becf6e46.png
Phew, sleep all day, awake all night. I don't know what to draw tonight!

Does that count as poetry? ..Is there a super fast way to test my creations in RPG Maker? Has anyone played the new Pokémon games? I'm itching to buy it but I don't think my husband will want me to after he finds out how much I spent on Christmas!
When can we get this?
RPG Maker MZ Saturn.png
Saturn port when?
I'm new to rpgmaker mv, link me some good stuff to learn.

Forum statistics

Threads
117,072
Messages
1,104,317
Members
153,053
Latest member
dusk_13
Top