Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Zamknięty przez: Ayene
Pią 02 Lip, 2010 21:53
Mode7
Autor Wiadomość
Poster27 




Preferowany:
RPG Maker VX

Pomógł: 22 razy
Dołączył: 27 Kwi 2010
Posty: 136
Skąd: że znowu
Wysłany: Wto 15 Cze, 2010 20:39
Mode7
Czy mógłby mi ktoś przepisać skrypt z dema , do którego link umieszczony jest w opisie filmiku na YouTube http://www.youtube.com/wa...feature=related .Ja niestety nie mogę tego zrobić bo mam inną wersje VX'a.I powiedzcie czy można zrobić by przy chodzeniu bohaterem też był taki widok.

EDIT: O przepisanie już nie proszę, ale chciałbym wiedzieć czy można bohaterem tak chodzić.
 
 
dawidos989 




Preferowany:
RPG Maker VX

Pomógł: 6 razy
Dołączył: 04 Lis 2009
Posty: 87
Skąd: z tond
Wysłany: Czw 24 Cze, 2010 16:43
ja mam tom skrypte
________________________
Pomogłem? Daj "
 
 
cj2 




Preferowany:
RPG Maker VXAce

Ranga RM:
1 gra

Pomógł: 6 razy
Dołączył: 07 Mar 2010
Posty: 261
Skąd: Gliwice
Wysłany: Czw 24 Cze, 2010 18:02
http://www.ultimateam.pl/viewtopic.php?t=2583
Należy wszystko wkleić nie w jednym
定数定義
Spoiler:

Kod:
module Game
  #ゲーム画面の定義
  DISPLAY_WIDTH = 544
  DISPLAY_HEIGHT = 416
 
  #縦横チップ数の定義
  DISPLAY_CHIP_WIDTH = DISPLAY_WIDTH / 32
  DISPLAY_CHIP_HEIGHT = DISPLAY_HEIGHT / 32
 
  #実座標の定義(よくわからないがマップ座標 * 256が定義らしい)
  DISPLAY_REAL_WIDTH = DISPLAY_CHIP_WIDTH * 256
  DISPLAY_REAL_HEIGHT = DISPLAY_CHIP_HEIGHT * 256
 
end

#記述ルール

  #定義済みの処理への追加(元の処理を損ねない)
  #--------------------------------------------------------------------------
  # ● 処理
  #--------------------------------------------------------------------------

  #定義済みの処理を上書きする変更
  #--------------------------------------------------------------------------
  # ● 処理 (上書き)
  #--------------------------------------------------------------------------

  #新規処理
  #--------------------------------------------------------------------------
  #     処理
  #--------------------------------------------------------------------------


TileBitmap
Spoiler:

Kod:


#タイルを並べられる
class Rect
  def set_pos(x, y)
    self.x = x
    self.y = y
  end

  def set_size(w, h)
    self.width = w
    self.height = h
  end 
end



#==============================================================================
# ■ TileBitmap
#------------------------------------------------------------------------------
#  
#==============================================================================
class TileBitmap < Bitmap
  def initialize(width, height, tilemap)
    super(width, height)
    @tilemap = tilemap
    @map_width = width / 32
    @map_height = height / 32
    @buffer = Bitmap.new(width, height)
    @map_x = 999
    @map_y = 999
    @anime_face = 0
    @anime_face_x = 0
    @anime_speed = 30
    @anime_count = @anime_speed
    @main_autotile = MainAutotile.new(self, @tilemap.bitmaps)
    @temprect = Rect.new(0,0,32,32)
    @range = -1..1
  end
 
  #--------------------------------------------------------------------------
  def dispose
    @buffer.dispose
    @main_autotile.dispose
    super
  end

 #--------------------------------------------------------------------------
  def set_tile(id, dx, dy)
    case id
      when 2048...2816
        set_auto_tile1(id - 2048, dx, dy)
      when 2816...4352
        chipid, atid = (id -2816).divmod(48)
        @main_autotile.draw(1,
          atid, (chipid & 7) << 6 , (chipid >> 3) * 96, dx, dy, chipid)
      when 4352...5888
        set_auto_tile2(@tilemap.bitmaps[2], id - 4352, dx, dy)
      when 5888...8000
        set_auto_tile2(@tilemap.bitmaps[3], id - 5888, dx, dy)
      when 1536...2048
        set_normal_tile(@tilemap.bitmaps[4], id - 1536, dx, dy)
      when 1...256
        #0&#12399;&#26360;&#12365;&#36796;&#12414;&#12394;&#12356;
        set_normal_tile(@tilemap.bitmaps[5], id, dx, dy)
      when 256...512
        set_normal_tile(@tilemap.bitmaps[6], id - 256, dx, dy)
      when 512...768
        set_normal_tile(@tilemap.bitmaps[7], id - 512, dx, dy)
      when 768...1536
        set_normal_tile(@tilemap.bitmaps[8], id - 768, dx, dy)
    end
  end
 
 #--------------------------------------------------------------------------
  def set_normal_tile(bitmap, id, dx, dy)
    if(id < 128)
      @temprect.set((id & 7) << 5, id >> 3 << 5, 32, 32)
    else
      id = id - 128
      @temprect.set(((id & 7) + 8) << 5, id >> 3  << 5, 32, 32)
    end
    blt(dx, dy, bitmap, @temprect)
  end

 #--------------------------------------------------------------------------
  def set_auto_tile1(id, dx, dy)
    chip_id, atid = id.divmod(48)

    f = @anime_face
    fx = @anime_face_x
    case chip_id
      when 0
        @main_autotile.draw(0, atid, fx, 0, dx, dy, f)
      when 1
        @main_autotile.draw(0, atid, fx, 96, dx, dy, 8 + f)
      when 2
        @main_autotile.draw(0, atid, 192, 0, dx, dy, 3)
#        blt(dx, dy, @tilemap.bitmaps[0], Rect.new(192, 0, 32, 32))
      when 3
        blt(dx, dy, @tilemap.bitmaps[0], Rect.new(192, 96, 32, 32))
      when 4
        @main_autotile.draw(0, atid, 256 + fx, 0, dx, dy, f + 4)
      when 6
        @main_autotile.draw(0, atid, 256 + fx, 96, dx, dy, f + 12)
      when 8
        @main_autotile.draw(0, atid, fx, 192, dx, dy, f + 16)
      when 10
        @main_autotile.draw(0, atid, fx, 288, dx, dy, f + 20)
      when 12
        @main_autotile.draw(0, atid, 256 + fx, 192, dx, dy, f + 24)
      when 14
        @main_autotile.draw(0, atid, 256 + fx, 288, dx, dy, f + 28)
    end
   
  end
 
  #--------------------------------------------------------------------------
  # &#12450;&#12491;&#12513;&#12540;&#12471;&#12519;&#12531;&#12479;&#12452;&#12523;&#12391;&#12354;&#12428;&#12400;true&#12434;&#36820;&#12377;
  # Params: tile_id &#12479;&#12452;&#12523;&#30058;&#21495;
  # Return: &#12450;&#12491;&#12513;&#12540;&#12471;&#12519;&#12531;&#12479;&#12452;&#12523;&#12391;&#12354;&#12428;&#12400;True
  #--------------------------------------------------------------------------
  def anime_tile? (tile_id)
    return tile_id && tile_id.between?(2048, 2815)
  end
 
  #--------------------------------------------------------------------------
  def set_auto_tile2(bitmap, id, dx, dy)
    #&#12458;&#12540;&#12488;&#12479;&#12452;&#12523;ID
    autotile_id = id % 48
   
    #&#20206;&#12395;&#20843;&#20998;&#21106;&#12375;&#12390;&#34920;&#31034;
    real = id  / 48
    @temprect.set((real & 7) << 5, real >> 3 << 5, 32, 32)
    blt(dx, dy, bitmap, @temprect)
  end

  #--------------------------------------------------------------------------
  # &#12510;&#12483;&#12503;&#19978;&#12398;&#24231;&#27161;&#12363;&#12425;&#12510;&#12483;&#12503;&#12434;&#12475;&#12483;&#12488;
  #--------------------------------------------------------------------------
  def set_map(ox, oy)
    return update_anime(ox, oy) if @map_x == ox && @map_y == oy

    #&#35492;&#24046;&#12364;1&#12398;&#26178;&#12399;&#12496;&#12483;&#12501;&#12449;&#12363;&#12425;&#12510;&#12483;&#12503;&#12434;&#12467;&#12500;&#12540;&#12289;&#19981;&#36275;&#20998;&#12398;&#12415;&#25551;&#30011;&#12377;&#12427;
    #&#12371;&#12398;&#12392;&#12365;&#12450;&#12491;&#12513;&#12459;&#12454;&#12531;&#12488;0&#12394;&#12425;&#12450;&#12491;&#12513;&#12434;&#26356;&#26032;&#12377;&#12427;
    dir_x = ox - @map_x
    dir_y = oy - @map_y
    update_anime(ox - dir_x, oy - dir_y)
    #&#12523;&#12540;&#12503;&#12398;&#32771;&#24942;&#12394;&#12375;
    #&#12510;&#12483;&#12503;W&#12392;dirx&#12398;&#32118;&#23550;&#20516;&#12364;&#21516;&#12376;&#12394;&#12425;+&#12394;&#12425;&#12540;1&#12540;&#12394;&#12425;1&#12395;&#12377;&#12427;
    if @range === dir_x && @range === dir_y
      case
        when dir_x.zero? && dir_y == -1
          copy_from_buffer(Rect.new(0, 0, width, height - 32), 0, 32)
          #&#19978;&#31471;&#12398;&#19968;&#21015;&#12434;&#25551;&#12367;
          draw_map(0, 0, ox, oy,
            ox + @map_width, oy + 1)
        when dir_x.zero? && dir_y == 1
          copy_from_buffer(Rect.new(0, 32, width, height - 32), 0, 0)
          #&#19979;&#31471;&#12398;&#19968;&#21015;&#12434;&#25551;&#12367;
          draw_map(0, height - 32, ox, oy + @map_height - 1,
            ox + @map_width, oy + @map_height)
        when dir_y.zero? && dir_x == -1
          copy_from_buffer(Rect.new(0, 0, width - 32, height), 32, 0)
          #&#24038;&#31471;&#12398;&#19968;&#21015;&#12434;&#25551;&#12367;
          draw_map(0, 0, ox, oy,
            ox + 1, oy + @map_height)
        when dir_y.zero? && dir_x == 1
          copy_from_buffer(Rect.new(32, 0, width - 32, height), 0, 0)
          #&#21491;&#31471;&#12398;&#19968;&#21015;&#12434;&#25551;&#12367;
          draw_map(width - 32, 0, ox + @map_width - 1, oy,
            ox + @map_width, oy + @map_height)

#        when dir_y = -1 && dir_x = -1
#        when dir_y = -1 && dir_x = 1
#        when dir_y = 1 && dir_x = -1
#        when dir_y = 1 && dir_x = 1
      end
     
    else
      #&#20840;&#25551;&#30011;
      #&#12450;&#12491;&#12513;&#12459;&#12454;&#12531;&#12488;&#12434;&#32771;&#24942;&#12377;&#12427;&#12371;&#12392;
      clear
      draw_map(0, 0, ox, oy, ox + @map_width, oy + @map_height)
    end
    @map_x = ox
    @map_y = oy
    return true
  end
 
  def next_anime_face
    @anime_face = (@anime_face + 1) % 3
    @anime_face_x = @anime_face << 6
  end
 
 
  #--------------------------------------------------------------------------
  # &#12496;&#12483;&#12501;&#12449;&#12363;&#12425;&#12467;&#12500;&#12540;
  #ox,oy &#24038;&#19978;&#12398;&#24231;&#27161;(&#38306;&#25968;&#20869;&#12391;&#30011;&#38754;&#22806;&#35036;&#27491;&#12434;&#12363;&#12369;&#12427;)
  #--------------------------------------------------------------------------
  def update_anime(ox, oy)
    if @anime_count.zero?
      next_anime_face

      x = y = dx = dy = 0
      data = $game_map.data
      map_each(ox+3, oy, ox + @map_width-3, oy + @map_height) do |x, y, dx, dy|
        #&#12524;&#12452;&#12516;&#12540;1&#12398;&#12450;&#12491;&#12513;&#12479;&#12452;&#12523;&#12399;&#12450;&#12491;&#12513;&#12479;&#12452;&#12523;&#12398;&#19978;&#12395;&#12354;&#12427;
        #&#12524;&#12452;&#12516;&#12540;2&#12395;&#12450;&#12491;&#12513;&#12479;&#12452;&#12523;&#12399;&#28961;&#12356;
        #&#12424;&#12387;&#12390;0&#12398;&#12415;&#12481;&#12455;&#12483;&#12463;&#12377;&#12428;&#12400;&#12424;&#12356;
        if anime_tile?(data[x, y, 0])
          for z in 0..2
            tile_id = data[x, y, z]
            set_tile(tile_id, 96 + dx, dy) if tile_id
          end
        end
      end   
     
      @anime_count = @anime_speed
      return true
    else
      @anime_count -= 1
      return false
    end
  end
 
  #--------------------------------------------------------------------------
  # &#12496;&#12483;&#12501;&#12449;&#12363;&#12425;&#12467;&#12500;&#12540;
  #--------------------------------------------------------------------------
  def copy_from_buffer(r,  bx, by)
    @buffer.clear
    @buffer.blt(0, 0, self, self.rect)

    clear
    blt(bx, by, @buffer, r)
  end

  #--------------------------------------------------------------------------
  def draw_map(tox, toy, ox, oy, xmax, ymax)
    data = $game_map.data
    x = y = dx = dy = 0
    map_each(ox, oy, xmax, ymax) do |x, y, dx, dy|
      for z in 0..2
        tile_id = data[x, y, z]
        set_tile(tile_id, tox + dx, toy + dy) if tile_id
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # &#12510;&#12483;&#12503;&#12398;&#29305;&#23450;&#31623;&#25152;&#12395;&#23550;&#12375;&#12390;&#20966;&#29702;&#12434;&#34892;&#12358;
  # z&#36600;&#12395;&#12388;&#12356;&#12390;&#12399;&#32771;&#24942;&#12375;&#12394;&#12356;&#12383;&#12417;&#20966;&#29702;&#12502;&#12525;&#12483;&#12463;&#20596;&#12391;&#23455;&#35013;&#12398;&#12371;&#12392;
  # Params:
  #   sx start_x
  #   sy start_y
  #   ex end_x
  #   ey end_y
  # Yield: |x, y, dx, dy| &#12510;&#12483;&#12503;&#12398;x,y&#12289;0&#12363;&#12425;&#25968;&#12360;&#12383;&#25551;&#30011;&#20808;&#12398;x,y
  #--------------------------------------------------------------------------
  def map_each(sx, sy, ex, ey)
    mapw = $game_map.width
    maph = $game_map.height
    isv = $game_map.loop_vertical?
    ish = $game_map.loop_horizontal?
    draw_y = 0
    for y in sy...ey
      y = get_looped_point(y, maph) if isv
      draw_x = 0
      for x in sx...ex
        x = get_looped_point(x, mapw) if ish
        yield(x, y, draw_x, draw_y)
        draw_x += 32
      end
      draw_y += 32
    end   
  end
 
  #&#12523;&#12540;&#12503;&#12434;&#32771;&#24942;&#12375;&#12390;&#24231;&#27161;&#12434;&#21462;&#24471;(x,y&#23550;&#24540;)
  #val&#12288;&#29694;&#22312;&#20301;&#32622;&#12288; size&#12288;&#12510;&#12483;&#12503;&#12469;&#12452;&#12474;
#--------------------------------------------------------------------------
  def get_looped_point(val, size)
    return case
      when size <= val then val -= size
      when val < 0 then val += size
      else val
    end
  end
end


TileSprite
Spoiler:

Kod:

class TileSprite < Sprite
  def initialize(width, height, tilemap, viewport)
    super(viewport)
    self.bitmap = Bitmap.new(Game::DISPLAY_WIDTH, Game::DISPLAY_HEIGHT)
    self.x = 0
    self.y = 0
    self.ox = 0
    self.oy = 0
    self.z = 0
    @backbuffer = TileBitmap.new(width, height, tilemap)
    @bg = Sprite.new(viewport)
    @bg.z = 1
    @bg.blend_type = 1
    @bg.bitmap = Cache.picture('bg')
   
    @mapx = -999
    @mapy = -999

    @x_plus = (width - Game::DISPLAY_WIDTH) / 2
    @y_plus =  128 #(height - Game::DISPLAY_HEIGHT) / 2
   
    @draw_count = false
   
    @x_table = Table.new(416)
    @y_table = Table.new(416)
    set_render_table(45)
  end

  def dispose
    @bg.dispose if @bg
    @backbuffer.dispose if @backbuffer
    self.bitmap.dispose if self.bitmap
    super
  end
 
  def hide
    self.visible = false
    @bg.visible = false
  end
 
  def show
    self.visible = true
    @bg.visible = true
  end
 

  def set_render_table(angle)
    return false if angle == @angle
    @angle = angle
    d = 400.0
    rad = angle *  Math::PI / 180
    sina = Math.sin(rad)
    cosa = Math.cos(rad)

    x_zoom = 272 * 1.5
    for i in 0...416

      sy = 208 - i

      unless angle == 90
        aaa = sy == 0 ? 0: (90 - angle) / 208.0 * sy
        aaa = sy < 0 ? 90 + aaa : 90 - aaa
        rad = aaa *  Math::PI / 180
        sy = (sy / Math.sin(rad)) * (d + (sy * Math.cos(rad))) / d
      end
   
     
      to_y = sina.zero? ? -256: ((sy / sina) * (d + (sy * cosa)) / d).round
      #to_y = sina.zero? ? -256: ((sy / sina) * (d + (sy * cosa)) / d).round
      @y_table[i] = 208 - to_y

      #y=1&#12398;&#12392;&#12365;&#12398;x
      to_x = (-x_zoom * (d + (sy * -cosa)) / d) + x_zoom
      @x_table[i] = - (272 * to_x / (272 - to_x )).round
    end
   
    #&#19968;&#24540;bg&#12398;&#12469;&#12452;&#12474;&#12418;&#12363;&#12360;&#12392;&#12367;
    #90&#12364;0&#12391;45&#12364;100
    case @angle
      when 45
        @bg.zoom_y = 1.0
      when 90
        @bg.zoom_y = 0.0
      else 
        @bg.zoom_y = (1.0 / 45) * (90 - @angle)
      end
      @bg.opacity = 255 * @bg.zoom_y
    return true 
  end


 
  #&#12510;&#12483;&#12503;&#19978;&#12398;&#24231;&#27161;&#12391;&#35373;&#23450;
  def update_map(ox, oy)
    return unless self.visible

    aox = ($game_map.display_x >> 3 & 31) + @x_plus
    aoy = ($game_map.display_y >> 3 & 31) + @y_plus
 
    ud = set_render_table($game_map.get_angle)
    sd = @backbuffer.set_map(ox, oy)
    return if !sd && !ud && aox == @mapx && aoy == @mapy
    update_bitmap(aox, aoy)
  end
 
  def update_bitmap(aox, aoy)
    @mapx = aox
    @mapy = aoy

    unless aox == @x_plus && aoy == @y_plus
      @draw_count = !@draw_count
      return if @draw_count
   end
   
    bmp = self.bitmap
    bmp.clear
 
    bmph = bmp.height
    bmpw = bmp.width
   
    yt = @y_table
    xt = @x_table
    bb = @backbuffer
    from_r = Rect.new(0, 0, 1 , 1)
    to_r = Rect.new(0, 0, bmpw, 1)
    i = 0
    while i < bmph
      to_y = yt[i]
      if to_y < -@y_plus
        i += 1
        next
      end
       
      to_x = xt[i]
      to_r.y = i
     
      ww = 0
      while i < bmph
        ww += 1
        i += 1
        break unless to_x == xt[i] && to_y + ww == yt[i]
      end
     
       
      to_r.height = ww
      from_r.set(to_x + aox, to_y + aoy, bmpw - to_x - to_x, ww)
      bmp.stretch_blt(to_r, bb, from_r)
    end
  end
 
 
end

class Game_Map
  #--------------------------------------------------------------------------
  # &#9679; &#20844;&#38283;&#12452;&#12531;&#12473;&#12479;&#12531;&#12473;&#22793;&#25968;
  #--------------------------------------------------------------------------
  attr_accessor   :mode3D

  #--------------------------------------------------------------------------
  # &#9679; &#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#21021;&#26399;&#21270;
  #--------------------------------------------------------------------------
  alias a9_003_initialize initialize
  def initialize
    a9_003_initialize
    @mode3D = false
    @angle3D = 45
  end
 
  #--------------------------------------------------------------------------
  def set_angle(v)
    @angle3D = v
  end
 
  #--------------------------------------------------------------------------
  def get_angle
    @angle3D
  end
 
end

class Spriteset_Map

  #--------------------------------------------------------------------------
  # &#9679; &#12499;&#12517;&#12540;&#12509;&#12540;&#12488;&#12398;&#20316;&#25104;
  #--------------------------------------------------------------------------
  alias a9_003_create_viewports create_viewports
  def create_viewports
    a9_003_create_viewports
    @viewport_invisible = Viewport.new(0, 0, 1, 1)
    @viewport_invisible.visible = false
  end
 
  #--------------------------------------------------------------------------
  # &#9679; &#12499;&#12517;&#12540;&#12509;&#12540;&#12488;&#12398;&#35299;&#25918;
  #--------------------------------------------------------------------------
  alias a9_003_dispose_viewports dispose_viewports
  def dispose_viewports
    a9_003_dispose_viewports
   
    @viewport_invisible.dispose
  end
  #--------------------------------------------------------------------------
  # &#9679; &#12479;&#12452;&#12523;&#12510;&#12483;&#12503;&#12398;&#20316;&#25104;
  #--------------------------------------------------------------------------
  alias a9_003_create_tilemap create_tilemap
  def create_tilemap
    a9_003_create_tilemap
    @tilemap.visible = false
    @tile_sprite = TileSprite.new(544+448, 416+128, @tilemap, @viewport1)
    end_3d
  end
 
  #--------------------------------------------------------------------------
  def begin_3d
    @tilemap.viewport = @viewport_invisible
    @mode3d = true
    @tile_sprite.show
  end

  #--------------------------------------------------------------------------
  def end_3d
    @tilemap.viewport = @viewport1
    @mode3d = false
    @tile_sprite.hide
  end

 
  #--------------------------------------------------------------------------
  # &#9679; &#12479;&#12452;&#12523;&#12510;&#12483;&#12503;&#12398;&#35299;&#25918;
  #--------------------------------------------------------------------------
  alias a9_003_dispose_tilemap dispose_tilemap
  def dispose_tilemap
    a9_003_dispose_tilemap
    @tile_sprite.dispose
  end


  #--------------------------------------------------------------------------
  # &#9679; &#12479;&#12452;&#12523;&#12510;&#12483;&#12503;&#12398;&#26356;&#26032;
  #--------------------------------------------------------------------------
  alias a9_003update_tilemap update_tilemap
  def update_tilemap
    g = $game_map
    unless g.mode3D == @mode3d
      @mode3d ? end_3d: begin_3d
    end
    unless @mode3d
      a9_003update_tilemap
    else
      @tile_sprite.update_map((g.display_x >> 8) - 7, (g.display_y >> 8) - 4)
    end
  end
end

#==============================================================================
# &#9632; Game_Vehicle
#------------------------------------------------------------------------------
# &#12288;&#20055;&#12426;&#29289;&#12434;&#25201;&#12358;&#12463;&#12521;&#12473;&#12391;&#12377;&#12290;&#12371;&#12398;&#12463;&#12521;&#12473;&#12399; Game_Map &#12463;&#12521;&#12473;&#12398;&#20869;&#37096;&#12391;&#20351;&#29992;&#12373;&#12428;&#12414;&#12377;&#12290;
# &#29694;&#22312;&#12398;&#12510;&#12483;&#12503;&#12395;&#20055;&#12426;&#29289;&#12364;&#12394;&#12356;&#12392;&#12365;&#12399;&#12289;&#12510;&#12483;&#12503;&#24231;&#27161; (-1,-1) &#12395;&#35373;&#23450;&#12373;&#12428;&#12414;&#12377;&#12290;
#==============================================================================

class Game_Vehicle < Game_Character

  #--------------------------------------------------------------------------
  # &#9679; &#20055;&#12426;&#29289;&#12395;&#20055;&#12427;
  #--------------------------------------------------------------------------
  alias a9_003_get_on get_on
  def get_on
    a9_003_get_on
    $game_map.mode3D = true if @type == 2  # &#39131;&#34892;&#33337;&#12398;&#22580;&#21512;
  end

  #--------------------------------------------------------------------------
  # &#9679; &#12501;&#12524;&#12540;&#12512;&#26356;&#26032;
  #--------------------------------------------------------------------------
  alias a9_003_update update
  def update
    a = @altitude
    a9_003_update
    update_angle(a)
  end
 
  #--------------------------------------------------------------------------
  def update_angle(alti)
    def set_angle
      $game_map.set_angle(90 - (45 / 8 * (@altitude / 4 + 1)))
    end
   
    if @type == 2               # &#39131;&#34892;&#33337;&#12398;&#22580;&#21512;
      if @driving
        if alti < MAX_ALTITUDE
          @altitude == MAX_ALTITUDE ? $game_map.set_angle(45): set_angle
        end
      elsif 0 < alti
        if @altitude.zero?
          $game_map.set_angle(90)
          $game_map.mode3D = false
        else
            set_angle
        end
     
      end
    end

   
  end
end


MainAutotile
Spoiler:

Kod:

#==============================================================================
# &#9632; MainAutotile
#------------------------------------------------------------------------------
# &#12288;Bitmap&#12395;&#28023;&#24418;&#24335;&#12398;&#12458;&#12540;&#12488;&#12479;&#12452;&#12523;&#12434;&#25551;&#12367;&#12463;&#12521;&#12473;
#==============================================================================
class MainAutotile
  def initialize(parent, tilebitmaps)
    super()
    @parent = parent
    @bitmaps = tilebitmaps

    @rect = Rect.new(0, 0, 16, 16)
# 01 buf0
# 23    1
# 45    2
    @lt_buffer = {0=>1, 4=>1, 6=>1, 8=>1, 12=>1, 19=>1, 23=>1, 32=>1, 33=>1}
    @lt_buf_0 = {0=>1, 4=>1, 6=>1, 8=>1, 12=>1}
    @lt_buf_1 = {19=>1, 32=>1}
    @lt_buf_2 = {23=>1,33=>1}
    @lt_1 = {1=>1, 3=>1, 5=>1, 7=>1, 9=>1, 11=>1, 13=>1,
      15=>1, 26=>1, 27=>1, 29=>1, 31=>1, 39=>1}
    @lt_2 = {34=>1, 35=>1, 42=>1, 43=>1, 46=>1 }
    @lt_3 = {20=>1, 21=>1, 22=>1, 36=>1, 37=>1, 45=>1}#23, 33
    @lt_4 = {16=>1, 17=>1, 18=>1, 40=>1, 41=>1, 44=>1}#17..19, 32
    @lt_5 = {2=>1, 4=>1, 8=>1, 10=>1, 14=>1, 24=>1,
      25=>1, 28=>1, 30=>1, 38=>1}#0, 6, 12
     
    @rt_buffer = {27=>1}
    @rt_height = {6=>1, 14=>1, 20=>1, 22=>1, 27=>1, 28=>1, 29=>1}#7
   
    @lb_buffer = {1=>1, 2=>1, 3=>1, 31=>1}
    @lb_width = {1=>1, 2=>1, 3=>1, 12=>1, 14=>1, 16=>1, 17=>1, 26=>1, 31=>1}
   
    make_buffer
  end
 
  #ox oy &#12479;&#12452;&#12523;&#20596;&#12398;&#36578;&#36865;&#20803;&#21407;&#28857;(&#28023;&#24418;&#24335;&#12398;&#12479;&#12452;&#12523;&#12394;&#12425;&#12394;&#12435;&#12395;&#12391;&#12418;&#23550;&#24540;&#20986;&#26469;&#12427;)
  #--------------------------------------------------------------------------
  # &#12513;&#12452;&#12531;(&#28023;&#27083;&#25104;)&#12398;&#12458;&#12540;&#12488;&#12479;&#12452;&#12523;&#12434;&#25551;&#12367;
  # Params:
  #   bmpNo @tilemap.bitmaps&#12398;&#25968;&#20516;(&#36890;&#24120;0&#12363;1)
  #   atid &#12458;&#12540;&#12488;&#12479;&#12452;&#12523;ID
  #   ox &#21462;&#24471;&#12418;&#12392;x
  #   oy &#21462;&#24471;&#12418;&#12392;y
  #   dx &#25551;&#30011;&#20808;x
  #   dy &#25551;&#30011;&#20808;y
  #   bufid &#12496;&#12483;&#12501;&#12449;ID
  #--------------------------------------------------------------------------
  def draw(bmpNo, atid, ox, oy, dx, dy, bufid)
    r = @rect
    r.set_size(16, 16)
    b = @parent
    bw = bufid << 5
    bmps = rect = nil
    return if draw_lt(r, atid, ox, oy, bw) do |bmps, rect|
      b.blt(dx, dy, bmps[bmpNo], rect)
    end
   
    draw_rt(r, atid, ox, oy, bw) do |bmps, rect|
      b.blt(dx + 16, dy, bmps[bmpNo], rect)
    end   

    return if draw_lb(r, atid, ox, oy, bw) do |bmps, rect|
      b.blt(dx, dy + 16, bmps[bmpNo], rect)
    end

    draw_rb(r, atid, ox, oy) do |bmps, rect|
      b.blt(dx + 16, dy + 16, bmps[bmpNo], rect)
    end   
  end

  #--------------------------------------------------------------------------
  def dispose
    @buffers.each do |v|
      v.dispose
    end
  end
 
  #--------------------------------------------------------------------------
  private
 
  #--------------------------------------------------------------------------
  def make_buffer
    @buffers = []
   
    bmp1 = Bitmap.new(1024, 96)
    @buffers[0] = bmp1
    tobmp = @bitmaps[0]
    for i in 0..6
      draw_buffer(tobmp, i * 64, 0, bmp1, i * 32, 0)
    end
    #7&#12398;&#12496;&#12483;&#12501;&#12449;
    for i in 0..6
      draw_buffer(tobmp, i * 64, 96, bmp1, 256 + (i * 32), 0)
    end
    #15&#12398;&#12496;&#12483;&#12501;&#12449;
    for i in [0, 1, 2, 4, 5, 6]
      draw_buffer(tobmp, i * 64, 192, bmp1, 512 + (i * 32), 0)
    end
    for i in [0, 1, 2, 4, 5, 6]
      draw_buffer(tobmp, i * 64, 288, bmp1, 768 + (i * 32), 0)
    end
   
    bmp2 = Bitmap.new(1024, 96)
    @buffers[1] = bmp2
    tobmp = @bitmaps[1]
    for i in 0..7
      draw_buffer(tobmp, i * 64, 0, bmp2, i * 32, 0)
    end
    for i in 0..7
      draw_buffer(tobmp, i * 64, 96, bmp2, 256 + (i * 32), 0)
    end
    for i in 0..7
      draw_buffer(tobmp, i * 64, 192, bmp2, 512 + (i * 32), 0)
    end
    for i in 0..7
      draw_buffer(tobmp, i * 64, 288, bmp2, 768 + (i * 32), 0)
    end
  end

  #--------------------------------------------------------------------------
  def draw_buffer(bmp, ox, oy, tobmp, tox, toy)
    r = Rect.new(0, 0, 16, 16)
    #&#12388;&#12358;&#12376;&#12423;&#12358;&#12481;&#12483;&#12503;
    r.set_pos(ox + 32, oy + 64)
    tobmp.blt(tox,      toy, bmp, r)
    r.set_pos(ox + 16, oy + 64)
    tobmp.blt(tox + 16, toy, bmp, r)
    r.set_pos(ox + 32, oy + 48)
    tobmp.blt(tox,      toy + 16, bmp, r)
    r.set_pos(ox + 16, oy + 48)
    tobmp.blt(tox + 16, toy + 16, bmp, r)
   
    #||
    r.set_pos(ox, oy + 64)
    tobmp.blt(tox,      toy + 32, bmp, r)
    r.set_pos(ox + 48, oy + 64)
    tobmp.blt(tox + 16, toy + 32, bmp, r)
    r.set_pos(ox, oy + 48)
    tobmp.blt(tox,      toy + 48, bmp, r)
    r.set_pos(ox + 48, oy + 48)
    tobmp.blt(tox + 16, toy + 48, bmp, r)
   
    #=
    r.set_pos(ox + 32, oy + 32)
    tobmp.blt(tox,      toy + 64, bmp, r)
    r.set_pos(ox + 16, oy + 32)
    tobmp.blt(tox + 16, toy + 64, bmp, r)
    r.set_pos(ox + 32, oy + 80)
    tobmp.blt(tox,      toy + 80, bmp, r)
    r.set_pos(ox + 16, oy + 80)
    tobmp.blt(tox + 16, toy + 80, bmp, r)
  end
 
  #--------------------------------------------------------------------------
  # &#12458;&#12540;&#12488;&#12479;&#12452;&#12523;&#12398;&#24038;&#19978;&#12434;&#25551;&#12367;
  # Return: &#25551;&#30011;&#32066;&#20102;&#12394;&#12425;true
  #--------------------------------------------------------------------------
  def draw_lt(r, atid, ox, oy, bx)
    case
      #r.set(ox, oy, 16, 16)
      when @lt_buf_0.key?(atid)
        r.x = bx
        r.y = 0
      when @lt_buf_1.key?(atid)
        r.x = bx
        r.y = 32
      when @lt_buf_2.key?(atid)
        r.x = bx
        r.y = 64
      when @lt_1.key?(atid)
        r.x = ox + 32
        r.y = oy
      when @lt_2.key?(atid)
        r.x = ox
        r.y = oy + 32
      when @lt_3.key?(atid)
        r.x = ox + 32
        r.y = oy + 32
      when @lt_4.key?(atid)
        r.x = ox
        r.y = oy + 64
      when @lt_5.key?(atid)
        r.x = ox + 32
        r.y = oy + 64
    end
    bool = false
    case atid
      when 0, 15, 32..34, 36, 38, 40
        r.set(r.x, r.y, 32, 32)
        bool = true
      when 3, 4, 7, 8, 11, 12, 16, 18, 23, 25, 35, 37
        r.width = 32
      when 6, 9, 13, 19, 20, 28, 41
        r.height = 32
    end
    yield(@lt_buffer.key?(atid) ? @buffers :  @bitmaps , r)
    return bool
  end

  #--------------------------------------------------------------------------
  # &#12458;&#12540;&#12488;&#12479;&#12452;&#12523;&#12398;&#21491;&#19978;&#12434;&#25551;&#12367;
  # Return: &#25551;&#30011;&#32066;&#20102;&#12394;&#12425;true
  #--------------------------------------------------------------------------
  def draw_rt(r, atid, ox, oy, bx)
    if case atid
      #r.set(ox + 16, oy, 16, 16)
      when 27
        r.set_pos(bx + 16, 32)
      when 2, 6, 10, 14, 15, 17, 19, 30, 31, 41 #2, 3, 7, 11
        r.set_pos(ox + 48, oy)
      when 1, 5, 9, 13, 28, 29, 40 #0, 1, 4, 8, 12, 16, 18
        r.set_pos(ox + 16, oy + 64)
      when 20..22, 34, 43 #35, 33, 23
        r.set_pos(ox + 16, oy + 32)
      when 24, 26, 38, 39, 44 #25, 27, 32
        r.set_pos(ox + 48, oy + 64)
      when 36, 42, 45, 46 #37
        r.set_pos(ox + 48, oy + 32)
      #when 3, 7, 11, 18, 25, 35, 37
      #  false
    end then
      r.set(r.x, r.y, 16, @rt_height.key?(atid) ? 32: 16)
      yield(@rt_buffer.key?(atid) ? @buffers :  @bitmaps, r)
    end
    return false
  end

  #--------------------------------------------------------------------------
  # &#12458;&#12540;&#12488;&#12479;&#12452;&#12523;&#12398;&#24038;&#19979;&#12434;&#25551;&#12367;
  # Return: &#25551;&#30011;&#32066;&#20102;&#12394;&#12425;true
  #--------------------------------------------------------------------------
  def draw_lb(r, atid, ox, oy, bx)
    if case atid
      #r.set(ox, oy + 16, 16, 16)
      when 1, 2, 3
        r.set_pos(bx, 16)
      when 31
        r.set_pos(bx, 80)
      when 8, 10, 11, 12, 14, 15, 22, 23, 25, 27, 37 #9, 13
        r.set_pos(ox + 32, oy + 16)
      when 4, 5, 7, 21, 24, 26, 36 #0, 1,2,3,  6, 20
        r.set_pos(ox + 32, oy + 48)
      when 16, 17, 18, 32, 34, 35, 42 #19
        r.set_pos(ox, oy + 48)
      when 29, 30, 38, 39, 45 #28, 33, 31
        r.set_pos(ox + 32, oy + 80)
      when 40, 43, 44, 46 #41
        r.set_pos(ox, oy + 80)
      #when 9, 13, 20, 28, 41
      #  false
    end then
      is_buf = @lb_width.key?(atid)
      r.set(r.x, r.y, is_buf ? 32: 16, 16)
      yield(@lb_buffer.key?(atid) ? @buffers :  @bitmaps, r)
      return is_buf || @rt_height.key?(atid)
    end
    return false
  end

  #--------------------------------------------------------------------------
  # &#12458;&#12540;&#12488;&#12479;&#12452;&#12523;&#12398;&#24038;&#19979;&#12434;&#25551;&#12367;(&#12496;&#12483;&#12501;&#12449;&#12399;&#20351;&#12431;&#12394;&#12356;)
  # Return: &#12394;&#12375;
  #--------------------------------------------------------------------------
  def draw_rb(r, atid, ox, oy)
    case atid
      #r.set(ox, oy + 16, 16, 16)
      when 4, 5, 7, 13, 15, 18, 19, 21, 23, 35 #6, 12, 14
        r.set_pos(ox + 48, oy + 16)
      when 8..11, 16, 34 #0,1,2,3, 17, 20, 22
        r.set_pos(ox + 16, oy + 48)
      when 24, 25, 27, 32, 36, 37, 42 #26
        r.set_pos(ox + 48, oy + 48)
      when 30, 40, 41, 43 #28, 29, 31, 33
        r.set_pos(ox + 16, oy + 80)
      when 38, 39, 44..46
        r.set_pos(ox + 48, oy + 80)
      #when 6, 14, 20, 22, 28, 29
      #12,  17, 26
      else return
    end
    yield (@bitmaps, r)
  end
end

________________________
Porady dla twórców gier
Nie ma śniegu, a zgubiłem normalny avatar :I
 
 
Wyświetl posty z ostatnich:   
Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene