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

Project1

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

一个美国网站的脚本!完全不懂,寻高手

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2006-3-1
帖子
126
跳转到指定楼层
1
发表于 2008-2-7 11:18:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
图片


脚本是不是将系统改成如图????






  1. =begin

  2. Mode07 on the Map!
  3. Includes:
  4.     Mode07 v0.6
  5.     Overworld Sprite Resize
  6.   Written by mewsterus

  7. Special Thanks:
  8.   Fanha Giang (for a reverse engineered Tilemap class)
  9. --------------------------------------------------------------------------------
  10. Instructions:
  11. --------------------------------------------------------------------------------
  12. To install, just insert this in a descriptive code slot right above Main.
  13. This is different than previous instructions; please read the next paragraph.

  14. If you had a previous install of this script and need an original version of
  15. Spriteset_Map, one can be found at:
  16. http://www.rpg-palace.com/scripts/spriteset_map.txt

  17. To activate Mode07, add [#XX] to the map's name, replacing XX with the
  18. percentage of Mode07 to apply.  Greater numbers will result in a more slanted
  19. world.

  20. To activate overworld sprite resize, add [OV] to the map's name.  This will make
  21. sprites smaller on that map.

  22. For the purposes of location scripts, these identifiers will not appear.


  23. Examples:

  24. "Overworld[#40]" will result in a slant identical to the second screenshot.
  25. "Underworld[OV]" will resize only the player character to a small size, as if
  26.                  seen from high above.
  27. "Atthelevelworld[OV][#12]" will result in the player being resized, and a modest
  28.                            slant of 12%
  29. "JustPlainWorld" will result in the same old map you've always seen.

  30. To add a sky, simply use the panorama with the tileset.  Also, events will not
  31. be drawn flat with the map.  Any vertical objects such as trees should be put
  32. in events and displayed that way.

  33. You can also add a sky by adding a fog.  If you add this, you can make it look
  34. like the first screenshot.

  35. A note on the $strip_size variable; the default value is 8, however there is
  36. extremely minimal, almost nonexistant lag with 16. The screen is extremely
  37. smooth with 4, or even 2. If you're having major problems with lag, you may
  38. need to use 32, but it won't look too pretty.
  39. --------------------------------------------------------------------------------
  40. * Draw_Tilemap v1.72-0.6
  41. Fanha Giang, 02/12/2006 (mm/dd/yyyy)
  42. Edited for Mode07 by mewsterus 08/08/2006 (mm/dd/yyyy)
  43. =end
  44. #===============================================================================
  45. $width = 640    # Screen width        (will not change resolution,
  46. $height = 480   # Screen height        here for compatibility)
  47. $ov_zoom = 0.6  # Overworld zoom multiplier
  48. $strip_size = 8 # Size of each strip of the map.  Higher numbers will lag less.
  49.                 #  Recommended that this number be a power of 2.
  50.                 #  Do not make higher than 64.
  51. $curve = true   # Whether the map is curled, for overworlds (old method)
  52. $data_map = load_data("Data/MapInfos.rxdata")
  53. #===============================================================================
  54. class RPG::MapInfo
  55.   def name # Definition prevents location scripts from reading anything within
  56.     return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets
  57.   end
  58.   #-----------------------------------------------------------------------------
  59.   def original_name
  60.     return @name
  61.   end
  62.   #-----------------------------------------------------------------------------
  63.   def overworld?
  64.     return @name.scan(/[OV]/).size > 0
  65.   end
  66.   #-----------------------------------------------------------------------------
  67.   def pitch
  68.     @name =~ /\[#[ ]*([00-99]+)\]/i
  69.     return $1
  70.   end
  71. end
  72. #===============================================================================
  73. class Draw_Tilemap # This class controls a set of sprites, with different Z
  74.                    #  values, arranged into horizontal bars
  75.   attr_accessor :tileset
  76.   attr_accessor :map_data
  77.   attr_accessor :priorities
  78.   attr_accessor :autotiles
  79.   attr_accessor :bitmaps
  80.   attr_accessor :pitch
  81.   attr_accessor :ox
  82.   attr_accessor :oy
  83.   attr_accessor :plus_y
  84.   INDEX = # Autotile definitions
  85.   [
  86.   26, 27, 32, 33, 4,  27, 32, 33, 26, 5,  32, 33, 4,  5,  32, 33,
  87.   26, 27, 32, 11, 4,  27, 32, 11, 26, 5,  32, 11, 4,  5,  32, 11,
  88.   26, 27, 10, 33, 4,  27, 10, 33, 26, 5,  10, 33, 4,  5,  10, 33,
  89.   26, 27, 10, 11, 4,  27, 10, 11, 26, 5,  10, 11, 4,  5,  10, 11,
  90.   24, 25, 30, 31, 24, 5,  30, 31, 24, 25, 30, 11, 24, 5,  30, 11,
  91.   14, 15, 20, 21, 14, 15, 20, 11, 14, 15, 10, 21, 14, 15, 10, 11,
  92.   28, 29, 34, 35, 28, 29, 10, 35, 4,  29, 34, 35, 4,  29, 10, 35,
  93.   38, 39, 44, 45, 4,  39, 44, 45, 38, 5,  44, 45, 4,  5,  44, 45,
  94.   24, 29, 30, 35, 14, 15, 44, 45, 12, 13, 18 ,19, 12, 13, 18, 11,
  95.   16, 17, 22, 23, 16, 17, 10, 23, 40, 41, 46, 47, 4,  41, 46, 47,
  96.   36, 37, 42, 43, 36, 5,  42, 43, 12, 17, 18, 23, 12, 13, 42, 43,
  97.   36, 41, 42, 47, 16, 17, 46, 47, 12, 17, 42, 47, 0,  1,  6,  7
  98.   ]
  99.   X = [0, 1, 0, 1] # Used in 16x16 autotile drawing; left, right, left, right
  100.   Y = [0, 0, 1, 1] # Used in 16x16 autotile drawing;   up,    up, down,  down
  101.   #-----------------------------------------------------------------------------
  102.   def initialize
  103.   # Get initial data from Game_Map
  104.     @tileset = RPG::Cache.tileset($game_map.tileset_name)
  105.     @map_data = $game_map.data
  106.     @priorities = $game_map.priorities
  107.     @autotiles = []
  108.     for i in 0..6
  109.       @autotiles[i] = RPG::Cache.autotile($game_map.autotile_names[i])
  110.     end
  111.   # Provide blank data in proper object form
  112.     @ox = 0
  113.     @oy = 0
  114.   # Bitmaps used for each priority's drawing.  Priorities 2-5 are combined.
  115.     @bitmaps = [Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size),
  116.                 Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size),
  117.                 Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size)]
  118.   # Generate blank sprites
  119.     @sprites = [[], [], []]
  120.     for i in 0..2 # For each layer
  121.       for j in 0..$game_map.height * (32 / $strip_size) - 1
  122.       # For each horizontal strip of $strip_size height, make a blank sprite
  123.         @sprites[i].push(Sprite.new)
  124.         @sprites[i][j].bitmap = Bitmap.new($game_map.width*32, $strip_size*2)
  125.         @sprites[i][j].x = $width / 2
  126.         @sprites[i][j].y = -64
  127.         @sprites[i][j].z = -5 + (i * 10)
  128.       end
  129.     end
  130.     @disposed = false
  131.     draw
  132.   end
  133.   #-----------------------------------------------------------------------------
  134.   def update
  135.   # Retrieve variable values for slant drawing; these values accesible by event
  136.     @pitch = $game_map.pitch.to_f
  137.     @plus_y = $game_map.plus_y
  138.     for i in 0..2 # For each layer
  139.       for j in [0, (($height / 2) - (($height * 60) /
  140.                 @pitch) + @oy) / $strip_size].max.to_i..[@sprites[i].size - 1,
  141.                 (@oy + $height) / $strip_size].min.to_i
  142.       # For each strip within the visible screen, update OX/Y
  143.         @sprites[i][j].x = $width / 2
  144.         @sprites[i][j].y = j * $strip_size - @oy
  145.         unless @pitch == 0 # Apply X Zoom
  146.           @sprites[i][j].zoom_x = (@sprites[i][j].y - $height / 2) *
  147.                                   (@pitch / ($height * 25)) + 1
  148.           if $curve # Zoom Y values same as X, and compensate
  149.             @sprites[i][j].zoom_y = @sprites[i][j].zoom_x
  150.             @sprites[i][j].y += $strip_size * (1 - @sprites[i][j].zoom_y) *
  151.                                 ((1 - @sprites[i][j].zoom_y) /
  152.                                 (2 * ((@pitch / 100) /
  153.                                       ($height / ($strip_size * 2)))) + 0.5)
  154.           end
  155.         end
  156.         @sprites[i][j].ox = @ox + $width / 2
  157.       # Add plus_y value; used in airship script
  158.         @sprites[i][j].y += @plus_y
  159.       end
  160.     end
  161.   end
  162.   #-----------------------------------------------------------------------------
  163.   def dispose
  164.   # Dispose all sprites
  165.     for i in 0..2
  166.       for j in @sprites[i]
  167.         j.bitmap.dispose
  168.         j.dispose
  169.       end
  170.     end
  171.     for i in @bitmaps
  172.       i.dispose
  173.     end
  174.     @tileset.dispose
  175.     for i in 0..6
  176.       @autotiles[i].dispose
  177.     end
  178.     @disposed = true
  179.   end
  180.   #-----------------------------------------------------------------------------
  181.   def disposed?
  182.     return @disposed
  183.   end
  184.   #-----------------------------------------------------------------------------
  185.   def draw
  186.   # Draw each individual position by XY value
  187.     for x in 0...@map_data.xsize
  188.       for y in 0...@map_data.ysize
  189.         draw_position(x, y)
  190.       end
  191.     end
  192.     for i in 0..2 # For each priority
  193.       for j in 0..@sprites[i].size - 1
  194.       # For each horizontal strip, transfer the bitmap appropriately
  195.         @sprites[i][j].bitmap.blt(0, 0, @bitmaps[i],
  196.             Rect.new(0, j * $strip_size, $game_map.width * 32, $strip_size * 2))
  197.       end
  198.     end
  199.   end
  200.   #-----------------------------------------------------------------------------
  201.   def draw_position(x, y)
  202.     for layer in 0..2
  203.       pos = @map_data[x, y, layer]
  204.       @priorities[pos] = 2 if @priorities[pos] > 2 # Round priorities down to 2
  205.       if pos >= 384 # If it is a tile
  206.       # src_rect = 32x32 Rect on the tileset for source bitmap
  207.         src_rect = Rect.new(((pos-384)%8)*32, ((pos-384)/8)*32, 32, 32)
  208.       # Transfer source bitmap on the tileset to the current map tile
  209.         @bitmaps[@priorities[pos]].blt(x * 32, y * 32, @tileset, src_rect)
  210.       elsif pos >= 48 and pos < 384 # If it is an autotile
  211.         id = pos / 48 - 1 # Which autotile is used (0-6)
  212.       # plus_x is in development for animated autotiles
  213.         plus_x = 0 #((@anim / 4) % (@autotiles[id].width / 96)) * 96
  214.         for corner in 0..3
  215.           h = 4 * (pos % 48) + corner # Used to access INDEX
  216.         # src_rect = 16x16 Rect on the autotile for source bitmap
  217.           src_rect = Rect.new((INDEX[h]%6)*16+plus_x, (INDEX[h]/6)*16, 16, 16)
  218.         # Transfer source bitmap on the autotile to the current 16x16 tile
  219.           @bitmaps[@priorities[pos]].blt(x*32+X[corner]*16, y*32+Y[corner]*16,
  220.                                           @autotiles[id], src_rect)
  221.         end
  222.       end
  223.     end
  224.   end
  225. end
  226. #===============================================================================
  227. class Game_Map
  228.   attr_accessor :pitch
  229.   attr_accessor :plus_y
  230.   #-----------------------------------------------------------------------------
  231.   alias setup_or :setup
  232.   def setup(map_id)
  233.     setup_or(map_id)
  234.     @pitch = $data_map[$game_map.map_id].pitch
  235.     @plus_y = 0
  236.   end
  237.   #-----------------------------------------------------------------------------
  238.   def name
  239.     return $data_map[@map_id].name
  240.   end
  241. end
  242. #===============================================================================
  243. class Sprite_Character < RPG::Sprite
  244.   attr_accessor :character
  245.   #-----------------------------------------------------------------------------
  246.   def initialize(character = nil)
  247.     super()
  248.     @character = character
  249.     update
  250.   end
  251.   #-----------------------------------------------------------------------------
  252.   alias update_or :update
  253.   def update
  254.     update_or
  255.   # Update pitch value, and update zoom values to match
  256.     @pitch = $data_map[$game_map.map_id].pitch.to_f
  257.     self.zoom_x =
  258.     self.zoom_y = ((@character.screen_y - 16) - ($height / 2)) *
  259.                   (@pitch / ($height * 25)) + 1
  260.   # Set sprite coordinates.  X value is multiplied by zoom value from the center
  261.     self.x = ($width / 2) + ((@character.screen_x - ($width / 2)) * self.zoom_x)
  262.     self.y = @character.screen_y
  263.   # Add Y value for zoom compensation while in curve mode
  264.     if $curve and @pitch != 0
  265.       self.y += (8 * (1 - self.zoom_y) * ((1 - self.zoom_y) /
  266.                 (2 * ((@pitch / 100) / ($height / 16.0))) + 0.5))
  267.     end
  268.   # Add plus_y value; used in airship script
  269.     self.y += $game_map.plus_y unless @character.is_a?(Game_Player)
  270.     self.z = @character.screen_z(@ch) - (self.zoom_y < 0.5 ? 1000 : 0)
  271.     if $data_map[$game_map.map_id].overworld? and
  272.        @character.is_a?(Game_Player) # Multiply zoom by Overworld factor if
  273.       self.zoom_x *= $ov_zoom        #  the map is marked with [OV] and event
  274.       self.zoom_y *= $ov_zoom        #  is a Game_Player
  275.     end
  276.   end
  277. end
  278. #===============================================================================
  279. class Spriteset_Map
  280.   def initialize
  281.   # Make viewports
  282.     @viewport1 = Viewport.new(0, 0, 640, 480)
  283.     @viewport2 = Viewport.new(0, 0, 640, 480)
  284.     @viewport3 = Viewport.new(0, 0, 640, 480)
  285.     @viewport2.z = 2000
  286.     @viewport3.z = 5000
  287.   # Make tilemap
  288.     @tilemap = Draw_Tilemap.new
  289.   # Make panorama plane
  290.     @panorama = Plane.new
  291.     @panorama.z = -2000
  292.   # Make fog plane
  293.     @fog = Plane.new
  294.     @fog.z = 3000
  295.   # Make character sprites
  296.     @character_sprites = []
  297.     for i in $game_map.events.keys.sort
  298.       sprite = Sprite_Character.new($game_map.events[i])
  299.       @character_sprites.push(sprite)
  300.     end
  301.     @character_sprites.push(Sprite_Character.new($game_player))
  302.   # Make weather
  303.     @weather = RPG::Weather.new(@viewport1)
  304.   # Make picture sprites
  305.     @picture_sprites = []
  306.     for i in 1..50
  307.       @picture_sprites.push(Sprite_Picture.new(@viewport2,
  308.                                                $game_screen.pictures[i]))
  309.     end
  310.   # Make timer sprite
  311.     @timer_sprite = Sprite_Timer.new
  312.   # Frame update
  313.     update
  314.   end
  315.   #-----------------------------------------------------------------------------
  316.   def dispose
  317.   # Dispose of tilemap
  318.     @tilemap.dispose
  319.   # Dispose of panorama plane
  320.     @panorama.dispose
  321.   # Dispose of fog plane
  322.     @fog.dispose
  323.   # Dispose of character sprites
  324.     for sprite in @character_sprites
  325.       sprite.dispose
  326.     end
  327.   # Dispose of weather
  328.     @weather.dispose
  329.   # Dispose of picture sprites
  330.     for sprite in @picture_sprites
  331.       sprite.dispose
  332.     end
  333.   # Dispose of timer sprite
  334.     @timer_sprite.dispose
  335.   # Dispose of viewports
  336.     @viewport1.dispose
  337.     @viewport2.dispose
  338.     @viewport3.dispose
  339.   end
  340. end
复制代码

Lv2.观梦者

天仙

梦石
0
星屑
610
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

2
发表于 2008-2-7 11:36:24 | 只看该作者
这是大地图用的脚本
把地图变成有透视点
变成类似3D的样子
VA脚本开工中...
偷窃脚本1.0 - 已完成
回复 支持 反对

使用道具 举报

Lv2.观梦者

天仙

梦石
0
星屑
610
在线时间
184 小时
注册时间
2008-4-15
帖子
5023

贵宾

3
发表于 2008-2-7 11:40:03 | 只看该作者
重发
自删

回复 支持 反对

使用道具 举报

Lv1.梦旅人

邪恶小龙包

梦石
0
星屑
55
在线时间
17 小时
注册时间
2006-5-22
帖子
7006

第2届短篇游戏比赛冠军第3届短篇游戏大赛小游戏及其他组冠军RMVX自由创作大赛冠军

4
发表于 2008-2-7 11:46:09 | 只看该作者
不过会非常的卡
虚无  堕落
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

喵,小柯的宠物

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-12-15
帖子
2310
5
发表于 2008-2-8 01:18:07 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3263
在线时间
3616 小时
注册时间
2006-9-6
帖子
37399

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

6
发表于 2008-2-8 01:27:13 | 只看该作者
这是XP的……
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-1-14
帖子
77
7
发表于 2008-2-8 02:39:32 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-1-14
帖子
77
8
发表于 2008-2-8 02:42:48 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
466 小时
注册时间
2006-2-25
帖子
1863
9
发表于 2008-2-8 02:45:23 | 只看该作者
强大得要命.
但太卡的东西用不起{/gg}
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3263
在线时间
3616 小时
注册时间
2006-9-6
帖子
37399

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

10
发表于 2008-2-8 02:48:04 | 只看该作者
以下引用诡异の猫于2008-2-7 18:45:23的发言:

强大得要命.
但太卡的东西用不起

画面改那么大,

不卡是不可能的……
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-6 20:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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