Ogłoszenie 

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


Administracja Forum


Poprzedni temat «» Następny temat
Zamknięty przez: Ayene
Nie 16 Paź, 2011 11:27
Ehh... Kursor
Autor Wiadomość
Poster27 




Preferowany:
RPG Maker VX

Pomógł: 22 razy
Dołączył: 27 Kwi 2010
Posty: 136
Skąd: że znowu
Wysłany: Sro 12 Paź, 2011 21:27
Ehh... Kursor
Witam. A więc mam taki skrypt:
Spoiler:

Kod:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/    ◆         Animated Menu Cursor - KGC_CursorAnimation        ◆ VX ◆
#_/    ◇                  Last Update: 2008/04/01                       ◇
#_/    ◆               Translation by Mr. Anonymous                     ◆
#_/-----------------------------------------------------------------------------
#_/  Installation: Insert this script above main.
#_/=============================================================================
#_/  This script allows you to display an animated cursor on selectable menu
#_/   items.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

#==============================================================================#
#                            ★ Customization ★                                 #
#==============================================================================#

module KGC
 module CursorAnimation
  #                          ◆ Cursor Switch ◆
  #  You may specify the in-game switch that enables/disables the cursor.
  SWITCH_ID = 20
  #                      ◆ Cursor Start Display ◆
  #  true  : Cursor is persistant (from the title screen onwards)
  #  false : Cursor is only displayed when a switch is turned on (SWITCH_ID)
  DEFAULT_ANIMATION = true

  #                   ◆ Cursor Animation Image File ◆
  #  This defines the cursor file located in "Graphics/System".
  ANIMATION_FILE = "CursorAnimation"
  #                   ◆ Cursor Animation Frame Count ◆
  #  This defines the amount of cells the animation uses from the cursor file.
  FRAME_COUNT    = 12
  #                    ◆ Cursor Animation Wait Time ◆
  #  This defines the amount of frames between switching animation cells.
  #   Larger number = slower animation
  #   Smaller number = faster animation
  ANIMATION_WAIT = 3

  #                         ◆ Cursor Opacity ◆
  #  Opacity/Translucency (Max = 255)
  OPACITY       = 224
  #                    ◆ Cursor Animation Blending ◆
  #  Blending Type
  #   0. Normal  1. Add  2. Subtract
  BLEND_TYPE    = 1
  #                  ◆ Base Cursor Selection Position ◆
  #  0..On  1..Center  2..Under
  BASE_POSITION = 1
  #                     ◆ Cursor Alightment [x, y] ◆
  #  This defines the position of the cursor.
  POSITION_REV  = [-4, 0]
 end
end

#------------------------------------------------------------------------------#

$imported = {} if $imported == nil
$imported["CursorAnimation"] = true

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  #     &#12463;&#12521;&#12473;&#22793;&#25968;
  #--------------------------------------------------------------------------
  @@__cursor_animation = nil  # &#12459;&#12540;&#12477;&#12523;&#12450;&#12491;&#12513;
  #--------------------------------------------------------------------------
  # &#9679; &#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#21021;&#26399;&#21270;
  #     x       : &#12454;&#12451;&#12531;&#12489;&#12454;&#12398; X &#24231;&#27161;
  #     y       : &#12454;&#12451;&#12531;&#12489;&#12454;&#12398; Y &#24231;&#27161;
  #     width   : &#12454;&#12451;&#12531;&#12489;&#12454;&#12398;&#24133;
  #     height  : &#12454;&#12451;&#12531;&#12489;&#12454;&#12398;&#39640;&#12373;
  #--------------------------------------------------------------------------
  alias initialize_KGC_CursorAnimation initialize
  def initialize(x, y, width, height)
    initialize_KGC_CursorAnimation(x, y, width, height)

    @@__cursor_animation.add_window(self)
  end
  #--------------------------------------------------------------------------
  # &#9679; &#35299;&#25918;
  #--------------------------------------------------------------------------
  alias dispose_KGC_CursorAnimation dispose unless $@
  def dispose
    @@__cursor_animation.remove_window(self)

    dispose_KGC_CursorAnimation
  end
  #--------------------------------------------------------------------------
  #     &#12459;&#12540;&#12477;&#12523;&#12450;&#12491;&#12513;&#12434;&#34920;&#31034;
  #--------------------------------------------------------------------------
  def self.show_cursor_animation
    @@__cursor_animation.visible = true
    @@__cursor_animation.update
  end
  #--------------------------------------------------------------------------
  #     &#12459;&#12540;&#12477;&#12523;&#12450;&#12491;&#12513;&#12434;&#38560;&#12377;
  #--------------------------------------------------------------------------
  def self.hide_cursor_animation
    @@__cursor_animation.visible = false
    @@__cursor_animation.update
  end
  #--------------------------------------------------------------------------
  #     &#12459;&#12540;&#12477;&#12523;&#12450;&#12491;&#12513;&#12434;&#26356;&#26032;
  #--------------------------------------------------------------------------
  def self.update_cursor_animation
    @@__cursor_animation.update
  end
end

#==================================End Class===================================#

#==============================================================================
# &#9633; Sprite_CursorAnimation
#------------------------------------------------------------------------------
# &#12288;&#12459;&#12540;&#12477;&#12523;&#12450;&#12491;&#12513;&#12540;&#12471;&#12519;&#12531;&#29992;&#12398;&#20966;&#29702;&#12434;&#36861;&#21152;&#12375;&#12383;&#12473;&#12503;&#12521;&#12452;&#12488;&#12398;&#12463;&#12521;&#12473;&#12391;&#12377;&#12290;
#==============================================================================

class Sprite_CursorAnimation < Sprite
  #--------------------------------------------------------------------------
  # &#9679; &#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#21021;&#26399;&#21270;
  #     viewport : &#12499;&#12517;&#12540;&#12509;&#12540;&#12488;
  #--------------------------------------------------------------------------
  def initialize(viewport = nil)
    super(viewport)
    @duration = 0
    @frame_count = 0
    self.bitmap = Cache.system(KGC::CursorAnimation::ANIMATION_FILE)
    self.src_rect.width = bitmap.width / 8
    self.src_rect.height = bitmap.height /
      ([KGC::CursorAnimation::FRAME_COUNT - 1, 0].max / 8 + 1)
    self.ox = src_rect.width / 2
    self.oy = src_rect.height / 2
    self.opacity = KGC::CursorAnimation::OPACITY
    self.blend_type = KGC::CursorAnimation::BLEND_TYPE
  end
  #--------------------------------------------------------------------------
  # &#9679; &#12501;&#12524;&#12540;&#12512;&#26356;&#26032;
  #--------------------------------------------------------------------------
  def update
    super
    return unless visible

    @frame_count += 1
    return if @frame_count % KGC::CursorAnimation::ANIMATION_WAIT != 0

    @frame_count = 0
    @duration -= 1
    if @duration < 0
      @duration = KGC::CursorAnimation::FRAME_COUNT - 1
    end
    update_animation
  end
  #--------------------------------------------------------------------------
  #     &#12450;&#12491;&#12513;&#12540;&#12471;&#12519;&#12531;&#12434;&#26356;&#26032;
  #--------------------------------------------------------------------------
  def update_animation
    self.src_rect.x = src_rect.width * (@duration % 8)
    self.src_rect.y = src_rect.height * (@duration / 8)
  end
end

#==================================End Class===================================#

#==============================================================================
# &#9633; Cursor_Animation
#------------------------------------------------------------------------------
# &#12288;&#12459;&#12540;&#12477;&#12523;&#21608;&#12426;&#12398;&#12450;&#12491;&#12513;&#12540;&#12471;&#12519;&#12531;&#12434;&#25201;&#12358;&#12463;&#12521;&#12473;&#12391;&#12377;&#12290;
#==============================================================================

class Cursor_Animation
  #--------------------------------------------------------------------------
  #     &#20844;&#38283;&#12452;&#12531;&#12473;&#12479;&#12531;&#12473;&#22793;&#25968;
  #--------------------------------------------------------------------------
  attr_accessor :visible
  #--------------------------------------------------------------------------
  #     &#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#21021;&#26399;&#21270;
  #--------------------------------------------------------------------------
  def initialize
    @visible = false

    @viewport = Viewport.new(0, 0, 640, 480)
    @windows = []
    @target_sprite = Sprite_CursorAnimation.new(@viewport)
    @active_window = nil

    @viewport.visible = false
    @viewport.z = 10000
  end
  #--------------------------------------------------------------------------
  #     &#30772;&#26820;
  #--------------------------------------------------------------------------
  def dispose
    @target_sprite.dispose
    @viewport.dispose
  end
  #--------------------------------------------------------------------------
  #     &#12454;&#12451;&#12531;&#12489;&#12454;&#36861;&#21152;
  #--------------------------------------------------------------------------
  def add_window(*window)
    @windows |= window.find_all { |w|
      w.is_a?(Window_Selectable) || w.is_a?(Window_SaveFile)
    }
    @windows.flatten!
  end
  #--------------------------------------------------------------------------
  #     &#12454;&#12451;&#12531;&#12489;&#12454;&#21066;&#38500;
  #--------------------------------------------------------------------------
  def remove_window(*window)
    @windows -= window
  end
  #--------------------------------------------------------------------------
  #     &#12501;&#12524;&#12540;&#12512;&#26356;&#26032;
  #--------------------------------------------------------------------------
  def update
    @viewport.update
    @target_sprite.update

    # &#24231;&#27161;&#35519;&#25972;
    dest_x, dest_y = get_cursor_pos
    if @target_sprite.x != dest_x
      if (dest_x - @target_sprite.x).abs < 4
        @target_sprite.x = dest_x
      else
        dist = (dest_x - @target_sprite.x) / 4
        dist = (dist > 0 ? [dist, 4].max : [dist, -4].min)
        @target_sprite.x += dist
      end
    end
    if @target_sprite.y != dest_y
      if (dest_y - @target_sprite.y).abs < 4
        @target_sprite.y = dest_y
      else
        dist = (dest_y - @target_sprite.y) / 4
        dist = (dist > 0 ? [dist, 4].max : [dist, -4].min)
        @target_sprite.y += dist
      end
    end
  end
  #--------------------------------------------------------------------------
  #     &#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#21462;&#24471;
  #    [x, y] &#12398;&#24418;&#12391;&#36820;&#12377;&#12290;
  #--------------------------------------------------------------------------
  def get_cursor_pos
    dx = 0
    dy = 0
    # &#12450;&#12463;&#12486;&#12451;&#12502;&#12454;&#12451;&#12531;&#12489;&#12454;&#12434;&#21462;&#24471;
    unless window_active?(@active_window)
      @active_window = search_active_window
    end

    # &#12450;&#12463;&#12486;&#12451;&#12502;&#12454;&#12451;&#12531;&#12489;&#12454;&#12364;&#12394;&#12369;&#12428;&#12400;&#38750;&#34920;&#31034;
    if @active_window == nil || !$game_switches[KGC::CursorAnimation::SWITCH_ID]
      @viewport.visible = false
      dx = Graphics.width / 2
      dy = Graphics.height / 2
      return [dx, dy]
    end
    @viewport.visible = @visible

    # &#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12434;&#35336;&#31639;
    rect = @active_window.cursor_rect
    dx = rect.x + 16 + KGC::CursorAnimation::POSITION_REV[0]
    dy = rect.y + 16 + KGC::CursorAnimation::POSITION_REV[1]
    vp = @active_window.viewport
    if vp != nil
      dx += vp.rect.x - vp.ox
      dy += vp.rect.y - vp.oy
    end
    dx += @active_window.x
    dy += @active_window.y
    case KGC::CursorAnimation::BASE_POSITION
    when 0  # &#19978;
      dy += @target_sprite.oy
    when 1  # &#20013;&#22830;
      dy += rect.height / 2
    when 2  # &#19979;
      dy += rect.height - @target_sprite.oy
    end
    return [dx, dy]
  end
  #--------------------------------------------------------------------------
  #     &#12454;&#12451;&#12531;&#12489;&#12454;&#12398;&#12450;&#12463;&#12486;&#12451;&#12502;&#29366;&#24907;&#21028;&#23450;
  #--------------------------------------------------------------------------
  def window_active?(window)
    return false if window == nil
    return false if window.disposed?

    if window.is_a?(Window_Selectable)
      return true if window.active
    elsif window.is_a?(Window_SaveFile)
      return true if window.selected
    end
    return false
  end
  #--------------------------------------------------------------------------
  #     &#12450;&#12463;&#12486;&#12451;&#12502;&#12454;&#12451;&#12531;&#12489;&#12454;&#12434;&#25506;&#12377;
  #--------------------------------------------------------------------------
  def search_active_window
    return @windows.find { |w|
      if !w.visible
        false
      elsif w.is_a?(Window_Selectable)
        w.active && w.index >= 0
      elsif w.is_a?(Window_SaveFile)
        w.selected
      else
        false
      end
    }
  end
end

#==================================End Class===================================#

#==============================================================================
# &#9632; Scene_Base
#==============================================================================

class Scene_Base
  #--------------------------------------------------------------------------
  # &#9679; &#38283;&#22987;&#20966;&#29702;
  #--------------------------------------------------------------------------
  alias start_KGC_CursorAnimation start
  def start
    Window_Base.show_cursor_animation

    start_KGC_CursorAnimation
  end
  #--------------------------------------------------------------------------
  # &#9679; &#32066;&#20102;&#21069;&#20966;&#29702;
  #--------------------------------------------------------------------------
  alias pre_terminate_KGC_CursorAnimation pre_terminate
  def pre_terminate
    Window_Base.hide_cursor_animation

    pre_terminate_KGC_CursorAnimation
  end
  #--------------------------------------------------------------------------
  # &#9679; &#12501;&#12524;&#12540;&#12512;&#26356;&#26032;
  #--------------------------------------------------------------------------
  alias update_KGC_CursorAnimation update
  def update
    update_KGC_CursorAnimation

    Window_Base.update_cursor_animation
  end
end

#==================================End Class===================================#

#==============================================================================
# &#9632; Scene_Title
#==============================================================================

if KGC::CursorAnimation::DEFAULT_ANIMATION

  class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # &#9679; &#21508;&#31278;&#12466;&#12540;&#12512;&#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#12398;&#20316;&#25104;
  #--------------------------------------------------------------------------
    alias create_game_objects_KGC_CursorAnimation create_game_objects
    def create_game_objects
      create_game_objects_KGC_CursorAnimation

      $game_switches[KGC::CursorAnimation::SWITCH_ID] = true
    end
  end

end  # <-- if KGC::CursorAnimation::DEFAULT_ANIMATION

#==================================End Class===================================#

class Window_Base < Window
  @@__cursor_animation = Cursor_Animation.new
end

#==================================End Class===================================#



Wymagana grafika do tego skryptu jest taka:


Lecz jest za blada i na białym tle jej nie widać, dlatego zmieniłem ją na taką:


Problem w tym, że ta czarna jest w ogóle niewidoczna i to chyba wina skryptu.
Za pomoc dam " Pomógł". PS. mam polskiego makera
 
 
Avara 





Pomogła: 32 razy
Dołączyła: 15 Gru 2010
Posty: 331
Skąd: Łódź
Wysłany: Sro 12 Paź, 2011 22:19
I: Czy nazwę grafiki pozostawiłeś bez zmian?
II: Spróbuj w konfiguracji zmienić "OPACITY = 224 " na 255.

Wątpię, by to o to chodziło, ale możesz spróbować. Z polskim makerem nigdy nic nie wiadomo :-P
________________________


Drakensang - przeglądarkowa gra RPG online
Spoiler:

 
 
 
Poster27 




Preferowany:
RPG Maker VX

Pomógł: 22 razy
Dołączył: 27 Kwi 2010
Posty: 136
Skąd: że znowu
Wysłany: Pią 14 Paź, 2011 15:51
Nie działa ;P A nazwy nie zmieniałem.
 
 
Avara 





Pomogła: 32 razy
Dołączyła: 15 Gru 2010
Posty: 331
Skąd: Łódź
Wysłany: Pią 14 Paź, 2011 16:14
Już wiem. "BLEND_TYPE" ustaw na zero (44. linijka)
________________________


Drakensang - przeglądarkowa gra RPG online
Spoiler:

 
 
 
Poster27 




Preferowany:
RPG Maker VX

Pomógł: 22 razy
Dołączył: 27 Kwi 2010
Posty: 136
Skąd: że znowu
Wysłany: Pią 14 Paź, 2011 16:29
THX masz pomógł ^^
 
 
Wyświetl posty z ostatnich:   
Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi
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