How do I reposition the player on the active tile?

Status
Not open for further replies.

CopperGenie

Villager
Member
Joined
Oct 8, 2020
Messages
23
Reaction score
27
First Language
English
Primarily Uses
RMMZ
Hello again!!

I am trying to reposition the player's model on the tile it is currently on. By default, character sprites are offset 6 pixels up on the y-axis to give the illusion of "standing on the tile". But I would rather have my player (and all other characters too) fully *on* the active tile. I'll show you what I mean.

(sorry for low img quality)
Here is my character before he walks in front of this wall. The tile directly to the right of me is passable, and the tile to the topright is "through".
1.png
Here is what happens when I walk onto the passable tile:
2.png
As you can see, six pixels (or two "big pixels", since it's a 16x sprite) of my player are cut off because they are technically on the tile above me.

I have looked in the .js files and all I could find were the functions Game_Player and Game_Character in rmmz_objects.js. But I didn't find anything to offset the sprite on the active tile.

Does anyone have experience with this, or can anyone give me some recommendations to try? Thank you! <3
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,965
Reaction score
2,294
First Language
EN
Primarily Uses
RMMZ
You can put a ! at the start of filename of the player's spritesheet, e.g. !Actor1_1.png. This will mark it as an "object character", negating the default 6 px vertical offset: that's why spritesheets of doors etc generally have filenames with a ! at the start. Note that object characters also ignore the "bush" effect (obscures bottom 12 px of character when on tiles marked as bush in the database), which might be undesirable.

Alternatively you could do it with a plugin, e.g. I think this will remove the 6 px vertical offset for all characters:
JavaScript:
Game_CharacterBase.prototype.shiftY = function() { return 0; };
To try it out, save it as a .js file (paste into a text-editor, Save As > File Type: All Files, Filename: whatever.js) and import it as a plugin. This way you don't have to worry about reassigning all your spritesheet references, and it shouldn't affect bush tiles either~ :kaothx:
 

CopperGenie

Villager
Member
Joined
Oct 8, 2020
Messages
23
Reaction score
27
First Language
English
Primarily Uses
RMMZ
EEEE you are lifesaver my friend!
The script worked <3
Also now I know how easy it is to make plugins, tyty!
 

patternBlue

Villager
Member
Joined
Jan 31, 2020
Messages
15
Reaction score
7
First Language
English
Primarily Uses
RMMV
I was so frustrated wondering why my character was 6 pixels higher than expected. My characters head was always going behind the upper layer of rocks and trees :kaodes: I thought I was going to have to shift all the "above" layers of my layer maps up slightly and then always have to deal with some weird hack.
This little plugin saved me so much time! Thank you @caethyril!
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,965
Reaction score
2,294
First Language
EN
Primarily Uses
RMMZ
Great! Try to avoid bumping old support threads, though. Here's the usual spiel:

@patternBlue, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Happy RPG Making! :kaojoy:

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

Finally, I have graduated from college and now I can put a lot more work into my game, after having not worked on it for the better part of a year.

Finally was able to record the rest of the game demo! I added some edits here and there, this is why it takes me so long to do stuff cuz I find a problem and have to fix it asap. x.x
Game: https://dj990j.itch.io/region-of-mythos
Databasing. Just with what I consider "bare minimum", I have listed over 200 skills. That's not all of it, and isn't even considering skills that only 1 class would realistically have. lol

It's a Spanish devlog don't get scared!.
Just read the forum rules just for kicks and rule 14 reminds me of this:
150.jpg

Forum statistics

Threads
117,060
Messages
1,104,192
Members
153,026
Latest member
sleezyretro
Top