Project1
标题: 想请教循环显示图片 [打印本页]
作者: timmyyayaya 时间: 2011-11-26 19:42
标题: 想请教循环显示图片
本帖最后由 timmyyayaya 于 2011-11-27 15:20 编辑
这边有段原本的循环显示图片,
我想让他读取一张宽400高4的A图片,
读取方式是将A图片分割成4块来读取,
请问有大大可以教一下该如何改写吗?- #--------------------------------------------------------------------------
- # * Create HP Meter
- #--------------------------------------------------------------------------
- def create_hp_meter
- @hp_flow = 0
- @hp_damage_flow = 0
- @hp_image = RPG::Cache.windowskin("Hud_HP_Meter")
- @hp_bitmap = Bitmap.new(@hp_image.width,@hp_image.height)
- @hp_range = @hp_image.width / 3
- @hp_width = @hp_range * @actor.hp / @actor.maxhp
- @hp_height = @hp_image.height / 2
- @hp_width_old = @hp_width
- @hp_src_rect = Rect.new(@hp_range, 0, @hp_width, @hp_height)
- @hp_bitmap.blt(0,0, @hp_image, @hp_src_rect)
- @hp_sprite = Sprite.new
- @hp_sprite.bitmap = @hp_bitmap
- @hp_sprite.z = 1 + HUD_Z_PRIORITY
- @hp_sprite.x = HUD_POS[0] + HP_METER_POS[0]
- @hp_sprite.y = HUD_POS[1] + HP_METER_POS[1]
- hp_flow_update
- end
-
复制代码