Inscrit le: 16 Aoû 2006, 00:00 Messages: 257 Points d'aide: 0/60
Créations :
Voir ses créations
|
Non mais ce scripts ne fait pas de l'iso à proprement parler. Normalement il suit des axes à 120°:  Regarder seulement l'image où il est écrit "Isométrie" Pour parler du script qu'il a poster il ne se déplace pas en suivant ces axes donc il ne sert seulement à se déplacer dans les 8 directions. Voici un script dont je me sers pour mon Kingdom Hearts (encore secret ;D) qui respectes ses lois: - Code: Tout sélectionner
#-------------------------------------------------------------------------- class Game_Character #-------------------------------------------------------------------------- def update_move # Convert map coordinates from map move speed into move distance distance = 2 ** @move_speed # If logical coordinates are further down than real coordinates if @y * 128 > @real_y # Move down @real_y = [@real_y + distance, @y * 128].min end # If logical coordinates are more to the left than real coordinates if @x * 128 < @real_x # Move left @real_x = [@real_x - distance, @x * 128].max @real_x = [@real_x - distance, @x * 128].max end # If logical coordinates are more to the right than real coordinates if @x * 128 > @real_x # Move right @real_x = [@real_x + distance, @x * 128].min @real_x = [@real_x + distance, @x * 128].min end # If logical coordinates are further up than real coordinates if @y * 128 < @real_y # Move up @real_y = [@real_y - distance, @y * 128].max end # If move animation is ON if @walk_anime # Increase animation count by 1.5 @anime_count += 6 # If move animation is OFF, and stop animation is ON elsif @step_anime # Increase animation count by 1 @anime_count += 1 end end #-------------------------------------------------------------------------- # * Move Lower Left #-------------------------------------------------------------------------- def move_lower_left # If no direction fix unless @direction_fix # Face down is facing right or up @direction = 1 end # When a down to left or a left to down course is passable if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4) and passable?(@x - 2, @y + 1, 1)) or (passable?(@x, @y, 4) and passable?(@x - 2, @y, 2) and passable?(@x - 2, @y + 1, 1)) # Update coordinates @x -= 2 @y += 1 # Increase steps increase_steps end end #-------------------------------------------------------------------------- # * Move Lower Right #-------------------------------------------------------------------------- def move_lower_right # If no direction fix unless @direction_fix # Face right if facing left, and face down if facing up @direction = 3 end # When a down to right or a right to down course is passable if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6) and passable?(@x + 2, @y + 1, 1)) or (passable?(@x, @y, 6) and passable?(@x + 2, @y, 2) and passable?(@x + 2, @y + 1, 1)) # Update coordinates @x += 2 @y += 1 # Increase steps increase_steps end end #-------------------------------------------------------------------------- # * Move Upper Left #-------------------------------------------------------------------------- def move_upper_left # If no direction fix unless @direction_fix # Face left if facing right, and face up if facing down @direction = 7 end # When an up to left or a left to up course is passable if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4) and passable?(@x - 2, @y - 1, 1)) or (passable?(@x, @y, 4) and passable?(@x - 2, @y, 8) and passable?(@x - 2, @y - 1, 1)) # Update coordinates @x -= 2 @y -= 1 # Increase steps increase_steps end end #-------------------------------------------------------------------------- # * Move Upper Right #-------------------------------------------------------------------------- def move_upper_right # If no direction fix unless @direction_fix # Face right if facing left, and face up if facing down @direction = 9 end # When an up to right or a right to up course is passable if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6) and passable?(@x + 2, @y - 1, 1)) or (passable?(@x, @y, 6) and passable?(@x + 2, @y, 8) and passable?(@x + 2, @y - 1, 1)) # Update coordinates @x += 2 @y -= 1 # Increase steps increase_steps end end end
class Game_Player < Game_Character #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Remember whether or not moving in local variables last_moving = moving? # If moving, event running, move route forcing, and message window # display are all not occurring unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing # Move player in the direction the directional button is being pressed case Input.dir8 when 1 move_lower_left when 2 move_down when 3 move_lower_right when 4 move_left when 6 move_right when 7 move_upper_left when 8 move_up when 9 move_upper_right end end # Remember coordinates in local variables last_real_x = @real_x last_real_y = @real_y super # If character moves down and is positioned lower than the center # of the screen if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y # Scroll map down $game_map.scroll_down(@real_y - last_real_y) end # If character moves left and is positioned more let on-screen than # center if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X # Scroll map left $game_map.scroll_left(last_real_x - @real_x) end # If character moves right and is positioned more right on-screen than # center if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X # Scroll map right $game_map.scroll_right(@real_x - last_real_x) end # If character moves up and is positioned higher than the center # of the screen if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y # Scroll map up $game_map.scroll_up(last_real_y - @real_y) end # If not moving unless moving? # If player was moving last time if last_moving # Event determinant is via touch of same position event result = check_event_trigger_here([1,2]) # If event which started does not exist if result == false # Disregard if debug mode is ON and ctrl key was pressed unless $DEBUG and Input.press?(Input::CTRL) # Encounter countdown if @encounter_count > 0 @encounter_count -= 1 end end end end # If C button was pressed if Input.trigger?(Input::C) # Same position and front event determinant check_event_trigger_here([0]) check_event_trigger_there([0,1,2]) end end end end
class Sprite_Character < RPG::Sprite #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super # If tile ID, file name, or hue are different from current ones if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue # Remember tile ID, file name, and hue @tile_id = @character.tile_id @character_name = @character.character_name @character_hue = @character.character_hue # If tile ID value is valid 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 = 32 self.oy = 64 # If tile ID value is invalid else self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) @cw = bitmap.width / 9 @ch = bitmap.height / 8 self.ox = @cw / 2 self.oy = @ch end end # Set visible situation self.visible = (not @character.transparent) # If graphic is character if @tile_id == 0 # Set rectangular transfer sx = @character.pattern * @cw dec = (@character.direction == 7 or @character.direction == 9) ? 3 : 1 sy = (@character.direction - dec) * @ch self.src_rect.set(sx, sy, @cw, @ch) end # Set sprite coordinates self.x = @character.screen_x self.y = @character.screen_y self.z = @character.screen_z(@ch) # Set opacity level, blend method, and bush depth self.opacity = @character.opacity self.blend_type = @character.blend_type self.bush_depth = @character.bush_depth # Animation if @character.animation_id != 0 animation = $data_animations[@character.animation_id] animation(animation, true) @character.animation_id = 0 end end end
Auteur: Je ne sais pas mais il n'est pas de moi. Utilisation:- Code: Tout sélectionner
@cw = bitmap.width / 9 @ch = bitmap.height / 8
Ceci est à modifier car c'est pour mes charsets à moi. -La première ligne est le nombre de frames dans l'animation du déplacement du héros. Ceux des RTP en utilise 4 donc il faut remplacer le "9" par le chiffre "4" etc... -La deuxième ligne représente le nombre de directions donc le 8 n'est pas changer. Voila. En ce qui concerne un screen, un screen ne pourra te montrer quoi que se soit car c'est en déplaçant ton héros que tu y verras la différence et comme une image est censé être fixe... Bref... J'espère vous avoir été utile.
|
|