查看: 3993|回复: 1

[原创发布] 事件与事件接触触发事件

[复制链接]
梦石
0
星屑
382
在线时间
235 小时
注册时间
2009-2-13
回帖
416
发表于 2012-1-20 15:12:26 | 显示全部楼层 |阅读模式

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

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

×
这两天一直忙着研究新系统……但什么也没弄成,不过刚才在制作战争游戏的时候弄了一个事件接触的,刚刚弄好,已经可以启动了,就是不知道不满足条件的时候怎么停止……
脚本:
  1. class Game_Event < Game_Character
  2.   alias hr_check_event_trigger_touch check_event_trigger_touch
  3.   def check_event_trigger_touch(x,y)
  4.     if @event.name[0..4] == "友军"
  5.       for i in $game_map.events.values
  6.         $game_variables[1] = $game_map.events[@event].x
  7.         $game_variables[2] = $game_map.events[@event].y
  8.         
  9.       end
  10.     else
  11.       if @event.name[0..4] == "敌军"
  12.       for i in $game_map.events.values
  13.         $game_variables[3] = $game_map.events[@event].x
  14.         $game_variables[4] = $game_map.events[@event].y
  15.       end
  16.     end
  17.   end
  18.   @hc = ($game_variables[1] - $game_variables[3]).abs
  19.   @zc = ($game_variables[2] - $game_variables[4]).abs
  20.   if (@trigger == 2 and x == $game_player.x and y == $game_player.y) or (@hc = 1 and @zc = 0)
  21.       # 除跳跃中以外的情况、启动判定就是正面的事件
  22.       if not jumping? and not over_trigger?
  23.        start
  24.       
  25.       end
  26.     else
  27.       
  28.     end
  29.     end
  30. #    hr_check_event_trigger_touch(x,y)
  31.   end
  32. #end
复制代码
新建立两个事件,一个名称要有“敌军”,一个要有“友军”,把其中一个设置成“与事件接触”,再添事件就可以了
范例:
http://www.fengzhong123.ys168.com/(RM工程目录下project8)
Project8.rar (881.3 KB, 下载次数: 430)


【注意】这个版本还不完善,就比如两个事件分开后貌似还会执行,因此各位谁有兴趣可以试着修复一下。
那些人,那些事,等到明白了,也就无所谓了。
我博客:http://blog.sina.com.cn/gy963
梦石
0
星屑
50
在线时间
138 小时
注册时间
2015-6-9
回帖
27
发表于 2016-4-5 21:35:49 | 显示全部楼层
不过,还是谢谢大神  , 辛苦了
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部