Sprite gone completely when its Y value is below 0

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
I've been playing around with Galv Visibility Range, and I found some weird glitch on his script.

My character jump off the screen and suddenly the visibility range gone just for a moment. At first I thought it was the glitch from the script itself, but I then I tried to reproduce the error and I succeed

The glitch is, when you have a sprite and a tilemap which has same viewport, if the sprite the value Y has less than zero, the sprite will gone completely. I can not easily noticable since you already know that most of Sprite_Character has the oy at the bottom of the sprite.

If you want to test, here is the test code I made

class Sprite_Test < Sprite def initialize(v) super(v) self.bitmap = Bitmap.new(450,450) bitmap.fill_rect(bitmap.rect, Color.new(0,0,0,120)) rect = Rect.new(width/2 - 100, height/2 - 100, 200, 200) bitmap.fill_rect(rect, Color.new(255,255,255,120)) self.ox = width/2 self.oy = height/2 self.x = Graphics.width/2 self.y = Graphics.height/2#~ self.zoom_x = self.zoom_y = 2.5 end def update super case Input.dir4 when 2 self.y += 5 when 4 self.x -= 5 when 6 self.x += 5 when 8 self.y -= 5 end end endDataManager.initdef updates Graphics.update Input.update @vport.update @vport2.update @spr.update @tile.updateend@vport = Viewport.new@vport2 = Viewport.new@vport.z = 50@spr = Sprite_Test.new(@vport)map = load_data(sprintf("Data/Map%03d.rvdata2", 1))@tile = Tilemap.new(@vport)@tile.map_data = map.data$data_tilesets[2].tileset_names.each_with_index do |name, i| @tile.bitmaps = Cache.tileset(name)endupdates while true 
If you get rid the tilemap completely, the sprite will work just fine. Also if you assign a different viewport for tilemap, the sprite will have no issue as well. However, if both has same viewport, it would generate the said issue.

Is anyone aware of this?

To overcome this problem might simply assign a different viewport for the sprite, but it's not a neat solusion I guess. I hope the next generation of RGSS will fix the tilemap class better.

Thought?
 

Adellie

NPC
Veteran
Joined
May 4, 2014
Messages
340
Reaction score
481
Primarily Uses
I recall encountering something similar. I wasn't using galv's script though. I was just trying to put a sprite on the screen.  I didn't know it had to do with tilemaps. D-: thanks for sharing. I'll try it later.



edit: Actually, I don't remember if it was the origin that couldn't go above the screen boundaries, or if it was just any part of the sprite. Anyway, it was annoying.
 
Last edited by a moderator:

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
That's not a glitch and it has nothing to do with the Tilemap class... Just make the Sprite's z bigger than the Viewport's.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
mmm, no. Not true. You can have a sprite with a negative z value and it will still show in the viewport. Sprite z and viewport z have nothing to do with each other.


Does this happen if you completely disable Galv's script?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
That's not a glitch and it has nothing to do with the Tilemap class... Just make the Sprite's z bigger than the Viewport's.
Hoho, so that was the problem. Welp, thank you!

Edit :

 

mmm, no. Not true. You can have a sprite with a negative z value and it will still show in the viewport. Sprite z and viewport z have nothing to do with each other.

Does this happen if you completely disable Galv's script?

 
Not tried it yet, I just try to reproduce the glitch in blank screen like what I've did in the code I made above

I will try in Galv's visibility later. I found this glitch very long time ago.when I was working on my game

And I ended up to limit the Y value not to go under zero. It solved my problem back then.

Anyway, it solved I guess :D
 
Last edited by a moderator:

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
mmm, no. Not true. You can have a sprite with a negative z value and it will still show in the viewport. Sprite z and viewport z have nothing to do with each other.

Does this happen if you completely disable Galv's script?
You're mistaken.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
If it's related to the z value, why does it only happen when y goes below 0? If z does not change on either the viewport or the sprite, and that's the cause of the problem, then it should happen ALL the time, not just when y goes below 0.
 

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
Simple. When two objects have the same z, acts as tiebreaker for drawing order and if the y value is the same, last created will be on top.

Viewport: 

z The viewport's z-coordinate. The larger the value, the closer to the player the plane will be displayed.

If multiple objects share the same z-coordinate, the more recently created object will be displayed closest to the player.
Sprite:

z The sprite's z-coordinate. The larger the value, the closer to the player the sprite will be displayed.

If two sprites have the same z-coordinates, the one with the larger y-coordinate will be displayed closer to the player, and if the y-coordinates are the same, the one that was generated later will be displayed closer to the player.
Cheers.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Just looked at Galv's visibility range... and he created the visibility range image before all the viewports. I guess, that was the problem. 

Ok, let see .....
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top