The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Heretic86 on February 17, 2012, 12:11:10 PM

Title: [XP] Script Help Request - ZIndex for Sprites
Post by: Heretic86 on February 17, 2012, 12:11:10 PM
I'll do my best to explain.  I have a Caterpillar thing going on, and I am trying to adjust the ZIndex (.z) of those Events, due to a couple quirks with em, essencially so the layer correctly.  Basically, the first guy to follow your main character should be on top of the 2nd guy following your character, and the 2nd guy is on top of the 3rd.  That is, when they are all stacked up in the same place.

I remember that I'd have to add an attr_accessor :z to access that property for that Class, however .z appears to be added in multiple spots (thinking class Sprite_Character < RPG::Sprite) but I cant figure out how to access self.z from a Different Class.

Im also not sure how much to adjust the value by.  As far as I can tell, the value is 63 when I mess with the Sprite_Character class, so should I drop it down by the height of the graphic, or will -1 and +1 suffice?

Hoping the end result would be something like this:

event.Caterpillar_Guy_1.z += 2 #orig is 63
event.Caterpillar_Guy_2.z += 1
event.Caterpillar_Guy_3.z (no change)

Does that make any sort of sense?

ZIndex being like HTML where the highest ZIndexed block appears on TOP of anything with a lower ZIndex.  Or did I totally not understand what the .z property is?  Oh, and the Caterpillar Class I am working with is NOT an extension of any other classes.  If that helps, and I think that is why I am stuck.