- 累计送礼:
- 0 个
- 累计收礼:
- 0 个
TA的每日心情 | 开心 昨天 18:01 |
---|
签到天数: 114 天 连续签到: 4 天 [LV.6]常住居民II

管理员
  
- VIP
- 6
- 卡币
- 10632
- OK点
- 16
- 推广点
- 0
- 同能卷
- 0
- 积分
- 13401


|
实现了改版的菜单。
效果图:
拥有滑动效果等。本来是用在我的游戏里的,因为我的游戏估计只有一个人,而且省去了部分内容,例如状态,特技等,以后会有相应的扩展版。
左边空着的地方是状态栏,但是还没有实现,过一会儿就可以了。
@Index
@map
@Person - class Window_MenuCommand < Window_Selectable def initialize super(650-240+240,60,160,32+84) self.contents = Bitmap.new(width - 32, height - 32) @item_max = 4 @column_max = 2 self.index = 0 self.contents.draw_text(8,4,44,22,"物品") self.contents.draw_text(68,4,44,22,"装备") self.contents.draw_text(8,40,44,22,"记录") self.contents.draw_text(68,40,44,22,"存档") end def update_cursor_rect # 计算光标的宽 cursor_width = 160/ @column_max - 32 # 计算光标坐标 x = @index % @column_max * (cursor_width + 32) y = @index / @column_max * 32 - self.oy # 更新光标矩形 if @index == 0 self.cursor_rect.set(x+4, y, cursor_width+8, 32) end if @index == 1 self.cursor_rect.set(x-16, y, cursor_width+8, 32) end if @index == 2 self.cursor_rect.set(x+4, y+4, cursor_width+8, 32) end if @index == 3 self.cursor_rect.set(x-16, y+4, cursor_width+8, 32) end end endclass Window_MapName < Window_Base def initialize super(0,0,160,64+32) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear text = $game_map.map_id case text when 3 # 主角的家 外观 text = "山村上段" when 4 # 主角的家 内部 text = "自己的家" when 5 # 山路 text = "山路" when 6 # 山村 text = "山村中段" when 7 # 村名家 text = "村民家" when 8 # 山脚 text = "山村脚下" when 9 # 村长家 text = "村长的家" else text = "" end cx = contents.text_size("你在").width self.contents.font.color = normal_color self.contents.draw_text(0, 0, 120-cx-2, 32, "你在:") self.contents.font.color = text_color(6) cw = contents.text_size(text).width self.contents.draw_text(22, 0, cw, 85, text, 2) endend class Scene_Menu def main # 生成命令窗口 @command_window = Window_MenuCommand.new @command_window.opacity = 160 # 生成金钱窗口 @gold_window = Window_Gold.new @gold_window.x = @command_window.x @gold_window.y = @command_window.height + 100 @gold_window.opacity = 160 # 生成所在地窗口 @name_window = Window_MapName.new @name_window.x = @gold_window.x @name_window.y = @gold_window.y + 100 @name_window.opacity = 160 # 生成地图图形 @map = Spriteset_Map.new # 执行过渡 Graphics.transition # 移动窗口 for i in 1..3 @command_window.x -= 80 @gold_window.x -= 80 @name_window.x -= 80 Graphics.update end # 主循环 loop do # 刷新游戏画面 Graphics.update # 刷新输入信息 Input.update # 刷新画面 update # 如果切换画面就中断循环 if $scene != self break end end # 准备过渡 Graphics.freeze # 释放窗口 @command_window.dispose @gold_window.dispose @name_window.dispose # 释放地图 @map.dispose end def update @command_window.update if @command_window.active == true command_update end end def command_update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) case @command_window.index when 0 $scene = Scene_Item.new when 1 $scene = Scene_Equip.new when 2 $scene = Scene_Map.new when 3 $scene = Scene_Save.new end end end end 复制代码
复制代码 本帖来自P1论坛作者天地有正气,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址: https://rpg.blue/forum.php?mod=viewthread&tid=353548 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|