Prodig - Komunitas Proyek Digital
Selamat datang di ProDig!
Di sini adalah tempat untuk berbagi proyek (game, seni, program, dan situs).
Di sini Anda juga bisa mendapatkan hal lainnya seperti permainan, berbagi karya, ilmu pengetahuan, kesenangan, dan sebagainya. :)

Ayo daftar lalu langsung login tanpa perlu konfirmasi email sama sekali :D!
Prodig - Komunitas Proyek Digital
Selamat datang di ProDig!
Di sini adalah tempat untuk berbagi proyek (game, seni, program, dan situs).
Di sini Anda juga bisa mendapatkan hal lainnya seperti permainan, berbagi karya, ilmu pengetahuan, kesenangan, dan sebagainya. :)

Ayo daftar lalu langsung login tanpa perlu konfirmasi email sama sekali :D!
Prodig - Komunitas Proyek Digital
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Prodig - Komunitas Proyek Digital

Tempat untuk berbagi proyek digital : Situs, Game, Seni, Program
 
PortalHomeRulesSearchLatest imagesRegisterLog in
Welcome to the ProDig, Guest!

 [RGSS1/2] Listra Smooth Scroller Module Resize
 

 [RGSS1/2] Listra Smooth Scroller Module

View previous topic View next topic Go down 
AuthorMessage
Alissa
Ngacay Princess
Alissa

Status : Ngacay :v
Posts : 424
Chips : 6843
Power : 14
Join date : 2010-09-22
Location : Antara ada dan tiada :-
Badge : [RGSS1/2] Listra Smooth Scroller Module Visual13 [RGSS1/2] Listra Smooth Scroller Module Ntitle10[RGSS1/2] Listra Smooth Scroller Module Visualart20112

[RGSS1/2] Listra Smooth Scroller Module _
PostSubject: [RGSS1/2] Listra Smooth Scroller Module   
[RGSS1/2] Listra Smooth Scroller Module Icon_minitimeMon Dec 27, 2010 9:22 pm


Listra Smooth Scroller Module
Version 1.0
Type: Map Scroll

Listra Smooth Scroller Module (LSSM) membuat scroll pada map menjadi smooth, seperti pada game ojekku: Zhan Chang, yang juga pake scroll yang smooth.

Inilah codingan scriptnya... :lkabur:
RGSS:
Code:
#==============================================================================
# Listra Smooth Scroller Module by Bunga Tepi Jalan
# for RPG Maker XP
# Version 1.0
#==============================================================================
# Copyrighted by Bunga Tepi Jalan.
#  * Don't forget to credit me if you want to use this work
#  * You are free to Share - to copy, distribute and transmit the work
#  * You are free to Remix - to adapt the work
#  * You may not use this work for commercial purposes
#
#==============================================================================
# Information:
#  This script makes map scroll smoother.
#
# If you find any bugs or you have any suggestions, please report them via
# e-mail (listra92@gmail.com), or either my blog or these forums:
#  - http://bungatepijalan.wordpress.com
#  - http://www.rpgmakerid.com
#  - http://prodig.forumotion.net
#  - http://vixep.forumotion.com
#==============================================================================

module LSSM
  #--------------------------------------------------------------------------
  # * Listra Smooth Scroller Module Configuration
  #--------------------------------------------------------------------------
 
  # Config 1 -- Smooth scroll factor, higher value makes scroll slower
  SMOOTH = 16.0
  # Config 2 -- Custom horizontal & vertical map scroll border,
  #            don't exceed CENTER_X and CENTER_Y
  HBOR = 320 * 4
  VBOR = 240 * 4
  # Config 3 -- Use HBOR & VBOR?
  USECUSTOMBOR = false
end

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles the player. Its functions include event starting
#  determinants and map scrolling. Refer to "$game_player" for the one
#  instance of this class.
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Invariables (changed)
  #--------------------------------------------------------------------------
  CENTER_X = 320 * 4  # Center screen x-coordinate * 4
  CENTER_Y = 240 * 4  # Center screen y-coordinate * 4
  #--------------------------------------------------------------------------
  # * 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.dir4
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      end
    end
    # Remember coordinates in local variables
    last_real_x = @real_x
    last_real_y = @real_y
    super
    # Player position as the real target coordinate (times 4)
    # Disable this if you want to use another position at certain event
    target_x = @real_x
    target_y = @real_y
    # Horizontal & vertical scroll border
    if LSSM::USECUSTOMBOR
      hbor = LSSM::HBOR
      vbor = LSSM::VBOR
    else
      hbor = CENTER_X
      vbor = CENTER_Y
    end
    # If character is positioned lower than the center of the screen
    if target_y - $game_map.display_y > 15*128 - vbor
      # Scroll map down
      if target_y > $game_map.height*128 - vbor
        $game_map.scroll_down((($game_map.height - 15)*128 - $game_map.display_y)/LSSM::SMOOTH)
      else
        $game_map.scroll_down((target_y - $game_map.display_y - 15*128 + vbor)/LSSM::SMOOTH)
      end
    end
    # If character is positioned more left on-screen than center
    if target_x - $game_map.display_x < hbor
      # Scroll map left
      if target_x < hbor
        $game_map.scroll_left($game_map.display_x/LSSM::SMOOTH)
      else
        $game_map.scroll_left(($game_map.display_x + hbor - target_x)/LSSM::SMOOTH)
      end
    end
    # If character is positioned more right on-screen than center
    if target_x - $game_map.display_x > 20*128 - hbor
      # Scroll map right
      if target_x > $game_map.width*128 - hbor
        $game_map.scroll_right((($game_map.width - 20)*128 - $game_map.display_x)/LSSM::SMOOTH)
      else
        $game_map.scroll_right((target_x - $game_map.display_x - 20*128 + hbor)/LSSM::SMOOTH)
      end
    end
    # If character is positioned higher than the center of the screen
    if target_y - $game_map.display_y < vbor
      # Scroll map up
      if target_y < vbor
        $game_map.scroll_up($game_map.display_y/LSSM::SMOOTH)
      else
        $game_map.scroll_up(($game_map.display_y + vbor - target_y)/LSSM::SMOOTH)
      end
    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

RGSS2:
Code:
#==============================================================================
# Listra Smooth Scroller Module by Bunga Tepi Jalan
# for RPG Maker VX
# Version 1.0
#==============================================================================
# Copyrighted by Bunga Tepi Jalan.
#  * Don't forget to credit me if you want to use this work
#  * You are free to Share - to copy, distribute and transmit the work
#  * You are free to Remix - to adapt the work
#  * You may not use this work for commercial purposes
#
#==============================================================================
# Information:
#  This script makes map scroll smoother.
#
# If you find any bugs or you have any suggestions, please report them via
# e-mail (listra92@gmail.com), or either my blog or these forums:
#  - http://bungatepijalan.wordpress.com
#  - http://rpgmakerid.com
#  - http://prodig.forumotion.net
#  - http://vixep.forumotion.com
#==============================================================================

module LSSM
  #--------------------------------------------------------------------------
  # * Listra Smooth Scroller Module Configuration
  #--------------------------------------------------------------------------
 
  # Config 1 -- Smooth scroll factor, higher value makes scroll slower
  SMOOTH = 16.0
  # Config 2 -- Custom horizontal & vertical map scroll border,
  #            don't exceed CENTER_X and CENTER_Y
  HBOR = 544/2 * 8
  VBOR = 416/2 * 8
  # Config 3 -- Use HBOR & VBOR?
  USECUSTOMBOR = false
end

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------
  CENTER_X = 544/2 * 8    # Screen center X coordinate * 8
  CENTER_Y = 416/2 * 8    # Screen center Y coordinate * 8
  #--------------------------------------------------------------------------
  # * Update Scroll
  #--------------------------------------------------------------------------
  def update_scroll(last_real_x, last_real_y)
    ax1 = 0
    ay1 = 0
    # Player position as the real target coordinate
    # Modify this if you want to use another position at certain event
    ax2 = $game_map.adjust_x(@real_x)
    ay2 = $game_map.adjust_y(@real_y)
    # Disable this if you want to use another position at certain event
    target_x = @real_x
    target_y = @real_y
    # Horizontal & vertical scroll border
    if LSSM::USECUSTOMBOR
      hbor = LSSM::HBOR
      vbor = LSSM::VBOR
    else
      hbor = CENTER_X
      vbor = CENTER_Y
    end
    if ay2 > 13*256 - vbor
      if target_y > $game_map.height*256 - vbor
        $game_map.scroll_down((($game_map.height - 13)*256 - $game_map.display_y)/LSSM::SMOOTH)
      else
        $game_map.scroll_down((ay2 - ay1 - 13*256 + vbor)/LSSM::SMOOTH)
      end
    end
    if ax2 < hbor
      if target_x < hbor
        $game_map.scroll_left($game_map.display_x/LSSM::SMOOTH)
      else
        $game_map.scroll_left((ax1 - ax2 + hbor)/LSSM::SMOOTH)
      end
    end
    if ax2 > 17*256 - hbor
      if target_x > $game_map.width*256 - hbor
        $game_map.scroll_right((($game_map.width - 17)*256 - $game_map.display_x)/LSSM::SMOOTH)
      else
        $game_map.scroll_right((ax2 - ax1 - 17*256 + hbor)/LSSM::SMOOTH)
      end
    end
    if ay2 < vbor
      if target_y < vbor
        $game_map.scroll_up($game_map.display_y/LSSM::SMOOTH)
      else
        $game_map.scroll_up((ay1 - ay2 + vbor)/LSSM::SMOOTH)
      end
    end
  end
end

Cara Pemasangan?
Buat slot script baru di atas Main pada Script Editor, lalu copas script LSSM di situ.

NB: Jangan lupa kredit saya yah kalo mau menggunakan ini.. ;)
Sorry, no screenshots and demo :lkabur:



Back to top Go down
https://bungatepijalan.wordpress.com
 

[RGSS1/2] Listra Smooth Scroller Module

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Prodig - Komunitas Proyek Digital  :: Education Chamber :: Programming :: RGSS-
Jump to: