查看: 2203|回复: 2

[已经解决] 怎么写开关脚本【地图显示变量】

  [复制链接]
梦石
0
星屑
50
在线时间
134 小时
注册时间
2009-3-29
回帖
376
发表于 2011-10-21 23:24:15 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
请问怎么写开关脚本?

我想在这个脚本里加个开关   打开[n]号开关开启,关闭则不显示
  1. class Window_hpWindow < Window_Base
  2. def initialize
  3. super(0,0,600,600)
  4. self.opacity = 0
  5. self.visible = false
  6. refresh
  7. end
  8. def refresh
  9. self.contents.clear
  10. draw_icon(498,0,0)#在此修改图标,第一个数字是图标编号
  11. self.contents.draw_text(20, 0, 60, WLH, $game_variables[9],2)
  12. draw_icon(504,0,20)#在此修改图标,第一个数字是图标编号
  13. self.contents.draw_text(20, 20, 60, WLH, $game_variables[10],2)
  14. end
  15. end
  16. class Scene_Map < Scene_Base
  17. alias hpWindow_start start
  18. alias hpWindow_update
  19. update
  20. alias hpWindow_terminate terminate
  21. def start
  22. hpWindow_start
  23. @hpWindow = Window_hpWindow.new
  24. end
  25. def update
  26. #@hpWindow.update
  27. @hpWindow.refresh
  28. @hpWindow.visible = true
  29. hpWindow_update
  30. end
  31. def terminate
  32. hpWindow_terminate
  33. @hpWindow.dispose
  34. end
  35. end
复制代码
黑之结界勇士

醉啸 长风万里

梦石
0
星屑
6517
在线时间
6617 小时
注册时间
2007-12-16
回帖
4301

贵宾

发表于 2011-10-22 08:04:57 | 显示全部楼层
本帖最后由 仲秋启明 于 2011-10-22 12:36 编辑

第五行:self.visible = $game_switches[n]
28行:@hpWindow.visible = $game_switches[n]

点评

改28行的比较好吧。  发表于 2011-10-22 11:34

还在龟速填坑中
回复

使用道具 举报

梦石
0
星屑
50
在线时间
134 小时
注册时间
2009-3-29
回帖
376
 楼主| 发表于 2011-10-22 22:48:04 | 显示全部楼层
感激我要慢慢接近脚本
黑之结界勇士
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部