Sansonic Auguste Polichinelle
Nombre de messages : 1116 Age : 31 Projet(s) en cours : ... Niveau Rpg Maker : jugez !... Date d'inscription : 28/07/2007
| Sujet: [script] Mouvement plus "fluides" Mar 19 Aoû 2008, 19:52 | |
| Fonction: Voila ce script permet de faire des mouvement plus fluide par un ajout de poses dans les sprites de characters.(jusqu'à 12 si je ne ma trompe pas) Auteur: Zeus81 - Code:
-
#==================================================================== # ■ Modification du nombre de mouvements et de directions des characters #==================================================================== # Auteur : Zeus81 # Extrait de l'AMS par Darkleo #-------------------------------------------------- # Dans les fichiers graphiques, le nom permet de définir les caractéristiques mouvements et directions # Ajoutez "_mvt[12]" au nom pour afficher 12 mouvements au lieu de 4 # Ajoutez "_dir[1]" au nom pour afficher 1 direction au lieu de 4 # Vous pouvez bien sur combiner ces deux ajouts ("_mvt[1]_dir[1]") # # Il est inutile (si vous n'êtes pas scripteur) de mettre plus de 4 directions # Les fichiers 'normaux' aurons 4 directions pour 4 mouvements #====================================================================
#==================================================================== class Game_Character #-------------------------------------------------------------------------- attr_reader :pattern_max #-------------------------------------------------------------------------- alias old_initialize initialize def initialize old_initialize # Ajoute la variable pour le nombre maximum de mouvements @pattern_max = 4 end #-------------------------------------------------------------------------- alias old_update update def update if jumping? update_jump elsif moving? update_move else update_stop end if @anime_count > 18 - @move_speed * 2 if not @step_anime and @stop_count > 0 @pattern = @original_pattern else # Fait défiler tout les mouvements @pattern = (@pattern + 1) % @pattern_max end @anime_count = 0 end if @wait_count > 0 @wait_count -= 1 return end if @move_route_forcing move_type_custom return end if @starting or lock? return end if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency) case @move_type when 1 move_type_random when 2 move_type_toward_player when 3 move_type_custom end end end #-------------------------------------------------------------------------- end #====================================================================
#==================================================================== class Game_Event #-------------------------------------------------------------------------- alias old_refresh refresh def refresh old_refresh # Corrige le nombre de mouvements maximum @pattern_max = (@character_name[/_mvt\[([0-9]+)\]/] != nil ? $1.to_i : 4) end #-------------------------------------------------------------------------- end #====================================================================
#==================================================================== class Sprite_Character < RPG::Sprite #-------------------------------------------------------------------------- alias old_update update def update super if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue @tile_id = @character.tile_id @character_name = @character.character_name @character_hue = @character.character_hue if @tile_id >= 384 self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue) self.src_rect.set(0, 0, 32, 32) self.ox = 16 self.oy = 32 else self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) # Corrige le découpage des charas @cw = bitmap.width / (@character_name[/_mvt\[([0-9]+)\]/] != nil ? $1.to_i : 4) @ch = bitmap.height / (@character_name[/_dir\[([0-9]+)\]/] != nil ? $1.to_i : 4) self.ox = @cw / 2 self.oy = @ch end end self.visible = (not @character.transparent) if @tile_id == 0 sx = @character.pattern * @cw sy = (@character.direction - 2) / 2 * @ch self.src_rect.set(sx, sy, @cw, @ch) end self.x = @character.screen_x self.y = @character.screen_y self.z = @character.screen_z(@ch) self.opacity = @character.opacity self.blend_type = @character.blend_type self.bush_depth = @character.bush_depth if @character.animation_id != 0 animation = $data_animations[@character.animation_id] animation(animation, true) @character.animation_id = 0 end end #-------------------------------------------------------------------------- end #====================================================================
#==================================================================== class Window_Base #-------------------------------------------------------------------------- def draw_actor_graphic(actor, x, y) bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) character_name = actor.character_name # Corrige l'affichage des charas dans les fenêtres direction_max = (character_name[/_dir\[([0-9]+)\]/] != nil ? $1.to_i : 4) pattern_max = (character_name[/_mvt\[([0-9]+)\]/] != nil ? $1.to_i : 4) cw = bitmap.width / pattern_max ch = bitmap.height / direction_max h = direction_max == 8 ? ch : 0 src_rect = Rect.new(0, h, cw, ch) self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end #-------------------------------------------------------------------------- end #==================================================================== | |
|