Status
Not open for further replies.

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
420
Reaction score
836
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
836
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
836
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
836
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
836
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,239
Reaction score
9,009
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

Cosmetix.gif

Hey man, why don't you do some progress on your game? Oh, because you'd rather wake up at 5am and spend the night making a cosmetics system for your side view battlers? Ok.
spillycup wrote on Finnuval's profile.
i love u so much! i’m so happy you’re in my life right now :kaocry:
To my horror, I found out I got zero Jack Vance books in my bookshelf! :kaoback: Where do y'all go in the internet to buy used books? Like, not Amazon?
Marquise* wrote on Mrs_Allykat's profile.
Your new logo is sooooo attractive! Feels like those sour liquid candy mixed with the wrapping of the popping candy rocks ones. ^^ It gives flavor and taste to our eyes. ^^
Sorry I couldn't comment before, I relogged here for someone's B-Day yesterday. ((Yeah yeah... been scared got on the throne and all as usual. Being social seems harder than walking now. So sorry to everyone and especially you.))
How goes the game make?

Forum statistics

Threads
116,991
Messages
1,103,614
Members
152,876
Latest member
TimothyBlott
Top