Lune Smooth Camera Slide

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Raizen, Mar 16, 2013.

    Tags:
  1. Raizen

    Raizen Veteran Veteran

    Messages:
    198
    Likes Received:
    205
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    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

    #=======================================================#         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
     
    Last edited by a moderator: Apr 11, 2015
    #1
  2. Ocedic

    Ocedic Dog Veteran

    Messages:
    395
    Likes Received:
    67
    Location:
    Seattle
    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.)
     
    Last edited by a moderator: Mar 16, 2013
    #2
  3. Raizen

    Raizen Veteran Veteran

    Messages:
    198
    Likes Received:
    205
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    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
     
    #3
  4. Rik Vargard

    Rik Vargard Villager Member

    Messages:
    86
    Likes Received:
    3
    Location:
    Brussels, BELGIUM
    First Language:
    French
    Awesome! Thank you for that!

    :)  Rik
     
    #4
  5. BILL_NYE_THO

    BILL_NYE_THO The Science Guy Veteran

    Messages:
    361
    Likes Received:
    21
    First Language:
    English
    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?
     
    #5
  6. Raizen

    Raizen Veteran Veteran

    Messages:
    198
    Likes Received:
    205
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    # 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 :)
     
    #6
    ShinGamix likes this.
  7. BILL_NYE_THO

    BILL_NYE_THO The Science Guy Veteran

    Messages:
    361
    Likes Received:
    21
    First Language:
    English
    Thanks for the help!
     
    #7
  8. Maky-chan

    Maky-chan Stoner Rock fan, Doom Metal listener. Member

    Messages:
    19
    Likes Received:
    0
    Location:
    Spain, Catalonia, Barcelona
    First Language:
    Spanish
    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 ^_^
     
    #8
  9. Raizen

    Raizen Veteran Veteran

    Messages:
    198
    Likes Received:
    205
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    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/
     
    Last edited by a moderator: Mar 20, 2013
    #9
  10. Maky-chan

    Maky-chan Stoner Rock fan, Doom Metal listener. Member

    Messages:
    19
    Likes Received:
    0
    Location:
    Spain, Catalonia, Barcelona
    First Language:
    Spanish
    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. :<
     
    #10
  11. Nosleinad

    Nosleinad Storyteller Veteran

    Messages:
    351
    Likes Received:
    28
    Location:
    Brazil
    First Language:
    Portuguese
    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.
     
    #11
  12. Raizen

    Raizen Veteran Veteran

    Messages:
    198
    Likes Received:
    205
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    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.
     
    #12
    Rik Vargard and seita like this.
  13. seita

    seita Donn_M Veteran

    Messages:
    2,255
    Likes Received:
    611
    Location:
    California
    First Language:
    English
    Thanks for your hard work Raizen!
     
    #13
  14. Rik Vargard

    Rik Vargard Villager Member

    Messages:
    86
    Likes Received:
    3
    Location:
    Brussels, BELGIUM
    First Language:
    French
    Cheers to you for taking your time for this, really!

    :) Rik
     
    #14
  15. seita

    seita Donn_M Veteran

    Messages:
    2,255
    Likes Received:
    611
    Location:
    California
    First Language:
    English
    Was wondering if there has been any progress on the rewrite?
     
    #15
  16. Raizen

    Raizen Veteran Veteran

    Messages:
    198
    Likes Received:
    205
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    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
     
    #16
    seita likes this.
  17. seita

    seita Donn_M Veteran

    Messages:
    2,255
    Likes Received:
    611
    Location:
    California
    First Language:
    English
    Hey Raizen, hope you're still around! I'd love to see this script completed~
     
    #17
  18. ken713

    ken713 Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    English
    This script is awesome! However you think you could make it possible to enable/disable this when entering a airship?
     
    #18
  19. RadiantCadenza

    RadiantCadenza Veteran Veteran

    Messages:
    99
    Likes Received:
    62
    First Language:
    English
    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. 
     
    #19
  20. Raizen

    Raizen Veteran Veteran

    Messages:
    198
    Likes Received:
    205
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    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.
     
    #20

Share This Page