- Joined
- Feb 26, 2014
- Messages
- 648
- Reaction score
- 55
- First Language
- English
- Primarily Uses
I came a crossed a really nice script in my google searches that allows me to play an 8-frame walk animation sprite sheet, now I've ran into a small snag:
As you can see, while my frontal walk animation fits within the 9x4 format the script calls for, my side walking animation does not fit within this ratio.
Beyond shrinking the second row to an a smaller size (which makes the sprites look like **** no how you resize them), I don't know how to make this work properly.
Now this is where my theory came into play, if this script alter's how it reads the above sprite sheet, then maybe I can alter it to read it how I want it to, the problem is, I can't figure it out. I mean yeah I can read and know what the script is saying to a degree but I'm afraid if I alter one value it will not work right due to the fact that the other parts of the script(That I can't understand) are asking for a value that no longer exists.
So If someone could tell me what changes to make and where then I'd be grateful.
Here's the specs of the sprites for reference.(this is going by the 9x4 ratio the script was calling for btw)
my frontal and hide view sprites fit exactly within a 32x64 px ratio
My side view sprites fit within a 64x64 px ratio.
What I need to know:
The script:
As you can see, while my frontal walk animation fits within the 9x4 format the script calls for, my side walking animation does not fit within this ratio.
Beyond shrinking the second row to an a smaller size (which makes the sprites look like **** no how you resize them), I don't know how to make this work properly.
Now this is where my theory came into play, if this script alter's how it reads the above sprite sheet, then maybe I can alter it to read it how I want it to, the problem is, I can't figure it out. I mean yeah I can read and know what the script is saying to a degree but I'm afraid if I alter one value it will not work right due to the fact that the other parts of the script(That I can't understand) are asking for a value that no longer exists.
So If someone could tell me what changes to make and where then I'd be grateful.
Here's the specs of the sprites for reference.(this is going by the 9x4 ratio the script was calling for btw)
my frontal and hide view sprites fit exactly within a 32x64 px ratio
My side view sprites fit within a 64x64 px ratio.
What I need to know:
- What values to change within the script and where so that it reads all 8 frames within a 64x64px ratio
- Exact size I need to make my new sprite sheet.
The script:
Code:
#----------------------------------# Thera's variation of the multiple frame script.## My first RSS script ever. I'm pretty proud of it.# It's meant to be used with a sprite set of 9 frames wide, with the first frame# being a 'standing still' frame, and the rest the actual walkcycle.## It only works on files using a '%' at the beggining of their name.#----------------------------------class Sprite_Character < Sprite_Base #-------------------------------------------------------------------------- # * Set Character Bitmap # # Thera's notes: Character Bitmap analyses the spriteset and sets how big # the frames in the sprite set are. # It also checks before hand whether the file start with a '!', '$' or '%' # After wards it sets the drawing origin of the sprite relative to the # character origin. #-------------------------------------------------------------------------- def set_character_bitmap self.bitmap = Cache.character(@character_name) #start changes# # Yes, this is a nested if_statement, but files starting with '!' would # complain if I did otherwise. sign = @character_name[/^[\!\$\%]./] if sign && sign.include?('$') @cw = bitmap.width / 3 @ch = bitmap.height / 4 @sixframes = false else if sign && sign.include?('%') @cw = bitmap.width / 9 @ch = bitmap.height / 4 @sixframes = true else @cw = bitmap.width / 12 @ch = bitmap.height / 8 @sixframes = false end end #end changes# self.ox = @cw / 2 self.oy = @ch end #-------------------------------------------------------------------------- # * Update Transfer Origin Rectangle # # Thera's notes: Update Transfer Origin Rectangle changes the part of the # spritesheet that is being used as the current sprite of the character. # So it moves this rectangle around on the spritesheet. # I make it check whether 'sixframes' and thus the special sheet is true, # applying different rectangle movements for different spritesheets. #-------------------------------------------------------------------------- def update_src_rect if @tile_id == 0 index = @character.character_index #start changes# if @sixframes pattern = @character.pattern+1 #I had to do this, this way, so that the #animation doesn't do back to the second frame after visiting the third. #The '+1" Allows it to skip over the first frame, the standing still #frame sx = (index % 4 * 9 + pattern) * @cw else pattern = @character.pattern < 3 ? @character.pattern : 1 sx = (index % 4 * 3 + pattern) * @cw end sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch self.src_rect.set(sx, sy, @cw, @ch) end endendclass Game_CharacterBase #-------------------------------------------------------------------------- # * Update Animation Pattern # # Thera's notes: Update Animation Pattern makes sure that a character cycles # through it's sprite animation. Again, it first checks the filename before # applying operations. # The @pattern variable if very important when editing sprite animation. # Thus I edited basically any instance of it being modified when making this # script. #-------------------------------------------------------------------------- def update_anime_pattern if @character_name[0, 1] == '%' if !@step_anime && @stop_count > 0 @original_pattern = -1 @pattern = @original_pattern else @pattern = (@pattern + 1) % 8 #Changed it to 8 here because we want to have an 8 frame animation. end else if !@step_anime && @stop_count > 0 @original_pattern = 1 @pattern = @original_pattern else @pattern = (@pattern + 1) % 4 end end end # Thera's notes: I actually don't know what straighten position is supossed to # do exactly, but as it was modifying the @pattern variable, I decided to # adapt it to this script's standards. def straighten if @character_name[0, 1] == '%' @pattern = -1 if @walk_anime || @step_anime @anime_count = 0 else @pattern = 1 if @walk_anime || @step_anime @anime_count = 0 end end # Similar as with straighten, I adapted this one because of the appearance of # the @original_pattern variable. def set_graphic(character_name, character_index) @tile_id = 0 @character_name = character_name @character_index = character_index #changed from 1 to -1 if @character_name[0, 1] == '%' @original_pattern = -1 else @original_pattern = 1 end #end change endendclass Game_Event < Game_Character#-------------------------------------------------------------------------- # * Set Up Event Page Settings # # Thera's notes: This sets up the event with all the parameters defined in # the event page in the editor. I chenged the part where the character graphic # was set up, because otherwise it would default to the second frame when # character were standing still. #-------------------------------------------------------------------------- def setup_page_settings @tile_id = @page.graphic.tile_id @character_name = @page.graphic.character_name @character_index = @page.graphic.character_index if @original_direction != @page.graphic.direction @direction = @page.graphic.direction @original_direction = @direction @prelock_direction = 0 end if @character_name[0, 1] == '%' if @original_pattern != @page.graphic.pattern @pattern = @page.graphic.pattern @original_pattern = -1 end else if @original_pattern != @page.graphic.pattern @pattern = @page.graphic.pattern @original_pattern = @pattern end end @move_type = @page.move_type @move_speed = @page.move_speed @move_frequency = @page.move_frequency @move_route = @page.move_route @move_route_index = 0 @move_route_forcing = false @walk_anime = @page.walk_anime @step_anime = @page.step_anime @direction_fix = @page.direction_fix @through = @page.through @priority_type = @page.priority_type @trigger = @page.trigger @list = @page.list @interpreter = @trigger == 4 ? Game_Interpreter.new : nil endend
Last edited by a moderator:
