Project1
标题: 图片显示 [打印本页]
作者: 潇洒GO4回 时间: 2012-8-7 21:16
标题: 图片显示
本帖最后由 潇洒GO4回 于 2012-8-7 21:16 编辑
自己在显示坐标脚本里加了个图片设置,发现有问题,设置成开关打开后显示图片,可是第一次开关打开的时候坐标显示了,问题是不显示图片,要按下C键之在按X键才会显示图片,此后开关打开就可以显示坐标和图片了。。很囧啊- #==========================================================================
- # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
- #==========================================================================
- XY_SWITCH = 1 # 当1号开关打开,本脚本才开始工作。
- #==============================================================================
- # ■ Window_XY
- #------------------------------------------------------------------------------
- # 显示地图坐标的窗口
- #==============================================================================
- class Window_Xy < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- #坐标底图================
- @坐标底图 = Sprite.new
- @坐标底图.bitmap = Bitmap.new("Graphics/Pictures/图片显示/游戏界面1") #图片筐位置
- @坐标底图1 = Sprite.new
- @坐标底图1.bitmap = Bitmap.new("Graphics/Pictures/图片显示/游戏界面2") #图片筐位置
- @坐标底图.z = 120
- @坐标底图.y = 0
- @坐标底图.x = 0
- @坐标底图1.z = 120
- @坐标底图1.y = 442
- @坐标底图1.x = 282
- if $game_switches[XY_SWITCH]
- @坐标底图.update
- @坐标底图1.update
- else
- @坐标底图.dispose
- @坐标底图1.dispose
- end
- #释放图片===============
- def dispose
- @坐标底图.dispose
- @坐标底图1.dispose
- super
- end
- super(0, -14, 160, 70)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- #self.visible = true
- refresh
- @x = $game_player.x
- @y = $game_player.y
- @id = $game_map.map_id
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if $game_switches[XY_SWITCH] #确定开关是否打开,可以自己改变开关
- @x = $game_player.x
- @y = $game_player.y
- @id = $game_map.map_id
- self.contents.clear
- $mapnames = load_data("Data/MapInfos.rxdata")
- # 战斗中的情况下
- if $game_temp.in_battle
- map_name = $mapnames[@id].name #+ ":战斗中"
- else
- map_name = $mapnames[@id].name
- end
- self.contents.font.size = 13
- self.contents.font.name ="黑体"
- self.contents.font.color = normal_color
- self.contents.draw_text(16, 7, 83, 39, map_name, 1)
- self.contents.font.size = 13
- self.contents.font.name ="宋体"
- self.contents.draw_text(15+5, -2, 28, 20, "X:")
- self.contents.font.name ="黑体"
- self.contents.draw_text(30+3, -2, 45, 20, @x.to_s, 0)
- self.contents.font.name ="宋体"
- self.contents.draw_text(65-6, -2, 20, 20, "Y:")
- self.contents.font.name ="黑体"
- self.contents.draw_text(80-8, -2, 76, 20, @y.to_s, 0)
- self.z =150
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断文字刷新。节约内存用
- #--------------------------------------------------------------------------
- def judge
- return true if @x != $game_player.x
- return true if @y != $game_player.y
- return true if @id != $game_map.map_id
- return false
- end
- end
复制代码