@true_y n = (self.y - @true_y) / 3 n = 1 if n == 0 self.y -= n end if self.x < @true_x n = (@true_x - self.:doute2 / 3 n = 1 if n == 0 self.x += n elsif self.x > @true_x n = (self.x - @true_X) / 3 n = 1 if n == 0 self.x -= n end end end #============================================================================== # ■Window_Selectable #============================================================================== class Window_Selectable < Window_Base #-------------------------------------------------------------------------- # ● instances #-------------------------------------------------------------------------- attr_accessor :cursor alias initialize_cursor initialize alias update_cursor_moves update alias dispose_cursor dispose #-------------------------------------------------------------------------- # ● initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height) initialize_cursor(x, y, width, height) @cursor = Sprite_Cursor.new(x, y) update_cursor end #-------------------------------------------------------------------------- # ● x= #-------------------------------------------------------------------------- def x=(X) super @cursor.x = x if !@cursor.nil? end #-------------------------------------------------------------------------- # ● y= #-------------------------------------------------------------------------- def y=(y) super @cursor.y = y if !@cursor.nil? end #-------------------------------------------------------------------------- # ● visible= #-------------------------------------------------------------------------- def visible=(visible) super if !@cursor.nil? and visible == false @cursor.visible = false end end #-------------------------------------------------------------------------- # ● dispose #-------------------------------------------------------------------------- def dispose dispose_cursor @cursor.dispose end #-------------------------------------------------------------------------- # ● update_cursor_rect #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty return end row = @index / @column_max if row < self.top_row self.top_row = row end if row > self.top_row + (self.page_row_max - 1) self.top_row = row - (self.page_row_max - 1) end cursor_width = self.width / @column_max - 32 x = @index % @column_max * (cursor_width + 32) y = @index / @column_max * 32 - self.oy self.cursor_rect.set(x, y, cursor_width, 32) end #-------------------------------------------------------------------------- # ● update_cursor #-------------------------------------------------------------------------- def update_cursor @cursor.true_x = self.cursor_rect.x + self.x - 8 @cursor.true_y = self.cursor_rect.y + self.y + 16 @cursor.update @cursor.visible = (self.visible and self.index >= 0) end #-------------------------------------------------------------------------- # ● update #-------------------------------------------------------------------------- def update update_cursor_moves update_cursor end end" />

Vai al contenuto


Toggle Chat RM - Chat Apri la Chat in un popup

E' severamente vietato richiedere supporto su RPG Maker in chat!
@  Melosx : (25 May 2012 - 08:30 PM) Buonasera a tutti
@  Hashmin : (25 May 2012 - 02:15 PM) ciao a tt!
@  Pech93 : (24 May 2012 - 01:55 PM) ho aggiunto delle composizioni originali!!! Chi le vuole ascoltare e dare qualche commento costruttivo?
@  MihaChan : (23 May 2012 - 09:19 PM) a parte i denti -che stanno decidendo di darmi noia in questi giorni-, tutto okay~
@  Melosx : (23 May 2012 - 09:18 PM) bene ^.^ ... Tu??
@  MihaChan : (23 May 2012 - 09:17 PM) come va? xD
@  MihaChan : (23 May 2012 - 09:16 PM) okay
@  MihaChan : (23 May 2012 - 09:16 PM) ah
@  Melosx : (23 May 2012 - 09:14 PM) ciao miha... ai dont spic inglisc
@  MihaChan : (23 May 2012 - 09:12 PM) how'sa goin'?
@  MihaChan : (23 May 2012 - 09:12 PM) ciao Mel!
@  Melosx : (23 May 2012 - 09:07 PM) ciao
@  MihaChan : (23 May 2012 - 09:06 PM) salve D:
@  Pech93 : (23 May 2012 - 08:05 PM) MIk?
@  Melosx : (23 May 2012 - 07:51 PM) VIENI SU MSN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@  Melosx : (23 May 2012 - 07:51 PM) MIIIIIIIIIIIIIIIIIIIKKKKKKKKKKKK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@  Melosx : (23 May 2012 - 07:46 PM) *iù
@  Melosx : (23 May 2012 - 07:38 PM) iu spin mi rai rau bebi rai rau laic a record bebi rau rau rau rau
@  Melosx : (23 May 2012 - 07:37 PM) lalalallalallalallallllllllllalalalallaaaaaaaaaaaaaaaaaaaaaa!!!!!!!!!!!!!!!!!!
@  Melosx : (23 May 2012 - 07:37 PM) lalalalala

Script Cursore


  • Per cortesia connettiti per rispondere
Nessuna risposta a questa discussione

#1 OFFLINE   Ally

Ally

    Fondatori

  • Amministratori
  • 5558 Messaggi:
  • Localitàrpgmkr
  • Ruolo:
    Scripter
  • Progetto VX:
    Essence
  • Tool:
    RM2k/2k3

Inviato 04 September 2011 - 06:44 PM

Nome Script: Script Cursore
Versione: N/D
Autore/i: Selwyn

Informazioni:
Script che aggiunge un cursore come succede nei giochi di Final Fantasy.

Istruzioni:
Inserite lo script sopra Main.
Aggiungete poi questa immagine nella cartella Pictures del vostro progetto:
Immagine inserita

Script:
#==============================================================================
# â–  Cursor Script
#------------------------------------------------------------------------------
#  Script to display a cursor instead of a highlight box
#   by Selwyn
#   selwyn@rmxp.ch
#==============================================================================

#==============================================================================
# â–  Cursor_Sprite
#==============================================================================

class Sprite_Cursor < Sprite
  #--------------------------------------------------------------------------
  # ● instances
  #--------------------------------------------------------------------------
  attr_accessor :true_x
  attr_accessor :true_y
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(x = 0, y = 0)
    super()
    self.x = @true_x = x
    self.y = @true_y = y
    self.z = 10000
    self.bitmap = RPG::Cache.picture("cursor") rescue Bitmap.new(32, 32)
  end
  #--------------------------------------------------------------------------
  # ● update
  #--------------------------------------------------------------------------
  def update
    super
    
    if self.y < @true_y
      n = (@true_y - self.y) / 3
      n = 1 if n == 0
      self.y += n
    elsif self.y > @true_y
      n = (self.y - @true_y) / 3
      n = 1 if n == 0
      self.y -= n
    end

    if self.x < @true_x
      n = (@true_x - self.:doute2 / 3
      n = 1 if n == 0
      self.x += n
    elsif self.x > @true_x
      n = (self.x - @true_X) / 3
      n = 1 if n == 0
      self.x -= n
    end
  end
end

#==============================================================================
# â–  Window_Selectable
#==============================================================================

class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # ● instances
  #--------------------------------------------------------------------------
  attr_accessor :cursor
  alias initialize_cursor initialize
  alias update_cursor_moves update
  alias dispose_cursor dispose
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    initialize_cursor(x, y, width, height)
    @cursor = Sprite_Cursor.new(x, y)
    update_cursor
  end
  #--------------------------------------------------------------------------
  # ● x=
  #--------------------------------------------------------------------------
  def x=(X)
    super
    @cursor.x = x if !@cursor.nil?
  end
  #--------------------------------------------------------------------------
  # ● y=
  #--------------------------------------------------------------------------
  def y=(y)
    super
    @cursor.y = y if !@cursor.nil?
  end
  #--------------------------------------------------------------------------
  # ● visible=
  #--------------------------------------------------------------------------
  def visible=(visible)
    super
    if !@cursor.nil? and visible == false
      @cursor.visible = false
    end
  end
  #--------------------------------------------------------------------------
  # ● dispose
  #--------------------------------------------------------------------------
  def dispose
    dispose_cursor
    @cursor.dispose
  end
  #--------------------------------------------------------------------------
  # ● update_cursor_rect
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    if row < self.top_row
      self.top_row = row
    end
    if row > self.top_row + (self.page_row_max - 1)
      self.top_row = row - (self.page_row_max - 1)
    end
    cursor_width = self.width / @column_max - 32
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * 32 - self.oy
    self.cursor_rect.set(x, y, cursor_width, 32)
  end
  #--------------------------------------------------------------------------
  # ● update_cursor
  #--------------------------------------------------------------------------
  def update_cursor
    @cursor.true_x = self.cursor_rect.x + self.x - 8
    @cursor.true_y = self.cursor_rect.y + self.y + 16
    @cursor.update
    @cursor.visible = (self.visible and self.index >= 0)
  end
  #--------------------------------------------------------------------------
  # ● update
  #--------------------------------------------------------------------------
  def update
    update_cursor_moves
    update_cursor
  end
end

Immagine inserita
Spoiler




1 utente(i) stanno leggendo questa discussione

0 utenti, 1 ospiti, 0 utenti anonimi