Lune Smooth Camera Slide

● ARCHIVED · READ-ONLY
Started by Raizen 20 posts View original ↗
  1. Lune Smooth Camera Slide

    Introduction

    This script will add a much smoother camera slide, making more professional the game, and the move.

    Portuguese user? Link Here

    Videos





    How to Use

    Put it above main and configure the script as necessary

    Script

    Spoiler
    #=======================================================#         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 # To set the camera focus on an event instead of a player# Script Call: set_camera_focus(id)# where id is the id of the event, to put back the focus on the player,# id = 0 end   #==============================================================================# ** Game_Player#------------------------------------------------------------------------------#  Esta classe gerencia o jogador. # A instância desta classe é referenciada por $game_player.#============================================================================== class Game_Player < Game_Characteralias :lune_camera_slide_initialize :initialize  #--------------------------------------------------------------------------  # * Inicialização do objeto  #--------------------------------------------------------------------------  def initialize(*args)    @camera_slide_focus = 0    lune_camera_slide_initialize(*args)  end  #--------------------------------------------------------------------------  # * 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)    return if $game_map.scrolling?    if @camera_slide_focus == 0      screen_focus_x = screen_x      screen_focus_y = screen_y    else      screen_focus_x = $game_map.events[@camera_slide_focus].screen_x      screen_focus_y = $game_map.events[@camera_slide_focus].screen_y    end    sc_x = (screen_focus_x - Graphics.width/2).abs    sc_y = (screen_focus_y - 16 - Graphics.height/2).abs    $game_map.scroll_down(Lune_cam_slide::Slide*sc_y) if screen_focus_y - 16 > Graphics.height/2    $game_map.scroll_left(Lune_cam_slide::Slide*sc_x) if screen_focus_x < Graphics.width/2    $game_map.scroll_right(Lune_cam_slide::Slide*sc_x) if screen_focus_x > Graphics.width/2    $game_map.scroll_up(Lune_cam_slide::Slide*sc_y) if screen_focus_y - 16 < Graphics.height/2  end  def set_camera_focus(event = 0)    @camera_slide_focus = event  endend  #==============================================================================# ** Spriteset_Map#------------------------------------------------------------------------------#  Esta classe reune os sprites da tela de mapa e tilesets. Esta classe é# usada internamente pela classe Scene_Map. #============================================================================== class Spriteset_Map    #--------------------------------------------------------------------------  # * Atualização do tilemap  #--------------------------------------------------------------------------  def update_tilemap    @tilemap.map_data = $game_map.data    @tilemap.ox = ($game_map.display_x * 32)    @tilemap.oy = ($game_map.display_y * 32)    @tilemap.ox += 1 if $game_map.adjust_tile_slide_x    @tilemap.oy += 1 if $game_map.adjust_tile_slide_y    @tilemap.update  endend#==============================================================================# ** Game_Map#------------------------------------------------------------------------------#  Esta classe gerencia o mapa. Inclui funções de rolagem e definição de # passagens. A instância desta classe é referenciada por $game_map.#============================================================================== class Game_Map  #--------------------------------------------------------------------------  # * Variáveis públicas  #--------------------------------------------------------------------------  def adjust_tile_slide_x    @display_x != 0 && @display_x != (@map.width - screen_tile_x) && !scrolling?  end  def adjust_tile_slide_y    @display_y != 0 && @display_y != (@map.height - screen_tile_y) && !scrolling?  endend#==============================================================================# ** Game_Interpreter#------------------------------------------------------------------------------#  Um interpretador para executar os comandos de evento. Esta classe é usada# internamente pelas classes Game_Map, Game_Troop e Game_Event.#============================================================================== class Game_Interpreter  def set_camera_focus(event = 0)    $game_player.set_camera_focus(event)  endend 





    FAQ

    Why my character is not showing on the screen?

    Don't use values way lower then 0.001, or way higher, the lower the cam moves slower, so to catch up is really hard.

    Credit and Thanks

    - Raizen
  2. Intriguing script. Just FYI you forgot to change the header in your topic from Anti-Lag to Smooth Camera Slide.

    EDIT: I tried it out and it works great for moving around, but camera panning seems to be bugged (when you use move camera over x spaces.)
  3. Ocedic said:
    Intriguing script. Just FYI you forgot to change the header in your topic from Anti-Lag to Smooth Camera Slide.


    EDIT: I tried it out and it works great for moving around, but camera panning seems to be bugged (when you use move camera over x spaces.)
    Oops u_u, I partially corrected that now, I'll try to think something better to do about the events camera latter, thanks for both notices :D
  4. Awesome! Thank you for that!

    :)  Rik
  5. I looked at the script and it wasn't immediately clear to me if this is possible, so I figured I would ask: Can you adjust the speed that the "camera" follows the player?
  6. BILL_NYE_THO said:
    I looked at the script and it wasn't immediately clear to me if this is possible, so I figured I would ask: Can you adjust the speed that the "camera" follows the player?
    # Constant of the slide, the greater the faster, the lower the slower..(default = 0.001) Slide = 0.001 end
    On the script xD, so, 0.002 would make the cam move 2x faster then in the vídeo, 0.0005 would make the cam move 2x slower, its a decimal number so basically you can try a lot of numbers until you find one that satisfies you :)
  7. Thanks for the help!
  8. When you use Show Animation in a map, the animation goes down a little, like It's moving.

    Anyways, nice script. Somehow better tha Wora's ^_^
  9. Maahkehro said:
    When you use Show Animation in a map, the animation goes down a little, like It's moving.

    Anyways, nice script. Somehow better tha Wora's ^_^
    Probably because of the "animation bug", which really isn't a bug xD, but if you use a script that makes the animation fixed on the map, I haven't test it, but I'm almost sure it will correct that problem, and also would make the animations way better, since its much more logical that the animations follow the map and not the screen, as you can see here.

    Woratana has that fix I think, but I didn't find it here, but if you look well, you surely will find ^^

    http://forums.rpgmakerweb.com/index.php?/topic/2863-ace-animation-moving-with-player-how-do-i-prevent-that/
  10. No, I mean, It moves alone, like a single event, doesn't matter if you move or not. The animation goes down on its own. :<
  11. I am getting the same small issue here, but in my case one of my animations (feet centered) is going a bit to the left. I also used some looped and screen animations, and they worked fine in the same map. 

    Raizen, please let me know if a video would help.
  12. That is all strange as I just changed 1 simple thing, I'm going to redo the script from 0, sorry for all the trouble to everyone =X, when I redo the script I post it here.
  13. Thanks for your hard work Raizen!
  14. Cheers to you for taking your time for this, really!

    :) Rik
  15. Was wondering if there has been any progress on the rewrite?
  16. Oh I'm really sorry .-., I actually had forgotten this script x_x, and no PC at the moment, I'll rewrite it as soon as I can, sorry for the time :X
  17. Hey Raizen, hope you're still around! I'd love to see this script completed~
  18. This script is awesome! However you think you could make it possible to enable/disable this when entering a airship?
  19. Sorry if this is a bit of a necro, but for future reference, I was wondering if it's okay to use this script in a commercial project?

    I can't seem to find a terms of use that says anything one way or another about commercial use. 

    I think this script makes things look a fair bit more professional than the default scrolling, so I'd like to be able to include it in pretty much all of my projects if I can, but if it's non-commercial than I'll just only stick it in the free ones. 
  20. yeah, you can, it has a small bug though if you use events for mapping, if not it probably should work ok >_>

    I need time and will to correct everything xD, but yeah you can.