Project1

标题: 脚本写法问题 [打印本页]

作者: sdbgejsb    时间: 2009-8-19 14:06
标题: 脚本写法问题
本帖最后由 sdbgejsb 于 2009-8-19 15:45 编辑

class Mapp < Window_Base
  def make_all_map
    all_map = Bitmap.new($game_map.width * 32, $game_map.height * 32)
    for y in 0...$game_map.height
      for x in 0...$game_map.width
        for z in 0...3
          tile_num = @map_data[x, y, z]
          next if tile_num == nil
          if tile_num < 384
            if tile_num >= 48
              tile_num -= 48
              src_rect = Rect.new(32, 2 * 32, 32, 32)
              all_map.blt(x * 32, y * 32, @autotiles[tile_num / 48], src_rect)
            end
          else
            tile_num -= 384
            src_rect = Rect.new(tile_num % 8 * 32, tile_num / 8 * 32, 32, 32)
            all_map.blt(x * 32, y * 32, @tileset, src_rect)
          end
        end
      end
    end
    w = $game_map.width * 32
    h = $game_map.height * 32
    ret_bitmap = Bitmap.new(w, h)
    src_rect = Rect.new(0, 0, all_map.width, all_map.height)
    dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
    ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
    all_map.dispose
    return ret_bitmap
  end
  def run
    mappp = Sprite.new(viewport)
    mappp.bitmap = @make_all_map
    mappp.z = 10000
    mappp.visible = true
    mappp.opacity = 255
    mappp.dispose
  end
end

这样写有什么不对?
提示Argumenterror
wrong number of argument(0-4)
作者: IamI    时间: 2009-8-19 16:35
请定义initialize,或者在注册时:
a = Mappp.new => argument
a = Mappp.new(0,0,100,100) => pass




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1