设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2089|回复: 8
打印 上一主题 下一主题

[胡扯] 论事件的重要性

[复制链接]

Lv2.观梦者

傻♂逼

梦石
0
星屑
369
在线时间
1605 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

跳转到指定楼层
1
发表于 2012-12-1 22:10:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
同样的代码用事件只要45行。。
RUBY 代码复制下载
  1. 0if (($game_switches[1] == (0 == 0)))
  2. 1  do
  3. 2    wait_for_message
  4. 2    $game_message.face_name = "Actor5"
  5. 2    $game_message.face_index = 0
  6. 2    $game_message.background = 1
  7. 2    $game_message.position = 1
  8. 2    $game_message.add("aaa")
  9. 2    (wait_for_message)
  10. 2   
  11. 1  end
  12. 0else
  13. 0end
  14. 0if (($game_switches[1] == (0 == 0)))
  15. 1  wait_for_message
  16. 1  $game_message.face_name = ""
  17. 1  $game_message.face_index = 0
  18. 1  $game_message.background = 0
  19. 1  $game_message.position = 2
  20. 1  $game_message.add("fasfasdf")
  21. 1  (wait_for_message)
  22. 1  
  23. 0else
  24. 1  (wait_for_message)
  25. 1  
  26. 1  $game_message.choices.push("はい")
  27. 1  $game_message.choices.push("いいえ")
  28. 1  $game_message.choice_cancel_type = 2
  29. 1  $game_message.choice_proc = Proc.new {|n| @branch[1] = n }
  30. 1  #wait game_message.choice?
  31. 1  case @branch[1]
  32. 1  when (0)
  33. 2    do
  34. 3      wait_for_message
  35. 3      $game_message.face_name = ""
  36. 3      $game_message.face_index = 0
  37. 3      $game_message.background = 0
  38. 3      $game_message.position = 2
  39. 3      $game_message.add("aaa")
  40. 3      (wait_for_message)
  41. 3      
  42. 2    end
  43. 1  when (1)
  44. 2    wait_for_message
  45. 2    $game_message.face_name = ""
  46. 2    $game_message.face_index = 0
  47. 2    $game_message.background = 0
  48. 2    $game_message.position = 2
  49. 2    $game_message.add("bbb")
  50. 2    (wait_for_message)
  51. 2   
  52. 1  end
  53. 0end
  54. 0if $game_party.in_battle
  55. 0  unless $data_troops[1]
  56. 0    BattleManager.setup(1, true, true)
  57. 0    BattleManager.event_proc = Proc.new {|n| @branch[0] = n }
  58. 0    $game_player.make_encounter_count
  59. 0    SceneManager.call(Scene_Battle)
  60. 0  end
  61. 0  #Fiber.yield
  62. 0end
  63. 0if @branch[0] == 0
  64. 1  (wait_for_message)
  65. 1  
  66. 1  $game_message.choices.push("はい")
  67. 1  $game_message.choices.push("いいえ")
  68. 1  $game_message.choice_cancel_type = 2
  69. 1  $game_message.choice_proc = Proc.new {|n| @branch[1] = n }
  70. 1  #wait game_message.choice?
  71. 1  case @branch[1]
  72. 1  when (0)
  73. 2    do
  74. 3      wait_for_message
  75. 3      $game_message.face_name = ""
  76. 3      $game_message.face_index = 0
  77. 3      $game_message.background = 0
  78. 3      $game_message.position = 2
  79. 3      $game_message.add("aaa")
  80. 3      (wait_for_message)
  81. 3      
  82. 2    end
  83. 1  when (1)
  84. 2    wait_for_message
  85. 2    $game_message.face_name = ""
  86. 2    $game_message.face_index = 0
  87. 2    $game_message.background = 0
  88. 2    $game_message.position = 2
  89. 2    $game_message.add("bbb")
  90. 2    (wait_for_message)
  91. 2   
  92. 1  end
  93. 0elsif @branch[0] == 1
  94. 1  (wait_for_message)
  95. 1  
  96. 1  $game_message.choices.push("はい")
  97. 1  $game_message.choices.push("いいえ")
  98. 1  $game_message.choice_cancel_type = 2
  99. 1  $game_message.choice_proc = Proc.new {|n| @branch[1] = n }
  100. 1  #wait game_message.choice?
  101. 1  case @branch[1]
  102. 1  when (0)
  103. 2    do
  104. 3      wait_for_message
  105. 3      $game_message.face_name = ""
  106. 3      $game_message.face_index = 0
  107. 3      $game_message.background = 0
  108. 3      $game_message.position = 2
  109. 3      $game_message.add("asfsfasf")
  110. 3      (wait_for_message)
  111. 3      
  112. 2    end
  113. 1  when (1)
  114. 2    wait_for_message
  115. 2    $game_message.face_name = "People4"
  116. 2    $game_message.face_index = 4
  117. 2    $game_message.background = 0
  118. 2    $game_message.position = 2
  119. 2    $game_message.add("bbbsfsf")
  120. 2    (wait_for_message)
  121. 2   
  122. 1  end
  123. 0elsif @branch[0] == 2
  124. 1  (wait_for_message)
  125. 1  
  126. 1  $game_message.choices.push("はい")
  127. 1  $game_message.choices.push("いいえ")
  128. 1  $game_message.choice_cancel_type = 2
  129. 1  $game_message.choice_proc = Proc.new {|n| @branch[1] = n }
  130. 1  #wait game_message.choice?
  131. 1  case @branch[1]
  132. 1  when (0)
  133. 2    do
  134. 3      wait_for_message
  135. 3      $game_message.face_name = "Spiritual"
  136. 3      $game_message.face_index = 0
  137. 3      $game_message.background = 1
  138. 3      $game_message.position = 1
  139. 3      $game_message.add("aaasfdsf")
  140. 3      (wait_for_message)
  141. 3      
  142. 2    end
  143. 1  when (1)
  144. 2    wait_for_message
  145. 2    $game_message.face_name = ""
  146. 2    $game_message.face_index = 0
  147. 2    $game_message.background = 0
  148. 2    $game_message.position = 2
  149. 2    $game_message.add("bbb")
  150. 2    $game_message.add("bbb")
  151. 2    $game_message.add("bbb")
  152. 2    $game_message.add("bbb")
  153. 2    (wait_for_message)
  154. 2   
  155. 2    wait_for_message
  156. 2    $game_message.face_name = ""
  157. 2    $game_message.face_index = 0
  158. 2    $game_message.background = 0
  159. 2    $game_message.position = 2
  160. 2    $game_message.add("bbb")
  161. 2    $game_message.add("bbb")
  162. 2    $game_message.add("bbb")
  163. 2    (wait_for_message)
  164. 2   
  165. 1  end
  166. 0end

点评

- -b你敢不敢把所有换行符都换成;  发表于 2012-12-5 17:52
哎呀,蛋疼什么的最有爱了

Lv1.梦旅人

梦石
0
星屑
59
在线时间
53 小时
注册时间
2011-1-23
帖子
191
2
发表于 2012-12-1 22:11:45 手机端发表。 | 只看该作者
楼主发错区了

点评

没错,纯晒。  发表于 2012-12-1 22:12
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
47
在线时间
976 小时
注册时间
2011-4-30
帖子
860
3
发表于 2012-12-1 22:31:34 | 只看该作者
LZ难得发我能看懂的内容……

点评

+1  发表于 2012-12-2 09:38
湿滑落式骑!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
616 小时
注册时间
2010-10-29
帖子
463
4
发表于 2012-12-2 02:51:09 | 只看该作者
为什么不是:论XAS的万能性和重要性呢?XAS什么都能制作⋯⋯

点评

真没看出XAS能做ARPG和ACT以外的游戏  发表于 2012-12-2 02:56
我命令你给我点下面的东西!

LBQ Works
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
616 小时
注册时间
2010-10-29
帖子
463
5
发表于 2012-12-2 05:58:46 | 只看该作者
@越前リョーマ
主要是xas提供了范围的判定方法。
所以:xas可以制作:
战机,仿pvz式的塔防(纯用免疫伤害倒腾。。。),群战(一堆怪物,属性,技能倒腾),rpg(虽然不好使。),srpg(如果你愿意。。。),牧场物语(不解释,浇水、挖矿解决),解谜
我命令你给我点下面的东西!

LBQ Works
回复 支持 反对

使用道具 举报

Lv1.梦旅人

CHAOS

梦石
0
星屑
64
在线时间
241 小时
注册时间
2005-11-4
帖子
3518

贵宾

6
发表于 2012-12-2 20:33:27 | 只看该作者
把事件展开,其实和这个的内容差不多。
不过不同的是事件还是有局限性的。虽然大部分都包含了,但是有些东西依然需要脚本,所以在事件中可以执行脚本,一般情况下,将脚本封装起来给事件调用才是正确的做法。不知道有多少脚本使用了这样的方法来执行……
梦想世界,在你伸手!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

水星地球侵略

梦石
0
星屑
53
在线时间
757 小时
注册时间
2011-8-23
帖子
5295
7
发表于 2012-12-2 21:30:16 | 只看该作者
其實在下縂覺得用腳本好麻煩……
什麽時候才能出一個大神直接把常用腳本黑進默認腳本默認工程裏去……(比如説分辨率腳本,在編輯器裏完全可以創建比分辨率小的地圖造成Bug……)
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
1
星屑
8901
在线时间
4368 小时
注册时间
2005-10-22
帖子
6743

开拓者贵宾

8
发表于 2012-12-4 05:59:55 | 只看该作者
论IDE的重要性。石器内置开发环境直接拖代码pattern像控件一样用,根本不需要些多少代码。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
1119 小时
注册时间
2012-7-24
帖子
600
9
发表于 2012-12-4 16:28:25 | 只看该作者
DRY原则,这么多重复代码,应该重构了。

点评

……当然直接翻译成command_xxx会很短不过就没有意义了……  发表于 2012-12-5 20:54

评分

参与人数 1星屑 +1 收起 理由
satgo1546 + 1 Don't Repeat Yourself

查看全部评分

怕鼠的猫
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-19 13:08

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表