查看: 2257|回复: 6

[已经解决] 有关于车辆的问题

[复制链接]
梦石
0
星屑
50
在线时间
251 小时
注册时间
2010-7-22
回帖
70
发表于 2015-5-21 08:18:09 | 显示全部楼层 |阅读模式

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

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

×
我最近在自己的游戏里加入了车和坦克。毫无疑问人<车<坦克。
va的人物32 车 我设置的是50 坦克 64 (像素)
我在运行中经常碰到坦克挡了半个身子,或者人直接钻到坦克底下。
有没有办法解决

闇吼者の災悪眷族

梦石
0
星屑
1366
在线时间
2881 小时
注册时间
2014-7-29
回帖
6408
发表于 2015-5-21 10:36:00 | 显示全部楼层
RM并没有厉害到还有智能的体积碰撞,这个要解决是困难的。
需要合理的安排图像大小,用复数个事件拼成一个“大体积”的事件。
当然同时复数个时间一起移动自然会变得很复杂,想要完美解决这个问题需要花费相当的精力。
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-5-21 12:33:56 | 显示全部楼层
本帖最后由 tseyik 于 2015-5-21 12:41 编辑

WHITE-FLUTE Web有個這様的脚本
http://www.whiteflute.org/wfrgss ... lmId=1&pageId=6
LargeCharacter イベント当たり判定調整スクリプト up!

キャラクターの大きさを自動で感知し、当たり判定を調整します。特に巨大なキャラクターを出したいときに有用です。
叧一個
http://forums.rpgmakerweb.com/in ... %98%86-display-fix/
Large Sprite ☆ Display Fix v1.4[pre lang="ruby"]       

    ##-----------------------------------------------------------------------------
    #  Large Sprite ☆ Display Fix v1.3
    #  Created by Neon Black at request of seita
    #  v1.4 - 12.18.14 - Added position tuning
    #  v1.3 - 1.12.14  - Viewport/position issue fixes
    #  v1.1 - 8.18.13  - Fixed an odd lag issue
    #  v1.0 - 8.17.13  - Main script completed
    #  For both commercial and non-commercial use as long as credit is given to
    #  Neon Black and any additional authors.  Licensed under Creative Commons
    #  CC BY 4.0 - http://creativecommons.org/licenses/by/4.0/
    ##-----------------------------------------------------------------------------
     
    ##------
    ## By default, this script only affects the player.  To allow it to affect
    ## an event page as well, add a comment with the tag <large sprite> to the page
    ## of the event you would like to have affected by this.
     
    class Sprite_Character < Sprite_Base
      ##------
      ## The ID of the terrain used to display the large character above ☆ tiles.
      ## If the player is below this tile (y position), the sprite will appear
      ## above all tiles and events from that y position up.  If the player is on
      ## the same tile or above (y position) the event will appear BELOW ☆ tiles
      ## from that position up.
      ##------
      UpperTerrain = 7
     
      ##------
      ## This value is the pixel tuning used to check the location.  This is
      ## because characters tagged with a '!' in their name are drawn lower than
      ## normal characters and are considered to be lower than these.  This causes
      ## the script to think they are on the tile below where they really are and
      ## draw them above tiles they should appear under.
      ##------
      Tuning = -1
     
      alias :cp_011214_update_bitmap :update_bitmap
      def update_bitmap(*args)
        if graphic_changed? && @set_upper_area_sprite
          @force_no_gfx_change = true
        else
          @force_no_gfx_change = false
        end
        cp_011214_update_bitmap(*args)
      end
     
      ## Alias the update method to add in the new graphic check.
      alias :cp_073013_update_pos :update_position
      def update_position(*args)
        cp_073013_update_pos(*args)
        check_encompassed_area if sprite_is_onscreen?
      end
     
      ## Alias the dispose to dispose the upper sprite.
      alias :cp_073013_dispose :dispose
      def dispose(*args)
        @upper_area_sprite.dispose if @upper_area_sprite
        cp_073013_dispose(*args)
      end
     
    #~   ## Alias the graphic changed method to allow the sprite to revent to what it
    #~   ## was during the last frame.  This allows the check to work again.
    #~   alias :cp_073013_graphic_changed? :graphic_changed?
    #~   def graphic_changed?(*args)
    #~     cp_073013_graphic_changed?(*args) || @set_upper_area_sprite
    #~   end
     
      ## Check if the sprite is onscreen.  Reduces redundant drawing.
      def sprite_is_onscreen?
        return false if @character.is_a?(Game_Vehicle) || @character.is_a?(Game_Follower)
        return false unless @character.is_a?(Game_Player) || @character.large_sprite
        return false if @character.screen_z >= 200
        top_left, bot_right = get_edge_corner_dis
        return false if top_left[0] > Graphics.width
        return false if top_left[1] > Graphics.height
        return false if bot_right[0] < 0
        return false if bot_right[1] < 0
        return true
      end
     
      ## Get the top left and bottom right positions.
      def get_edge_corner_dis
        top_left = [self.x - self.ox, self.y - self.oy]
        bot_right = [top_left[0] + self.width, top_left[1] + self.height]
        return [top_left, bot_right]
      end
     
      ## Long method that checks each position and draws the upper sprite.
      def check_encompassed_area
        if @set_upper_area_sprite && !@force_no_gfx_change
          old_src = self.src_rect.clone
          self.bitmap = @old_bitmap
          self.src_rect = old_src
        end
        @set_upper_area_sprite = false
        top_left, bot_right = get_edge_corner_dis
        last_x, last_y, copy_region = nil, nil, 0
        map_xd, map_yd = $game_map.display_x * 32, $game_map.display_y * 32
        total_height = (self.height + @character.jump_height).round
        self.width.times do |x|
          xp = map_xd.to_i + top_left[0] + x
          unless xp / 32 == last_x
            last_x = xp / 32
            last_y, copy_region = nil, 0
            total_height.times do |y|
              yp = map_yd.to_i + bot_right[1] + @character.jump_height - y + Tuning
              next if yp.to_i / 32 == last_y
              last_y = yp.to_i / 32
              if last_y == (@character.screen_y + @character.jump_height + Tuning +
                            map_yd).to_i / 32
                break if $game_map.terrain_tag(last_x, last_y) == UpperTerrain
                next
              end
              next if $game_map.terrain_tag(last_x, last_y) != UpperTerrain
              copy_region = [self.height, total_height - y + 1].min
              set_upper_sprite
              break
            end
          end
          next if copy_region == 0
          rect = Rect.new(src_rect.x + x, src_rect.y, 1, copy_region)
          @upper_area_sprite.bitmap.blt(x, 0, self.bitmap, rect)
          self.bitmap.clear_rect(rect)
        end
        if !@set_upper_area_sprite && @upper_area_sprite
          @upper_area_sprite.visible = false
        end
      end
     
      ## Creates the upper sprite that's a copy of the current sprite.
      def set_upper_sprite
        return if @set_upper_area_sprite
        @upper_area_sprite ||= Sprite.new
        @upper_area_sprite.bitmap = Bitmap.new(self.width, self.height)
        props = ["x", "y", "ox", "oy", "zoom_x", "zoom_y", "angle", "mirror",
                 "bush_depth", "opacity", "blend_type", "color", "tone", "visible",
                 "viewport"]
        props.each do |meth|
          @upper_area_sprite.method("#{meth}=").call(self.method(meth).call)
        end
        @upper_area_sprite.z = 200
        @set_upper_area_sprite = true
        @old_bitmap, old_src_rect = self.bitmap, self.src_rect.clone
        self.bitmap = Bitmap.new(@old_bitmap.width, @old_bitmap.height)
        self.bitmap.blt(0, 0, @old_bitmap, @old_bitmap.rect)
        self.src_rect = old_src_rect
      end
    end
     
    class Game_Event < Game_Character
      attr_reader :large_sprite
     
      alias :cp_081713_setup_page_settings :setup_page_settings
      def setup_page_settings(*args)
        cp_081713_setup_page_settings(*args)
        get_large_sprite_conditions
      end
     
      def get_large_sprite_conditions
        @large_sprite = false
        return if @list.nil? || @list.empty?
        @list.each do |line|
          next unless line.code == 108 || line.code == 408
          case line.parameters[0]
          when /<large sprite>/i
            @large_sprite = true
          end
        end
      end
    end

[/pre]

点评

请问能稍微说明下吗?弄了半天还是不成功……  发表于 2015-5-22 08:51
_(:з」∠)_ 原来有这样的东西。  发表于 2015-5-21 18:00

评分

参与人数 2星屑 +160 收起 理由
VIPArcher + 150 认可答案
szcszc156 + 10 我很赞同

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
251 小时
注册时间
2010-7-22
回帖
70
 楼主| 发表于 2015-5-21 13:49:07 | 显示全部楼层
tseyik 发表于 2015-5-21 12:33
WHITE-FLUTE Web有個這様的脚本
http://www.whiteflute.org/wfrgss/?mode=view&realmId=1&pageId=6
LargeCh ...

不错哦,简单的说。默认的是主角,配角需要加脚本才可以。
谢谢前辈
回复

使用道具 举报

梦石
0
星屑
50
在线时间
251 小时
注册时间
2010-7-22
回帖
70
 楼主| 发表于 2015-5-21 21:56:22 | 显示全部楼层
tseyik 发表于 2015-5-21 12:33
WHITE-FLUTE Web有個這様的脚本
http://www.whiteflute.org/wfrgss/?mode=view&realmId=1&pageId=6
LargeCh ...

抱歉,前辈可以出个范例么
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-5-22 10:24:44 | 显示全部楼层
Large Sprite ☆ Display Fix v1.4
Image001.png
Image002.png
Image003.png
Image005.png
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-5-22 11:01:38 | 显示全部楼层
本帖最后由 tseyik 于 2015-5-22 11:09 编辑

LargeCharacter イベント当たり判定調整スクリプト

base.rb放在素材最上方
main.rb main之前
largecharaVXAce.rb上面二脚本之間

無脚本
重叠
Image003.png
過来了
Image004.png
加上脚本
不重叠
Image002.png
過不来
Image001.png

Project35.rar (321.59 KB, 下载次数: 62)

点评

谢谢,谢谢。真不知道怎么感谢了  发表于 2015-5-22 11:20
拜谢  发表于 2015-5-22 11:06
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部