Chaos Project

RPG Maker => RPG Maker Scripts => Topic started by: Heretic86 on June 04, 2012, 10:53:08 pm

Title: Floating Point Z-Index?
Post by: Heretic86 on June 04, 2012, 10:53:08 pm
So im screwing around with Game_Character def screen_z(height=0) trying to figure out why changing Ints to Floats arent causing the adjusted numbers to work.  But need to ask someone with a bit more experience than I have as what I have to do for making Floats work.  IE, for the non super duper scripter crowd (myself usually included in that), Z-Index usually returns as a Whole Number.  Something like 29 or 341.  Decimals are Floats.  8.125, 34.7. 6.075.  Are the floats getting floored somewhere in other code that can be modified?
Title: Re: Floating Point Z-Index?
Post by: ForeverZer0 on June 04, 2012, 11:09:22 pm
The Z values are calculated in the underlying library, which unlike Ruby is a strongly typed language, meaning you can just change a value around from one type to another as you please. An integer is an integer, a float is a float, and a variable containing one will never be another. I am quite certain that a non-integer value is going to be coerced into an integer before being used by the engine.

Aside from that, it really doesn't make sense for a Z index to have to be a float. For all intended purposes, you have as many Z values to work with as you want. If you are forced to keep a viewport Z within a certain range (i.e. between 2 map layers), then just change the Z index of the sprites on that viewport.  The same can be said vice-versa.

To answer your question, no you can't modify the engine to use floats for Z indices by means of Ruby. They are complete different animals.
Title: Re: Floating Point Z-Index?
Post by: Blizzard on June 05, 2012, 02:43:28 am
A Z coordinate as float only makes sense in 3-dimensional space. In 2D or 2.5D the Z coordinate (also called Z-Index or Z-Order) should always be int. This makes things simpler, trust me.
Title: Re: Floating Point Z-Index?
Post by: Heretic86 on June 05, 2012, 08:49:19 am
Okay.  I believe you.  I was trying to come up with a creative way to adjust the z-indexes with more fine control and keep it in a ballpark range without clamping.  Was messing with larger party sizes and came across some bugs that were caused by those z-index adjustments.