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
Wto 30 Mar, 2010 10:32
Pomoc
Autor Wiadomość
Melvin 




Preferowany:
RPG Maker XP

Ranga RM:
1 gra

Pomógł: 35 razy
Dołączył: 23 Paź 2009
Posty: 1063
Wysłany: Pon 29 Mar, 2010 10:34
Pomoc
YO!

Proszę o helpa!

Więc robię CMS'a i nie mogę zrobić animacji wjazdowej okienka lokacji.
Proszę o pomoc.

Tu jest mój skrypt:
Spoiler:

Kod:
#==============================================================================
# C M S
#------------------------------------------------------------------------------
# CMS by Melvin
#==============================================================================
#------------------------------------------------------------------------------
# class Scene_Map
#------------------------------------------------------------------------------
class Scene_Map
  def main
    @spriteset = Spriteset_Map.new
    @message_window = Window_Message.new
    Graphics.transition
    loop do
     if Input.trigger?(Input::A)
      $scene = Scene_CMS.new
     end
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @spriteset.dispose
    @message_window.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
  end
end
#------------------------------------------------------------------------------
# class Scene_CMS
#------------------------------------------------------------------------------
class Scene_CMS
  def main
    @okno1 = Window_Gold_CMS.new
    @okno2 = Window_PlayTime_CMS.new
    @okno3 = Window_Steps_CMS.new
    @okno4 = Window_Location_CMS.new
    @okno1.x = -160
    @okno1.y = 95
    @okno2.x = 640
    @okno2.y = 164
    @okno3.x = -160
    @okno3.y = 0
    @okno4.x = 160
    @okno4.y = 0
    @spriteset = Spriteset_Map.new
    @appearing = true
    @disappearing = false
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @okno1.dispose
    @okno2.dispose
    @okno3.dispose
    @okno4.dispose
    @spriteset.dispose
  end
 
  def appear
    @okno1.x += 5 if @okno1.x < 0
    @okno2.x -= 5 if @okno2.x > 480
    @okno3.x += 5 if @okno3.x < 0
    @okno4.y += 5 if @okno4.y > 0
    if @okno1.x == 0 and @okno2.x == 480 and @okno3.x == 0 and
      @okno4.y == 0
      @appearing = false
    end
  end
 
  def disappear
    @okno1.x -= 5 if @okno1.x > -160
    @okno2.x += 5 if @okno2.x < 640
    @okno3.x -= 5 if @okno3.x > -160
    @okno4.y -= 5 if @okno4.y < -65
    if @okno1.x == -160 and @okno2.x == 640 and @okno3.x == -160 and
      @okno4.y == -65
      $scene = Scene_Map.new
    end
  end
 
  def update
    if @appearing
      appear
    end
    if @disappearing
      disappear
    end
    @okno1.update
    @okno2.update
    @okno3.update
    @okno4.update
    @spriteset.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @disappearing = true
    end
  end
end
#--------------------------------------------------------------------------
# Window_Steps_CMS
#--------------------------------------------------------------------------
class Window_Steps_CMS < Window_Base
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Ilość kroków")
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
    self.back_opacity = 255
  end
end
#--------------------------------------------------------------------------
# Window_PlayTime_CMS
#--------------------------------------------------------------------------
class Window_PlayTime_CMS < Window_Base
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, "Czas gry")
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, text, 2)
    self.back_opacity = 255
  end
  def update
    super
    if Graphics.frame_count / Graphics.frame_rate != @total_sec
      refresh
    end
  end
end
#--------------------------------------------------------------------------
# Window_Gold_CMS
#--------------------------------------------------------------------------
class Window_Gold_CMS < Window_Base
  def initialize
    super(2, 77, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
    self.back_opacity = 255
  end
end
class Game_Map
  def name
    $map_info[@map_id]
  end
end
class Scene_Title
  $map_info = load_data("Data/MapInfos.rxdata")
  for key in $map_info.keys
    $map_info[key] = $map_info[key].name
  end
end
class Window_Base < Window
end
#--------------------------------------------------------------------------
# Window_Location_CMS
#--------------------------------------------------------------------------
class Window_Location_CMS < Window_Base
  def initialize(x = 0, y = 0, width = 450, height = 64)
    super(x, y, width, height)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Arial"
    self.contents.font.size = 22
    self.back_opacity = 255
    refresh
  end
  def refresh
    self.contents.clear
    self.contents.draw_text(0, 0, 100, 32, "Lokacja:", 1)
    self.contents.draw_text(0, 0, 350, 32, $game_map.name, 1)
  end
end



Problem tkwi w tym, że okienko lokacji nie rusza z miejsca...
Mógłby mi ktoś to naprawić i najlepiej powiedzieć co robię nie tak?

Z góry dzięki.

Pzdr
________________________
MelvinClass:
Spoiler:

 
 
Ayene 




Ranga RM:
4 gry

Pomogła: 232 razy
Dołączyła: 18 Wrz 2007
Posty: 2424
Wysłany: Pon 29 Mar, 2010 11:53
Przede wszystkim @okno4.y w main powinno być ustawione na -65 a nie 0:
Kod:
@okno4.y = -65

przecież powinno być domyślnie schowane.

Definicja appear powinna wyglądać:
Kod:
  def appear   
    @okno1.x += 5 if @okno1.x < 0
    @okno2.x -= 5 if @okno2.x > 480
    @okno3.x += 5 if @okno3.x < 0
    @okno4.y += 5 if @okno4.y < 0
    if Input.trigger?(Input::B)
      @appearing = false   
    end   
    if @okno1.x == 0 and @okno2.x == 480 and @okno3.x == 0 and
      @okno4.y == 0
      @appearing = false
    end
  end


A definicja disappear tak:
Kod:
  def disappear
    @okno1.x -= 5 if @okno1.x > -160
    @okno2.x += 5 if @okno2.x < 640
    @okno3.x -= 5 if @okno3.x > -160
    @okno4.y -= 5 if @okno4.y > -65
    if @okno1.x == -160 and @okno2.x == 640 and @okno3.x == -160 and
      @okno4.y == -65
      $scene = Scene_Map.new
    end
  end

Ponadto, okno Window_Location_CMS może mieć podane stałe parametry w super, a nie w initialize (ale to już szczegół):
Kod:
class Window_Location_CMS < Window_Base
  def initialize
    super(0, 0, 450, 64)
________________________


 
 
 
Melvin 




Preferowany:
RPG Maker XP

Ranga RM:
1 gra

Pomógł: 35 razy
Dołączył: 23 Paź 2009
Posty: 1063
Wysłany: Pon 29 Mar, 2010 13:50
Dzięki!!! :przytul:
Działa.. Działa i jeszcze raz... "Działa"!
"Big THX" :mrgreen: :-D
________________________
MelvinClass:
Spoiler:

 
 
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