[Script] [ACE] [Map] Lune Smooth Camera Slide

sanggameboysanggameboy Posts: 1,943Registered
[align=center][size=x-large]Lune Smooth Camera Slide[/size][/align]

[chapter]Giới thiệu[/chapter]
Script này làm cho Camera game di chuyển mượt mà hơn, giống thật hơn. Có thể xem video để hiểu rõ hơn. Một script rất hay :)

[chapter]Video[/chapter]

[chapter]Script[/chapter]
#=======================================================
#         Lune Smooth Camera Sliding
# Author: Raizen
# Comunity: www.centrorpg.com
# The scripts allow a much smoother movement, making the move much more realistic.
#=======================================================
module Lune_cam_slide
# Constant of the slide, the greater the faster, the lower the slower..(default = 0.001)
Slide = 0.001
end

#=====================Here Starts the script========================#

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  Esta classe gerencia o jogador. 
# A instância desta classe é referenciada por $game_player.
#==============================================================================

class Game_Player < Game_Character
alias lune_scroll update_scroll
  #--------------------------------------------------------------------------
  # * Atualização da rolagem
  #     last_real_x : ultima coordenada X real
  #     last_real_y : ultima coordenada Y real
  #--------------------------------------------------------------------------
  def update_scroll(last_real_x, last_real_y)
    if $game_map.scrolling?
      @no_scroll = true
      lune_scroll(last_real_x, last_real_y)
      return
    end
    @no_scroll = false if moving?
    unless @no_scroll
      ax1 = $game_map.adjust_x(last_real_x)
      ay1 = $game_map.adjust_y(last_real_y)
      ax2 = $game_map.adjust_x(@real_x)
      ay2 = $game_map.adjust_y(@real_y)
      sc_x = (screen_x - Graphics.width/2).abs
      sc_y = (screen_y - 10 - Graphics.height/2).abs
      $game_map.scroll_down (Lune_cam_slide::Slide*sc_y) if screen_y - 10 > Graphics.height/2
      $game_map.scroll_left(Lune_cam_slide::Slide*sc_x) if screen_x < Graphics.width/2
      $game_map.scroll_right(Lune_cam_slide::Slide*sc_x) if screen_x > Graphics.width/2
      $game_map.scroll_up(Lune_cam_slide::Slide*sc_y) if screen_y - 10 < Graphics.height/2
    end
  end
end

[chapter]Credit[/chapter]
Raizen (tác giả)

Comments

Sign In or Register to comment.