Project1

标题: 一个小脚本问题 [打印本页]

作者: 宇凌风    时间: 2008-3-16 01:35
标题: 一个小脚本问题
SyntaxError是什么意思? [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: 小幽的马甲    时间: 2008-3-16 01:39
语法错误。
不过估计你也不知道错在哪里……
作者: 宇凌风    时间: 2008-3-16 01:46
#==============================================================================
# ■ VX-RGSS2 改变战斗背景 [版本.1.0.0]     by Claimh
#------------------------------------------------------------------------------
# 英语翻译 By: Elemental Crisis [http://www.rpgcrisis.net]
# 中文翻译 By: zero2 [http://rpg.blue/web]
#------------------------------------------------------------------------------
# 改变战斗的背景图.
#==============================================================================


module BattleBack
#   选择战斗背景
#   0:当前地图的战斗背景,为战斗背景(默认VX的样式)
#   1:目前使用的地图作为战斗背景
#   2:使用自己的图片,为战斗背景
BB_TYPE = 2  # 在这里输入上面提到的编号

# 显示战斗地面
BT_FLOOR = false

# 使用的图片(如果你选择的编号为2)
M_B_BACK = {
   # 地图编号 => "(Graphics/System/图片名)"
   1 => "ads.jpg"
end


#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Creating Battle Back Sprite
#--------------------------------------------------------------------------
def create_battleback
   case BattleBack::BB_TYPE
   when 0
     source = $game_temp.background_bitmap
     bitmap = Bitmap.new(640, 480)
     bitmap.stretch_blt(bitmap.rect, source, source.rect)
     bitmap.radial_blur(90, 12)
     @battleback_sprite = Sprite.new(@viewport1)
     @battleback_sprite.bitmap = bitmap
     @battleback_sprite.ox = 320
     @battleback_sprite.oy = 240
     @battleback_sprite.x = 272
     @battleback_sprite.y = 176
     @battleback_sprite.wave_amp = 8
     @battleback_sprite.wave_length = 240
     @battleback_sprite.wave_speed = 120
   when 1
     source = $game_temp.background_bitmap
     bitmap = Bitmap.new(640, 480)
     bitmap.stretch_blt(bitmap.rect, source, source.rect)
     @battleback_sprite = Sprite.new(@viewport1)
     @battleback_sprite.bitmap = bitmap
     @battleback_sprite.ox = 320
     @battleback_sprite.oy = 240
     @battleback_sprite.x = 272
     @battleback_sprite.y = 176
   when 2
     @battleback_sprite = BattleBackSprite.new(@viewport1)
   end
end
#--------------------------------------------------------------------------
# ● Creating Battle Floor Sprite
#--------------------------------------------------------------------------
alias create_battlefloor_mbb create_battlefloor
def create_battlefloor
   create_battlefloor_mbb if BattleBack::BT_FLOOR
end
#--------------------------------------------------------------------------
# ● Delete Battle Floor Sprite
#--------------------------------------------------------------------------
alias dispose_battlefloor_mbb dispose_battlefloor
def dispose_battlefloor
   dispose_battlefloor_mbb if BattleBack::BT_FLOOR
end
#--------------------------------------------------------------------------
# ● Update Battle Floor Sprite
#--------------------------------------------------------------------------
alias update_battlefloor_mbb update_battlefloor
def update_battlefloor
   update_battlefloor_mbb if BattleBack::BT_FLOOR
end
end


#==============================================================================
# ■ BattleBackSprite
#==============================================================================
class BattleBackSprite < Sprite
# Background Screen Size
WIDTH  = 544.00
HEIGHT = 288.00
#--------------------------------------------------------------------------
# ● Object Initialization
#     viewport : viewport
#--------------------------------------------------------------------------
def initialize(viewport = nil)
   super(viewport)
   self.bitmap = Cache.system(BattleBack::M_B_BACK[$game_map.map_id])
   # Zoom is carried out according to picture size.
   @x_zoom = WIDTH / self.bitmap.width
   @y_zoom = HEIGHT / self.bitmap.height
   @zoom = @x_zoom > @y_zoom ? @x_zoom : @y_zoom
   # Zoom is carried out.
   self.zoom_x = @zoom
   self.zoom_y = @zoom
   # Made into central display.
   self.ox = self.bitmap.width / 2
   self.oy = self.bitmap.height / 2
   self.x = (self.bitmap.width / 2)  * @zoom
   self.y = (self.bitmap.height / 2) * @zoom
end
end

就是这一个脚本啊
如果想插入第二张地图的背景该怎样做?
如果从 1 => "ads.jpg" 的下一行再打上 2 => "xxx.jpg"
就会显示SyntaxError.

作者: 小幽的马甲    时间: 2008-3-16 01:48
两行之间要加一个半角逗号……
这是哈希表(Hash)的基本形式 [LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~




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