查看: 4245|回复: 2

[已经过期] VA的一个豪华鼠标脚本。老是出问题

[复制链接]
梦石
0
星屑
50
在线时间
11 小时
注册时间
2012-12-22
回帖
4
发表于 2013-1-19 11:09:17 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 Mic_洛洛 于 2013-1-19 21:40 编辑

脚本有三个。出问题的是第一个
脚本:
[pre lang="ruby" line="1"]module Mouse  
  attr_accessor :count                     #变换动画计数
attr_accessor :npc                       #指向NPC
attr_accessor :wait                      #指针变成角色正在移动
attr_accessor :enemy                     #指针指向敌人
attr_accessor :coach                     #coach icons switch
#======================================================
#change icon!
#======================================================
  def self.npc
    if @NPC != true
    @count = 10
    @NPC = true
    end
  end
  def self.wait
    if @Wait != true
    @count = 10
    @Wait = true
    end
  end
  def self.enemy
    if @enemy != true
    @count = 10
    @enemy = true
    end
  end
  def self.coach
    if @COACH != true
      @count = 10
      @COACH = true
    end
  end
#======================================================
#end
#======================================================
  def self.text
   
  end
  def self.into_menu
    Sound.play_ok
    SceneManager.call(Scene_Menu)
    Window_MenuCommand::init_command_position
  end
  def self.init2
    #Directions
    @dir = 0
    @old_x, @old_y = 0, 0
    #Animations
    @light_id = 1
    @mouse_sprite1 = Sprite.new;
    @mouse_sprite1.z = 9999;
    @mouse_sprite1.bitmap = Bitmap.new("Graphics/Icons/#{@light_id}");
    @light_id = 1
    @canyin = []
    @rmenu = nil#右键菜单
    @rightmenu = false
    @mouse_touch = false
    @count = 0
    @npc,@wait,@coach = false
  end
  def self.setbb(a,b,c,d,e,f,g,h,i)
    @blend_tepe = a if a != nil
    @opacity    = b if b != nil   
    @jy         = c if c != nil        
    @zoom_x     = d if d != nil   
    @zoom_y     = e if e != nil   
    @light      = f if f != nil     
    @Shadow     = g if g != nil   
    @Angle      = h if h != nil     
    @anima      = i if i != nil     
  end
  def self.show_light(mx, my)
    @canyin.each{|s|s.opacity <= 0 ? (s.visible = false ; @canyin.delete(s)) : s.opacity -= 25}
    if @light
    @light_id < 94 ? @light_id += 1 : @light_id = 1
    i = @light_id
    eval("@mouse_sprite#{i} = Sprite.new")
    eval("@mouse_sprite#{i}.x = #{mx}")
    eval("@mouse_sprite#{i}").y = my
    eval("@mouse_sprite#{i}").blend_type = @blend_tepe
    eval("@mouse_sprite#{i}").z = 9999;
   #eval("@mouse_sprite#{i}").angle = @mouse_sprite.angle
    eval("@mouse_sprite#{i}").bitmap = Bitmap.new("Graphics/Icons/#{@light_id}")
    for i in 1..94
      begin
      eval("@mouse_sprite#{i}").opacity -= @opacity #10
      eval("@mouse_sprite#{i}").y += @jy#1
      eval("@mouse_sprite#{i}").zoom_x += @zoom_x#0.105
      eval("@mouse_sprite#{i}").zoom_y += @zoom_y#0.105
      eval("@mouse_sprite#{i}").dispose if eval("@mouse_sprite#{i}").opacity <= 0
      rescue
      end
    end
    if @plight == true
      self.update_light
    end
    end
    return if !@angle
    a = 0
    #被废掉的朝向
    hu = [(@old_x - mx), (@old_y - my)]
   
    return if hu[0] == 0 or hu[1] == 0
    math = 135 - self.atoa(Math.atan(hu[1]/hu[0]))
    if hu[0] > 0
      @mouse_sprite.angle = math - 90
    else
      @mouse_sprite.angle = math + 90
    end
    #p math
    @old_x, @old_y = mx, my
   
   
  end
  def self.plight
    return unless @light
    @l = Sprite.new
    @l.z = 999999
    @pcount = 30
    @l.blend_type = 1
    @l.bitmap = Bitmap.new("Graphics/Icons/#{@pcount}");
    @l.ox = @l.bitmap.width / 2
    @l.oy = @l.bitmap.height / 2
    @l.x, @l.y = @mouse_sprite.x, @mouse_sprite.y
    @plight = true
   
  end
  def self.update_light
    @pcount += 1
    @l.bitmap = Bitmap.new("Graphics/Icons/#{@pcount}")
    @l.zoom_x += 0.1
    @l.zoom_y += 0.1
    @l.opacity -= 10
    if @pcount >= 70
      @l.dispose
      @pcount = 0
      @plight = false
    end
  end
  def self.atoa(hu)#弧度转角度
    return (hu * 180) / Math::PI
    #
  end
#==============================================================================
#New Part!
#==============================================================================
  def self.moving(x,y)
    return if !@Shadow == true
    sprite = Sprite.new
    sprite.z = 999
    sprite.bitmap = @mouse_sprite.bitmap if !@mouse_sprite.disposed?#Bitmap.new("Graphics/Mouse/1.png")
    sprite.x = x
    sprite.y = y
    sprite.opacity = 200
    sprite.angle = @mouse_sprite.angle
    @canyin.push sprite
  end
  def self.canyin
    return @canyin.size
  end
  def self.right_menu(x,y)
   
    @rmenu.dispose if @rmenu != nil
    @rmenu = Sprite.new
    @rmenu.z = 1000
   
#    @rmenu.bitmap.fill_rect(0, 0, 150, 32*n, Color.new(255,255,255))
#    @rmenu.bitmap.font.color = Color.new(68,34,255)
#    n.times{|i|
#    @rmenu.bitmap.fill_rect(0, i*32, 150, 1, Color.new(0,0,0))
#    @rmenu.bitmap.draw_text(0, i*32, 150, 32,text[0])
   
#    }
    @rmenu.x,@rmenu.y = x,y
    @rmenu.opacity = 200
    @rightmenu = true
  end
  def self.mouse_touch=(bar)
    @mouse_touch = bar
  end
  def self.mouse_touch
    return @mouse_touch
  end
  def self.check
    if Mouse.trigger?(Mouse::LEFT)
    if @rightmenu
      mx,my = Mouse.get_mouse_pos
      lx = @rmenu.x - @rmenu.ox
      rx = lx + @rmenu.bitmap.width
      ty = @rmenu.y - @rmenu.oy
      by = ty + @rmenu.bitmap.height
      if mx < lx or mx > rx or my < ty or my > by or
        @rmenu.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
        
      else
        a = []
        text.size.times{|t|a << [t*32 , (my-@rmenu.y).abs].min}
        eval(text[(a.max/32).to_i][1])
      end
      @rightmenu = false
      @rmenu.dispose
        @rmenu = nil
        return
    end
    end
  end      
end[/pre]
Mouse.init2
Mouse.setbb(合成方式,
透明速度,
下降速度,
X放大率,
Y放大率,残光,残影,旋转,动态)

----------------------------------
      rx = lx + @rmenu.bitmap.width
这一行出问题  
梦石
0
星屑
50
在线时间
11 小时
注册时间
2012-12-22
回帖
4
 楼主| 发表于 2013-1-19 11:15:09 | 显示全部楼层
未命名.jpg
回复

使用道具 举报

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
回帖
1526
发表于 2013-1-19 12:28:06 | 显示全部楼层
直接在主楼编辑即可,不必连帖吧,而且脚本也没有使用代码,

楼主您发帖都没先做好功课,五连帖,当心被版主扣分啊!
修改劇本中,仔細審查原來的劇情大綱,覺得有點不太滿意,嘗試編寫不同主角不同主線的劇情,希望能寫得出來。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部