Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Widescreen
Autor Wiadomość
Angius 

Nie wkurzać



Preferowany:
RPG Maker VX

Pomógł: 104 razy
Dołączył: 30 Paź 2010
Posty: 1276
Skąd: wROCK
Wysłany: Sro 29 Cze, 2011 20:03
Widescreen
WideScreen

Opis:
Ten skrypt pozwala nam uzyskać efekt szerokiego ekranu. Gwoli ścisłości zdjęcie :)
Spoiler:



Info:
Autor: Selwyn
Przełożył na VX: pupetto4
Tłumaczenie: Angius

Skrypt:
Spoiler:

Kod:
#==============================================================================
# ** WideScreen Effect
#------------------------------------------------------------------------------
# Autor  : Selwyn
# Wersia : 1.0
# Data    : 01 / 02 / 2007
# Ported to VX by puppeto4
#------------------------------------------------------------------------------
# Ten skrypt pozwala na cutscenki z efektem Widescreen
#
# Domyślnie (gdy zaczynasz grę) jest wyłączony.
#
# Domyślnie prędkość przejscia wynosi 90, możesz ją zmienić w konfiguracji
#        (@transition_speed)
#
# By włączyć tryb Widescreen wpisz w wywoływaniu skryptu w zdarzeniu
#                     WScreen.turn_on
# By wyłączyć użyj komendy
#                     WScreen.turn_off
#
# By zmienić ilość ukrywanych kratek, również w zdarzeniu wywołaj skrypt
#                     WScreen.size = ILOŚĆ
#
# Jeśli używasz skryptu na zmianę rozdzielczości, zmień wartość "@height" na wartość
#   jaką ma twoja rozdzielczość. Np. : 480, 600, 768 są używane w 640 X 480,
#   800 X 600, 1024 X 768.
#
#==============================================================================
module WScreen
  #--------------------------------------------------------------------------
  # * define instance variables
  #--------------------------------------------------------------------------
  @state = false
  #==========================================================================
  #==========================================================================
  #==========================================================================
  # **                    KONFIGURACJA
  #==========================================================================
  @tile_size = 2           # Ilość ukrywanych kratek gdy Widescreen jest włączony
  @transition_speed = 90   # Prędkość nachodzenia widescreenu
  @height = 416            # Wysokość okna gry. Domyślnie 416.
  #==========================================================================
  # **              KONIEC  KONFIGURACJI
  #==========================================================================
  #==========================================================================
  #==========================================================================
  #--------------------------------------------------------------------------
  # �� WScreen.on?
  #      checks if the widescreen mode is on.
  #--------------------------------------------------------------------------
  def self.on?
    return @state
  end
  #--------------------------------------------------------------------------
  # �� WScreen.off?
  #      checks if the widescreen mode is off.
  #--------------------------------------------------------------------------
  def self.off?
    return !@state
  end
  #--------------------------------------------------------------------------
  # �� WScreen.turn_on
  #      turns the widescreen mode on.
  #--------------------------------------------------------------------------
  def self.turn_on
    @state = true
    $game_player.center($game_player.x, $game_player.y)
  end
  #--------------------------------------------------------------------------
  # �� WScreen.turn_off
  #      turns the widescreen mode off.
  #--------------------------------------------------------------------------
  def self.turn_off
    @state = false
    $game_player.center($game_player.x, $game_player.y)
  end
  #--------------------------------------------------------------------------
  # �� WScreen.size
  #      returns the number of hidden tiles when the widescreen mode is on.
  #--------------------------------------------------------------------------
  def self.size
    return on? ? @tile_size : 0
  end
  #--------------------------------------------------------------------------
  # �� WScreen.size = INTEGER
  #      set the number of tiles to hide when the widescreen mode is on.
  #--------------------------------------------------------------------------
  def self.size=(value)
    @tile_size = [value % 9, 1].min
    $game_player.center($game_player.x, $game_player.y)
  end
  #--------------------------------------------------------------------------
  # �� WScreen.speed
  #      returns the transition speed between the off and on modes.
  #--------------------------------------------------------------------------
  def self.speed
    return @transition_speed
  end
  #--------------------------------------------------------------------------
  # �� WScreen.height
  #      returns the default height of the screen.
  #--------------------------------------------------------------------------
  def self.height
    return @height
  end 
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #-------------------------------------------------------------------------- 
  attr_accessor :display_x                # display X coordinate * 256
  attr_accessor :display_y                # display Y coordinate * 256
  #--------------------------------------------------------------------------
  # * Scroll Down
  #     distance : scroll distance
  #--------------------------------------------------------------------------
  def scroll_down(distance)
    ntiles = 15 - WScreen.size * 2
    @display_y = [@display_y + distance, (self.height - ntiles) * 256].min
  end
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
  #--------------------------------------------------------------------------
  # * center_y
  #--------------------------------------------------------------------------
  def center_y
    n = 208 - WScreen.size * 32
    return (n - 16) * 4
  end
  #--------------------------------------------------------------------------
  # * Set Map Display Position to Center of Screen
  #     x : x-coordinate
  #     y : y-coordinate
  #--------------------------------------------------------------------------
  def center(x, y)
    max_x = ($game_map.width - 20) * 256
    ntiles = 15 - WScreen.size * 2
    max_y = ($game_map.height - ntiles) * 256
    $game_map.display_x = [0, [x * 256 - CENTER_X, max_x].min].max
    $game_map.display_y = [0, [y * 256 - center_y, max_y].min].max
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    last_moving = moving?
    unless moving? or $game_map.interpreter.running? or
           @move_route_forcing or $game_message.visible
      case Input.dir4
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      end
    end
    last_real_x = @real_x
    last_real_y = @real_y
    super
    if @real_y > last_real_y and @real_y - $game_map.display_y > center_y
      $game_map.scroll_down(@real_y - last_real_y)
    end
    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
      $game_map.scroll_left(last_real_x - @real_x)
    end
    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
      $game_map.scroll_right(@real_x - last_real_x)
    end
    if @real_y < last_real_y and @real_y - $game_map.display_y < center_y
      $game_map.scroll_up(last_real_y - @real_y)
    end
    unless moving?
      if last_moving
        result = check_event_trigger_here([1,2])
        if result == false
          unless $DEBUG and Input.press?(Input::CTRL)
            if @encounter_count > 0
              @encounter_count -= 1
            end
          end
        end
      end
      if Input.trigger?(Input::C)
        check_event_trigger_here([0])
        check_event_trigger_there([0,1,2])
      end
    end
  end
end

#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc. It's used
# within the Scene_Map class.
#==============================================================================

class Spriteset_Map
  #--------------------------------------------------------------------------
  # Alias Listing
  #--------------------------------------------------------------------------
  alias init_widescreen initialize
  alias update_widescreen update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    init_widescreen
    if @viewport1.rect.height > WScreen.height - (WScreen.size * 64)
      @viewport1.rect.height = @viewport2.rect.height =
        @viewport3.rect.height = WScreen.height - (WScreen.size * 64)
      oy = (WScreen.height - @viewport1.rect.height) / 2
      @viewport1.rect.y = @viewport2.rect.y = @viewport3.rect.y = oy
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    sy = WScreen.height - (WScreen.size * 64)
    h = @viewport1.rect.height
    if h != sy
      n = [((sy - h) / WScreen.speed).abs, 1].max
      @viewport1.rect.height += h > sy ? - n : n
      @viewport2.rect.height += h > sy ? - n : n
      @viewport3.rect.height += h > sy ? - n : n
      oy = (WScreen.height - @viewport1.rect.height) / 2
      @viewport1.rect.y = @viewport2.rect.y = @viewport3.rect.y = oy
    end
    update_widescreen
  end
end



Znany bug:
Ucina po pasku szerokości jednej kratki z każdej strony. Jak macie tam przejście, to gracz zniknie wam poza oknem gry :-/
________________________
"Na trolla pewne są tylko dwie pewne metody, jedna samopowtarzalna i druga, wymagająca przeładowania ręcznego."


 
 
Wyświetl posty z ostatnich:   
Odpowiedz do tematu
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene