Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Correct Character Sprite Display
#2
I'm really screwing things up repeatedly with editing this script to try and improve perceived issues, ahaha.
  • This script does not take in account shift_y that makes sprites offset. If a game creator alters this, sprites extend further into other tiles. Editing the code to compensate for this, I then find that tall events standing under * tiles and the hero walking away from them there's momentary feet appearing over the hero.
  • I'm not sure why x-axis tiles are being a bother. I was unable to be successful with having a loop to check tiles either side of an event. Sometimes walking away from a * tile there's a moment where the tile will reappear over the hero. This is a problem with tiles like fences or reception desks. Other times it's the opposite, which might be caused by my edits. Reverting those avoids that.
  • It appears that even with the default offset of 4px, my sprites will cover three tiles. Their location, their upper body, and the smidgen of pixels they phase into. This is probably a cause of a large number of issues, as I edit things to consider their height and run into those issues.
I think the thing is, every tile and event needs to have a z value influenced by their y axis or height. This z value would only come into play if [*] passability for tiles, or if normal priority for events. The cause of these visual errors is because what we're getting basically are "sheets" of sprites, that are associated with z-axies, and the z-axies are associated with what's above (y) the sprite. Because this is checked as a sprite moves onto a tile and is based only on what's above them, weirdness occurs because an event that's not next to a [*] or similar will be on a lower (z) "sheet".

Except I think this would cause a lot of lag? Maybe it's part of the lag that plagued RMXP. RMXP had different levels of priority for [*] tiles, what maybe needs to be done is altering the priority of those tiles, not the event sprites.

This is what my experimentation resulted in anyway, I don't think it's much better. The only thing that's really that great is the terrain tag 7 check to make a tile always appear over the hero, which works for the likes of doorways.

PHP Code:
#==============================================================================
# ▼ Moby's Script System - Correct Sprite Display V1.0
# -- Last Updated: 2014.02.05
# Edit by Taylor and brushfe
#==============================================================================

#==============================================================================
# ** Spriteset_Map
#==============================================================================

class Spriteset_Map
  
#--------------------------------------------------------------------------
  # * Update Character Sprite
  #--------------------------------------------------------------------------
  
alias :msscsd_update_characters :update_characters unless $@
  
def update_characters
    
# Original method
    
msscsd_update_characters
    
# On every sprite
    
@character_sprites.each do |curr_sprite|
      
# Determine if sprite has hero priority and visible
      
if curr_sprite.character.normal_priority? &&
        
curr_sprite.visible && curr_sprite.character.character_name != ""
        
# Get height in tiles
        
height get_height(curr_sprite)
        if 
height 1
          x 
curr_sprite.character.x
          
#curr_sprite.z = 100
          # Get tile data
          
id $game_map.data[xcurr_sprite.character.y2]
          
flag_pos $game_map.tileset.flags[id]
          
# Return if invalid tile
          
if (!(flag_pos 0x10 != 0) || id == 0# I HATE THIS LINE WITH A PASSION FOR NOT LETTING ME REPLACE IT WITH 'RETURN', FUCK
          # Go through every tile the sprite may appear over
          
for i in 2..height
            y 
curr_sprite.character.- (1)
            
# Return if invalid tile
            
return if $game_map.data[xy2].nil?
            
flag $game_map.tileset.flags[$game_map.data[xy2]]
            
# If valid and not terrian ID 7
            
if flag 0x10 != && $game_map.data[xy2] != && $game_map.terrain_tag(xy) != 7
              curr_sprite
.300 #+ curr_sprite.character.y
              
break
            else
              
curr_sprite.100
            end
            loc 
= [curr_sprite.character.xcurr_sprite.character.1]
            
$game_map.events_xy(*loc).each do |event|
              if 
event.normal_priority?
                
curr_sprite.300 #+ curr_sprite.character.y
                
break
              
end
            end
          end
          end 
# (!(flag_pos & 0x10 != 0) || id == 0)
        
end
      end
    end
  end
  
#--------------------------------------------------------------------------
  # * Gets the given Sprites height
  #--------------------------------------------------------------------------
  
def get_height(curr_sprite)
    
height 0
    height 
= (curr_sprite.src_rect.height curr_sprite.character.shift_y).to_f 32
    height 
+= if curr_sprite.src_rect.height 32 0
    
return height.round 1
  end
end 

(we could really do with a ruby tag with ruby syntax highlighting, 'cause this aint php)
Reply }


Messages In This Thread
RE: Correct Character Sprite Display - by Taylor - 02-05-2014, 05:53 AM
RE: Correct Character Sprite Display - by Taylor - 02-05-2014, 10:17 PM
RE: Correct Character Sprite Display - by Taylor - 02-10-2014, 09:11 AM
RE: Correct Character Sprite Display - by Taylor - 02-10-2014, 11:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Character's Dash Animation kyonides 0 174 04-08-2024, 03:50 AM
Last Post: kyonides
   Aleworks Input Mouse Sprite Add-On DerVVulfman 2 887 09-21-2023, 02:56 PM
Last Post: DerVVulfman
   Set Map's Display Name ACE kyonides 0 762 12-16-2022, 09:44 PM
Last Post: kyonides
   Character Select Script Selwyn 3 9,602 03-07-2017, 04:14 AM
Last Post: JayRay
   ProjectMeLT XRXS - 5-6 Character Menu JackMonty 0 5,139 04-16-2013, 02:41 PM
Last Post: JackMonty
   Victor Engine - Character Control Victor Sant 0 4,689 01-04-2012, 09:54 AM
Last Post: Victor Sant
   Victor Engine - Character Effects Victor Sant 0 4,249 01-01-2012, 02:08 PM
Last Post: Victor Sant
   Main Character Select Screen Raziel 4 10,763 05-27-2010, 04:48 PM
Last Post: sakhawat21
   Change Name / Graphic or Zoom Character Graphic XP VX kyonides 4 7,712 03-04-2010, 11:23 AM
Last Post: Villain
   Battler Sprite Addons Kain Nobel 0 4,913 09-17-2009, 12:42 PM
Last Post: Kain Nobel



Users browsing this thread: