赞 | 1 |
VIP | 255 |
好人卡 | 52 |
积分 | 1 |
经验 | 77416 |
最后登录 | 2016-1-18 |
在线时间 | 1269 小时 |
Lv1.梦旅人 薄凉看客
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 1269 小时
- 注册时间
- 2010-6-20
- 帖子
- 1316
|
使用事件显示图片?有没有搞错{:2_263:}
直接改Spriteset_Battle啊。。
脚本:- #
- # 我没有素材,所以请将001-Gameover01.jpg复制在Icons文件夹下测试
- # 或换用其他图片!!
- #
- #==============================================================================
- # ■ Spriteset_Battle
- #------------------------------------------------------------------------------
- # 处理战斗画面的活动块的类。本类在 Scene_Battle 类
- # 的内部使用。
- #==============================================================================
- class Spriteset_Battle
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :viewport1 # 敌人方的显示端口
- attr_reader :viewport2 # 角色方的显示端口
- #--------------------------------------------------------------------------
- # ● 初始化变量
- #--------------------------------------------------------------------------
- def initialize
- # 生成显示端口
- @viewport1 = Viewport.new(0, 0, 640, 320)
- @viewport2 = Viewport.new(0, 0, 640, 480)
- @viewport3 = Viewport.new(0, 0, 640, 480)
- @viewport4 = Viewport.new(0, 0, 640, 480)
- @viewport2.z = 101
- @viewport3.z = 200
- @viewport4.z = 5000
- # 生成战斗背景活动块
- @battleback_sprite = Sprite.new(@viewport1)
- #####################################################
- #自定义图形活动块
- @battle_picture = Sprite.new(@viewport1)
- #####################################################
- # 生成敌人活动块
- @enemy_sprites = []
- for enemy in $game_troop.enemies.reverse
- @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
- end
- # 生成敌人活动块
- @actor_sprites = []
- @actor_sprites.push(Sprite_Battler.new(@viewport2))
- @actor_sprites.push(Sprite_Battler.new(@viewport2))
- @actor_sprites.push(Sprite_Battler.new(@viewport2))
- @actor_sprites.push(Sprite_Battler.new(@viewport2))
- # 生成天候
- @weather = RPG::Weather.new(@viewport1)
- # 生成图片活动块
- @picture_sprites = []
- for i in 51..100
- @picture_sprites.push(Sprite_Picture.new(@viewport3,
- $game_screen.pictures[i]))
- end
- # 生成计时器块
- @timer_sprite = Sprite_Timer.new
- # 刷新画面
- update
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- # 如果战斗背景位图存在的情况下就释放
- if @battleback_sprite.bitmap != nil
- @battleback_sprite.bitmap.dispose
- end
- # 释放战斗背景活动块
- @battleback_sprite.dispose
- #####################################################
- # 自定义图形存在的情况下就释放
- if @battle_picture.bitmap != nil
- @battle_picture.bitmap.dispose
- end
- # 释放自定义图形活动块
- @battle_picture.dispose
- ######################################################
- # 释放敌人活动块、角色活动块
- for sprite in @enemy_sprites + @actor_sprites
- sprite.dispose
- end
- # 释放天候
- @weather.dispose
- # 释放图片活动块
- for sprite in @picture_sprites
- sprite.dispose
- end
- # 释放计时器活动块
- @timer_sprite.dispose
- # 释放显示端口
- @viewport1.dispose
- @viewport2.dispose
- @viewport3.dispose
- @viewport4.dispose
- end
- #--------------------------------------------------------------------------
- # ● 显示效果中判定
- #--------------------------------------------------------------------------
- def effect?
- # 如果是在显示效果中的话就返回 true
- for sprite in @enemy_sprites + @actor_sprites
- return true if sprite.effect?
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新角色的活动块 (对应角色的替换)
- @actor_sprites[0].battler = $game_party.actors[0]
- @actor_sprites[1].battler = $game_party.actors[1]
- @actor_sprites[2].battler = $game_party.actors[2]
- @actor_sprites[3].battler = $game_party.actors[3]
- # 战斗背景的文件名与现在情况有差异的情况下
- if @battleback_name != $game_temp.battleback_name
- @battleback_name = $game_temp.battleback_name
- if @battleback_sprite.bitmap != nil
- @battleback_sprite.bitmap.dispose
- end
- @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
- @battleback_sprite.src_rect.set(0, 0, 640, 320)
- end
- #########################################
- if @battle_picture.bitmap != nil
- @battle_picture.bitmap.dispose
- end
- #我没有什么素材,所以。。直接用的Gameover图,请自行更改!!
- #图调用在这里,放在图标文件下,想放其他地方,请参考帮助RPG::Cache
- @battle_picture.bitmap = RPG::Cache.icon("001-Gameover01.jpg")
- #图的X、Y坐标以及图片的宽度高度在这里调整
- @battle_picture.src_rect.set(0, 0, 640, 320)#或者640,480
- #########################################
- # 刷新战斗者的活动块
- for sprite in @enemy_sprites + @actor_sprites
- sprite.update
- end
- # 刷新天气图形
- @weather.type = $game_screen.weather_type
- @weather.max = $game_screen.weather_max
- @weather.update
- # 刷新图片活动块
- for sprite in @picture_sprites
- sprite.update
- end
- # 刷新计时器活动块
- @timer_sprite.update
- # 设置画面的色调与震动位置
- @viewport1.tone = $game_screen.tone
- @viewport1.ox = $game_screen.shake
- # 设置画面的闪烁色
- @viewport4.color = $game_screen.flash_color
- # 刷新显示端口
- @viewport1.update
- @viewport2.update
- @viewport4.update
- end
- end
复制代码 |
评分
-
查看全部评分
|