Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #----------------------------------
- # 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 #Orginal Value 3
- @ch = bitmap.height / 4 #original value:4
- @sixframes = false
- else
- if sign && sign.include?('%')
- @cw = bitmap.width / 9 #Original Value:9
- @ch = bitmap.height / 4 #Original Value:4
- @sixframes = true
- else
- @cw = bitmap.width / 12 #I made a change here Original value:12
- @ch = bitmap.height / 8 #I made a change here Original Value: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 #orginal second value: 9 Orginal first value: 4
- 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
- end
- end
- class 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) % 6 #original value 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
- end
- end
- class 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
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment