查看: 1169|回复: 1

[已经解决] 脚本写法问题

  [复制链接]
梦石
0
星屑
50
在线时间
2 小时
注册时间
2006-11-7
回帖
119
发表于 2009-8-19 14:06:31 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 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)

孤独守望

梦石
0
星屑
3144
在线时间
1535 小时
注册时间
2006-10-16
回帖
4223

开拓者贵宾

发表于 2009-8-19 16:35:03 | 显示全部楼层
请定义initialize,或者在注册时:
a = Mappp.new => argument
a = Mappp.new(0,0,100,100) => pass
菩提本非树,明镜本非台。回头自望路漫漫。不求姻缘,但求再见。
本来无一物,何处惹尘埃。风打浪吹雨不来。荒庭遍野,扶摇难接。
不知道多久更新一次的博客
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部