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: SaE
Sob 13 Kwi, 2013 22:42
Pomoc przy tworzeniu Drzewka skilli
Autor Wiadomość
DrVanHelsing 



Dołączył: 27 Gru 2012
Posty: 2
Wysłany: Nie 30 Gru, 2012 15:15
Pomoc przy tworzeniu Drzewka skilli
Otż chcieli śmy z kolegami stworzyć swoją własną grę i móc w nią grać online. Udało się i łączymy się online (wadą jest to, że każdy ma swoje własne mobki), ale nie o to chodzi. Chodzi mi o to, że chciałem dograć Leongon SkillTree, jednak w mojej wersji menu nie włącza się "x" tylko jest ono widoczne na ekranie gry
Tak wygląda ekran gry:

Spoiler:


A tak , na przykład inventory
Spoiler:



Jka widać na 1 obrazku w prawym dolnym rogu jest obrazek 3 czerwonych ludzików to były nieudane próby stworzenia tego przycisku. Prosiłbym o pomoc

Tutaj jeszcze dodaję skrypt tych wszystkich widocznych okienek(HUD'ów)
Spoiler:

Kod:
#------------------------------------------------------------------------------
class HUD2 < Sprite
 
  def initialize(viewport)
    super(viewport)
    @bg = Cache.system("Skills Base")
    self.y = Graphics.height-@bg.height
    self.bitmap = Bitmap.new(@bg.width, @bg.height)
    self.bitmap.font.size = 16
    $windows << self
    refresh
  end
 
  def update
    super
    self.visible = ($HUD and !$game_player.transparent)
    update_drag
    update_drop
    update_hotkeys
    refresh if something_changed?
  end
 
  def refresh
    return if $actor == nil
    @hotkeys = {}
    $actor.skill_hotkeys.each { |k, v| @hotkeys[k] = v }
    self.bitmap.clear
    self.bitmap.blt(0, 0, @bg, @bg.rect)
    draw_skills
  end
 
  def draw_skills
    return if $actor == nil
    count = 0
    $actor.skill_hotkeys.each { |key, value|
     if value != nil
       skill = $data_skills[value]
       if skill != nil
         draw_icon(skill.icon_index, 32*count+4, 4)
         self.bitmap.font.color = Color.new(255,255,255)
         self.bitmap.draw_outlined_text(32*count, self.bitmap.height-16, 32, 16, Keys.value(key)[0], 1)
       end
     end
     count += 1
    }
  end
 
  def update_hotkeys
    count = 0
    $VTP.skills_key.each { |k, v|
      if $mouse.in_area?(self.x+(32*count), self.y) and Input.trigger?(Keys::MOUSER)
        $actor.skill_hotkeys[k] = 0
        refresh
      end
      count += 1
    }
  end
 
  def update_drag
    return if $actor == nil
    return unless Input.trigger?(Keys::MOUSEL)
    return unless in_area?
    return if $mouse.object != nil
    count = 0
    $VTP.skills_key.each { |k, v|
      if $actor.skill_hotkeys[k]!= nil and $mouse.in_area?(self.x+(32*count), self.y)
        $mouse.object = $data_skills[$actor.skill_hotkeys[k]]
      end
      count += 1
    }
    $mouse.parent = self
  end
 
  def update_drop
    return if $actor == nil
    return if Input.press?(Keys::MOUSEL)
    return unless in_area?
    return if $mouse.object == nil
    return if $mouse.parent == nil
    return if $mouse.parent == self
    return unless $mouse.object.is_a?(RPG::Skill)
    count = 0
    $VTP.skills_key.each { |k, v|
      if $mouse.in_area?(self.x+(32*count), self.y)
        $actor.skill_hotkeys[k] = $mouse.object.id
        refresh
      end
      count += 1
    }
  end
 
  def something_changed?
    return false if $actor == nil
    return true if @hotkeys != $actor.skill_hotkeys
    return false
  end
 
  def dispose
    self.bitmap.dispose
    super
  end
 
end

#------------------------------------------------------------------------------
class HUD3 < Sprite
 
  def initialize(viewport)
    super(viewport)
    @bg = Cache.system("Items Base")
    self.x = 162
    self.y = Graphics.height-@bg.height
    self.bitmap = Bitmap.new(@bg.width, @bg.height)
    self.bitmap.font.size = 16
    $windows << self
    refresh
  end
 
  def update
    super
    self.visible = ($HUD and !$game_player.transparent)
    update_drag
    update_drop
    update_hotkeys
    refresh if something_changed?
  end
 
  def refresh
    return if $actor == nil
    @hotkeys = {}
    $actor.item_hotkeys.each { |k, v| @hotkeys[k] = v }
    self.bitmap.clear
    self.bitmap.blt(0, 0, @bg, @bg.rect)
    draw_items
  end
 
  def draw_items
    return if $actor == nil
    count = 0
    $actor.item_hotkeys.each { |key, value|
     if value != nil
       item = $data_items[value]
       if item != nil
         draw_icon(item.icon_index, 32*count+4, 4)
         self.bitmap.font.color = Color.new(255,255,255)
         self.bitmap.draw_outlined_text(32*count, self.bitmap.height-16, 32, 16, Keys.value(key)[0].capitalize, 1)
       end
     end
     count += 1
    }
  end
 
  def update_hotkeys
    count = 0
    $VTP.items_key.each { |k, v|
      if $mouse.in_area?(self.x+(32*count), self.y) and Input.trigger?(Keys::MOUSER)
        $actor.item_hotkeys[k] = 0
        refresh
      end
      count += 1
    }
  end
 
  def update_drag
    return if $actor == nil
    return unless Input.trigger?(Keys::MOUSEL)
    return unless in_area?
    return if $mouse.object != nil
    count = 0
    $VTP.items_key.each { |k, v|
      if $actor.item_hotkeys[k]!= nil and $mouse.in_area?(self.x+(32*count), self.y)
        $mouse.object = $data_items[$actor.item_hotkeys[k]]
      end
      count += 1
    }
    $mouse.parent = self
  end
 
  def update_drop
    return if $actor == nil
    return if Input.press?(Keys::MOUSEL)
    return unless in_area?
    return if $mouse.object == nil
    return if $mouse.parent == nil
    return if $mouse.parent == self
    return unless $mouse.object.is_a?(RPG::Item)
    count = 0
    $VTP.items_key.each { |k, v|
      if $mouse.in_area?(self.x+(32*count), self.y)
        $actor.item_hotkeys[k] = $mouse.object.id
        refresh
      end
      count += 1
    }
  end
 
  def something_changed?
    return false if $actor == nil
    return true if @hotkeys != $actor.item_hotkeys
    return false
  end
 
  def dispose
    self.bitmap.dispose
    super
  end
 
end

#------------------------------------------------------------------------------
class HUD4 < Sprite
 
  def initialize(viewport)
    super(viewport)
    @bg = Cache.system("Ammo Base")
    self.x = Graphics.width-@bg.width
    self.y = Graphics.height-@bg.height
    self.bitmap = Bitmap.new(@bg.width, @bg.height)
    $windows << self
    refresh
  end
 
  def refresh
    return if $actor == nil
    @ammos = {}
    @weapon = $actor.weapons[0]
    $actor.ammos.each { |k, v| @ammos[k] = v }
    self.bitmap.clear
    self.bitmap.blt(0, 0, @bg, @bg.rect)
    draw_ammo
  end
 
  def update
    super
    self.visible = ($HUD and !$game_player.transparent)
    update_drop
    return if $actor == nil
    refresh if something_changed?
  end
 
  def draw_ammo
    return if $actor == nil
    $actor.ammos.each { |key, value|
      next if $actor.weapons[0] == nil
      next if $actor.weapons[0].id != key
      next if value == nil
      @ammo = $data_items[value]
      @quantity = $game_party.item_number(@ammo)
      draw_icon($data_items[value].icon_index, 4, 4)
      self.bitmap.font.color = Color.new(255,255,255)
      self.bitmap.draw_outlined_text(0, self.bitmap.height-16, 32, 16, sprintf("%2d", @quantity), 1)
    }
  end
 
  def update_drop
    return if $actor == nil
    return if Input.press?(Keys::MOUSEL)
    return unless in_area?
    return if $mouse.object == nil
    return if $mouse.parent == nil
    return if $mouse.parent == self
    return unless $mouse.object.is_a?(RPG::Item)
    $actor.ammos[$actor.weapons[0].id] = $mouse.object.id
    refresh
  end
 
  def something_changed?
    return false if $actor == nil
    return true if @weapon != $actor.weapons[0]
    return true if @ammos != $actor.ammos
    return true if @ammo != nil and $game_party.item_number(@ammo) != @quantity
    return false
  end
 
end

#------------------------------------------------------------------------------
class HUD5 < Sprite
 
  attr_accessor :active
  attr_accessor :back_opacity
 
  def initialize(viewport)
    super(viewport)
    @bg = Cache.system("Shortcuts Base")
    self.x = 262
    self.y = Graphics.height-@bg.height
    self.bitmap = Bitmap.new(@bg.width, @bg.height)
    @back_opacity = self.opacity
    $windows << self
    create_buttons
    refresh
  end
 
  def create_buttons
    return if $actor == nil
    @buttons = []
    @buttons[0] = Icon.new(self, 0, 0, "System Icons", 4)      { $window["inventory"].trigger; $window["equips"].trigger }
    @buttons[1] = Icon.new(self, 32, 0, "System Icons", 5)   { call_status }
    @buttons[2] = Icon.new(self, 64, 0, "System Icons", 6)   { call_skill }
    @buttons[3] = Icon.new(self, 96, 0, "System Icons", 7)   { call_quest }
    @buttons[4] = Icon.new(self, 128, 0, "System Icons", 10) { $window["chat"].trigger }
    @buttons[5] = Icon.new(self, 160, 0, "System Icons", 1) { }
    @buttons[0].tip_text = "#{Vocab.item} (I)"
    @buttons[1].tip_text = "#{Vocab.status} (C)"
    @buttons[2].tip_text = "#{Vocab.skill} (K)"
    @buttons[3].tip_text = "#{Vocab::Quests} (P)"
    @buttons[4].tip_text = "#{Vocab::Chat} (Home)"
    @buttons[5].tip_text = "#{"SkillTree"} (/)"
  end
 
  def call_status
    $window["character"].trigger
    $window["skills"].on_close
    $window["guild"].on_close
    $window["friends"].on_close
    $window["quests"].on_close
    $window["quest infos"].on_close
  end
 
  def call_skill
    $window["skills"].trigger
    $window["guild"].on_close
    $window["friends"].on_close
    $window["character"].on_close
    $window["quests"].on_close
    $window["quest infos"].on_close
  end
 
  def call_quest
    $window["quests"].trigger
    $window["skills"].on_close
    $window["guild"].on_close
    $window["friends"].on_close
    $window["character"].on_close
    $window["quest infos"].on_close unless $window["quests"].visible
  end
 
  def refresh
    return if $actor == nil
    self.bitmap.clear
    self.bitmap.blt(0, 0, @bg, @bg.rect)
  end
 
  def update
    super
    self.visible = ($HUD and !$game_player.transparent)
    return if $actor == nil
    for i in @buttons
      i.update
      i.visible = self.visible
    end
  end
 
  def dispose
    if @buttons != nil
      for i in @buttons
        i.dispose
      end
    end
    super
  end
 
end

#------------------------------------------------------------------------------
class HUD6 < Sprite
 
  attr_accessor :active
  attr_accessor :back_opacity
 
  def initialize(viewport)
    super(viewport)
    @bg = Cache.system("Options Base")
    self.x = Graphics.width-@bg.width
    self.y = 1
    self.bitmap = Bitmap.new(@bg.width, @bg.height)
    @back_opacity = self.opacity
    $windows << self
    create_buttons
    refresh
  end
 
  def create_buttons
    return if $actor == nil
    @buttons = []
    @buttons[0] = Icon.new(self, 0, 0, "System Icons", 0)    { call_guild }
    @buttons[1] = Icon.new(self, 32, 0, "System Icons", 1)
    @buttons[2] = Icon.new(self, 64, 0, "System Icons", 2) { call_friend }
    @buttons[3] = Icon.new(self, 96, 0, "System Icons", 3) { $window["options"].trigger }
    @buttons[0].tip_text = "#{Vocab::Guild} (P)"
    @buttons[1].tip_text = "#{Vocab::Party}"
    @buttons[2].tip_text = "#{Vocab::Friends} (F)"
    @buttons[3].tip_text = Vocab::Options
  end
 
  def call_guild
    $window["guild"].trigger
    $window["skills"].on_close
    $window["friends"].on_close
    $window["character"].on_close
    $window["quests"].on_close
    $window["quest infos"].on_close
  end
 
  def call_friend
    $window["friends"].trigger
    $window["skills"].on_close
    $window["guild"].on_close
    $window["character"].on_close
    $window["quests"].on_close
    $window["quest infos"].on_close
  end
 
  def refresh
    return if $actor == nil
    self.bitmap.clear
    self.bitmap.blt(0, 0, @bg, @bg.rect)
  end
 
  def update
    super
    self.visible = ($HUD and !$game_player.transparent)
    return if $actor == nil
    for i in @buttons
      i.update
      i.visible = self.visible
    end
  end
 
  def dispose
    if @buttons != nil
      for i in @buttons
        i.dispose
      end
    end
    super
  end
 
end

#------------------------------------------------------------------------------
class Spriteset_Map
 
  alias hud_create_viewports create_viewports
  alias hud_update update
  alias hud_dispose dispose
 
  def create_viewports
    hud_create_viewports
    create_hud
  end
 
  def update
    hud_update
    update_hud
  end
 
  def dispose
    hud_dispose
    dispose_hud
  end
 
  def create_hud
    @hud = {}
    @hud[1] = HUD2.new(@viewport3)
    @hud[2] = HUD3.new(@viewport3)
    @hud[3] = HUD4.new(@viewport3)
    @hud[4] = HUD5.new(@viewport3)
    @hud[5] = HUD6.new(@viewport3)
  end
 
  def update_hud
    @hud.each_value { |i| i.update }
  end
 
  def dispose_hud
    @hud.each_value { |i| i.dispose }
  end
 
end

 
 
Ayene 




Ranga RM:
4 gry

Pomogła: 232 razy
Dołączyła: 18 Wrz 2007
Posty: 2424
Wysłany: Nie 03 Lut, 2013 20:19
Mógłbyś wysłać mi demo problemu na PW? Postaram się pomóc... o ile problem jest jeszcze aktualny.
________________________


 
 
 
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