Well, Take me Again .... I have a question about my Messy code:
Well, The problem is very simple, it's possible to create a shorter form of that?, I don't know too much about loops and that type of things, but maybe you can help.
Thanks.
Code:
if @actor.styles.include?(Styles::Tela)
bitmap = RPG::Cache.icon('001-Weapon01')
self.contents.blt(0 , 0, bitmap, Rect.new(0, 0, 24, 24))
else
bitmap = RPG::Cache.icon(Styles::Armor_No_Style)
self.contents.blt(0 , 0, bitmap, Rect.new(0, 0, 24, 24))
end
if @actor.styles.include?(Styles::Cuero)
bitmap = RPG::Cache.icon('001-Weapon01')
self.contents.blt(40 , 0, bitmap, Rect.new(0, 0, 24, 24))
else
bitmap = RPG::Cache.icon(Styles::Armor_No_Style)
self.contents.blt(40 , 0, bitmap, Rect.new(0, 0, 24, 24))
end
if @actor.styles.include?(Styles::Malla)
bitmap = RPG::Cache.icon('001-Weapon01')
self.contents.blt(80 , 0, bitmap, Rect.new(0, 0, 24, 24))
else
bitmap = RPG::Cache.icon(Styles::Armor_No_Style)
self.contents.blt(80 , 0, bitmap, Rect.new(0, 0, 24, 24))
end
if @actor.styles.include?(Styles::Placas)
bitmap = RPG::Cache.icon('001-Weapon01')
self.contents.blt(120 , 0, bitmap, Rect.new(0, 0, 24, 24))
else
bitmap = RPG::Cache.icon(Styles::Armor_No_Style)
self.contents.blt(120 , 0, bitmap, Rect.new(0, 0, 24, 24))
end
if @actor.styles.include?(Styles::Escudo)
bitmap = RPG::Cache.icon('001-Weapon01')
self.contents.blt(160 , 0, bitmap, Rect.new(0, 0, 24, 24))
else
bitmap = RPG::Cache.icon(Styles::Armor_No_Style)
self.contents.blt(160 , 0, bitmap, Rect.new(0, 0, 24, 24))
end
Well, The problem is very simple, it's possible to create a shorter form of that?, I don't know too much about loops and that type of things, but maybe you can help.
Thanks.