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

Project1

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

[有事请教] manually_group_them_up如何将以下脚本在窗口里处理

[复制链接]

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
跳转到指定楼层
1
发表于 2023-5-16 14:35:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
在窗口里安命令处理
RUBY 代码复制
  1. def manually_group_them_up#手动定义组主题
  2.     #各种刷新
  3.     Graphics.update
  4.     Input.update
  5.     @spriteset.update
  6.     #改变画面颜色
  7.     $game_screen.start_tone_change(Tone.new(@efs_tone_R,@efs_tone_G,@efs_tone_B), 20)
  8.     #等待一会儿   
  9.  
  10.     wait_a_moment(true)
  11.  
  12.     #开启消息
  13.     Notification.show
  14.  
  15.     for groups in @team_groups
  16.     next unless groups.aviliable?
  17.     groups.calculate_rect_size(@target_d)
  18.       if @target_d == 4 or @target_d == 6
  19.         if groups.get_length > @team_spawn_height or groups.get_height > @team_spawn_width
  20.           Notification.post(groups.name+"队伍过于庞大无法手动布阵!")
  21.           next
  22.         end
  23.       else
  24.         if groups.get_length > @team_spawn_width or groups.get_height > @team_spawn_height
  25.           Notification.post(groups.name+"队伍过于庞大无法手动布阵!")
  26.           next
  27.         end  
  28.       end  
  29.  
  30.       #通知。邮递                      组。名称
  31.       Notification.post("正在手动部署"+groups.name+",请选择一个一个部署地点。")
  32.       #让用户为派生(组)选择目标
  33.       let_user_choose_a_goal_for_spawn(groups)
  34.       flush_map_makers #平面地图绘制器
  35.     end
  36.    # 取消使地图移动(@团队显示区域)
  37.     cancel_make_map_move(@team_display_area)
  38.    # 取消使地图移动( @efs团队生成)
  39.     cancel_make_map_move(@efs_team_spawn)
  40.     flush_map_makers #平面地图绘制器
  41.  
  42.  
  43.  
  44.   end
  45.   #定义让用户为出生(组)选择一个目标
  46.   def let_user_choose_a_goal_for_spawn(group)
  47.     # 演奏确定 SE
  48.     $game_system.se_play($data_system.decision_se)
  49.     #临时存储=$游戏玩家。字符名称
  50.     temp_storage = $game_player.character_name
  51.     #最终x=无[1,2,3,4,5]
  52.     final_x = nil
  53.   #  final_x = [11,14,17,20,20]
  54.     #最终y=无[1,2,3,4,5]
  55.   #  final_y = [20,23,20,17,29]
  56.     final_y = nil
  57.     #cp=组.队长
  58.     cp = group.captain
  59.     x = cp.x
  60.     y = cp.y
  61.    # cp.转向战斗者(cp.找到最近的敌人)
  62.     cp.turn_toward_fighter(cp.find_closest_enermy)
  63.      #$游戏玩家。字符名称=cp.字符名称
  64.      $game_player.character_name = cp.character_name
  65.      #游戏玩家。移动(X,Y)
  66.      $game_player.moveto(x,y)
  67.      #$游戏玩家。透明=错误
  68.      $game_player.transparent = false
  69.      #游戏玩家方向= cp.方向
  70.      $game_player.direction = cp.direction
  71.  
  72.       loop do #循环 do
  73.        pl = $game_player#游戏玩家
  74.       # @efs最后一个实数x=pl.实数x
  75.        @efs_last_real_x = pl.real_x
  76.       # @efs最后一个实数y=pl.实数y
  77.        @efs_last_real_y = pl.real_y
  78.        #游戏系统更新
  79.        $game_system.update
  80.  
  81.        #游戏_屏幕更新
  82.        $game_screen.update
  83.        @spriteset.update#精灵集更新
  84.        Input.update #输入更新
  85.       # _更新生成(组)的命令和输入
  86.        _update_comand_input_for_spawn(group)
  87.        Graphics.update#图形更新
  88.  
  89.         if Input.trigger?(Input::C)#如果输入触发器?(输入::C)
  90.           if if_user_can_deploy(group)#if-if用户可以部署(组)
  91.           # 演奏确定 SE
  92.           $game_system.se_play($data_system.decision_se)
  93.            #最终x=游戏玩家.x
  94.            final_x = $game_player.x
  95.            ##最终y=游戏玩家.y
  96.            final_y = $game_player.y
  97.             break
  98.           else  
  99.             $game_system.se_play($data_system.buzzer_se)
  100.  
  101.  
  102.           end #user can
  103.         end #if
  104.         if Input.trigger?(Input::B)
  105.             # 演奏取消 SE
  106.             $game_system.se_play($data_system.cancel_se)
  107.           #spawn_groups
  108.           #break
  109.         end
  110.       end #loop
  111.       #游戏玩家。透明度=真如果@玩家控制  
  112.       $game_player.transparent = true if @player_controll
  113.       #$游戏玩家。字符名称=临时存储
  114.       $game_player.character_name = temp_storage
  115.       return final_x, final_y
  116.  
  117.     end #def
  118.  
  119.   #--------------------------------------------------------
  120.   # EFS系统 主初始化函数:
  121.   #--------------------------------------------------------  
  122.   def _update_comand_input_for_spawn(group)
  123.   #-<方向键>------------   
  124.       if Input.repeat?(Input::UP)
  125.         #p $game_screen.tone.red
  126.         if @efs_team_spawn.include?([$game_player.x,$game_player.y-1])
  127.         $game_system.se_play($data_system.cursor_se)
  128.         cancel_make_map_move(@team_display_area)
  129.           $game_player.moveto($game_player.x,$game_player.y-1)
  130.           display_move_able_groups(group)
  131.         else  
  132.         $game_system.se_play($data_system.buzzer_se)
  133.         end  
  134.         return
  135.       end
  136.       if Input.repeat?(Input::DOWN)
  137.         if @efs_team_spawn.include?([$game_player.x,$game_player.y+1])  
  138.         $game_system.se_play($data_system.cursor_se)
  139.         cancel_make_map_move(@team_display_area)
  140.         $game_player.moveto($game_player.x,$game_player.y+1)  
  141.         display_move_able_groups(group)
  142.         else  
  143.        $game_system.se_play($data_system.buzzer_se)
  144.        end  
  145.       return
  146.       end
  147.       if Input.repeat?(Input::RIGHT)  
  148.        if @efs_team_spawn.include?([$game_player.x+1,$game_player.y])  
  149.         $game_system.se_play($data_system.cursor_se)
  150.         cancel_make_map_move(@team_display_area)
  151.           $game_player.moveto($game_player.x+1,$game_player.y)  
  152.          display_move_able_groups(group)
  153.        else  
  154.        $game_system.se_play($data_system.buzzer_se)
  155.        end  
  156.         return
  157.       end
  158.       if Input.repeat?(Input::LEFT)
  159.         if @efs_team_spawn.include?([$game_player.x-1,$game_player.y])  
  160.         $game_system.se_play($data_system.cursor_se)
  161.         cancel_make_map_move(@team_display_area)
  162.           $game_player.moveto($game_player.x-1,$game_player.y)  
  163.          display_move_able_groups(group)
  164.         else  
  165.         $game_system.se_play($data_system.buzzer_se)
  166.         end  
  167.        return
  168.       end  
  169.   end
  170.  
  171.  
  172.  
  173.   def display_move_able_groups(group)
  174.     cp = group.captain
  175.     cp.set_goal_xy($game_player.x,$game_player.y)
  176.     group.set_up_rect(group.captain.direction,1,true,false)
  177.     @team_display_area = group.display_grid_of_indiv
  178.     make_map_move(@team_display_area)
  179.       for f in group.fighter
  180.         f.moveto(f.goal_x,f.goal_y)
  181.         make_map_team_display(f)
  182.       end
  183.  
  184.  
  185.  
  186.   end
  187.  
  188.   def if_user_can_deploy(group)
  189.       for f in group.fighter
  190.         next if f.dead?
  191.         x,y = f.x,f.y
  192.          if not $game_map.passable?(x,y,10,f) or not @efs_team_spawn.include?([x,y])
  193.           return false
  194.         end
  195.       end
  196.     return true
  197.  
  198.  
  199.   end  
  200.  
  201.   def make_map_team_display(f)
  202.     x,y = f.x,f.y
  203.     if $game_map.passable?(x,y,10,f) and  @efs_team_spawn.include?([x,y])
  204.     @spriteset.flash_data[x, y] = 0xfe2af2
  205.     else
  206.       @spriteset.flash_data[x, y] = 0xf84
  207.     end  
  208.       #@efs_team_spawn
  209.       #0xf84
  210.   end
  211.  
  212.   def flush_map_makers
  213.     for x in 0..$game_map.width-1
  214.       for y in 0..$game_map.height-1
  215.          @spriteset.flash_data[x, y] = 0
  216.       end  
  217.     end  
  218.  
  219.   end
  220.  
  221.  
  222. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-27 22:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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