Status
Not open for further replies.

zerobeat032

Oh, it's that Zerobeat kid...
Veteran
Joined
Mar 28, 2014
Messages
415
Reaction score
808
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
168
Reaction score
47
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
415
Reaction score
808
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
168
Reaction score
47
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
415
Reaction score
808
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
415
Reaction score
808
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
415
Reaction score
808
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,154
Reaction score
8,939
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

Doing RPG Maker News for 24th October 2021

I'm not sure how to do this so I'll just ask here, Wheres a good place to post your game (for free) once its done?
I don't know what I'm doing :D
So got my hearing tested to see if it was the cause of my mishearing what people say. Test showed no problems but talked with the doctor about anxiety and ADHD causing hearing issues and she agreed and also added that some people hear things differently. With my anxiety cause I am in fight or flight I pay attention to all the sounds in the area so body knows when react. Can't pay attention to one source.

Forum statistics

Threads
116,063
Messages
1,095,436
Members
151,422
Latest member
otwm
Top