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

Project1

 找回密码
 注册会员
搜索
楼主: DeathKing
打印 上一主题 下一主题

Phantom AVG Engine 0.99 古月 展望版

[复制链接]

Lv3.寻梦者

弓箭手?剑兰

梦石
0
星屑
4854
在线时间
833 小时
注册时间
2010-11-17
帖子
1140
1
发表于 2011-2-17 19:02:20 | 显示全部楼层
本帖最后由 一箭烂YiJL 于 2011-2-17 19:08 编辑

之前晚辈曾经打算过尝试一下用RGE,结果因为鼠标怪异(就是Mouse.update无法显示鼠标),
放弃了RGE,后来从"脚本术语"看到这个系统,于是重兴了我研究RGE。
而为了感谢DK,如果不嫌弃的话就接受了我这个吧,笑纳:
  1. #==============================================================================
  2. # ■ 新MouseEx    by一箭烂
  3. #------------------------------------------------------------------------------
  4. #  可以显示动态鼠标,并且可以调按下位置
  5. #     (就是相枪瞄准那些鼠标应该为该鼠标长度的一半,我不懂解释= =)
  6. #     还有就是动态就是几个变化鼠标并排一个图案,
  7. #     DK可以修改此脚本,有些英文用的不好请改。没有了~。    by一箭烂
  8. #==============================================================================
  9. module RGE
  10.   module Control
  11.     module MouseEx
  12.       
  13.       @mouse = Sprite.new
  14.       @name = "mecha_icon"         # 名称
  15.       @press_x = 1                        # 按下位置X坐标
  16.       @press_y = 1                        # 按下位置Y坐标
  17.       @mouse_width = 32              # 每个鼠标长度
  18.       @mouse_height = 32             # 每个鼠标高度
  19.       @change_number = 2            # 动态鼠标数量
  20.       @change_cursor_time = 20    # 鼠标变化时间(帧)
  21.       
  22.       def self.init
  23.         @mouse.bitmap = RGE::Bitmap.new(@mouse_width,@mouse_height)
  24.         @cache = Ph::Resource.system(@name)
  25.         @rect = RGE::Rect.new(0,0,@mouse.bitmap.width,@mouse.bitmap.height)
  26.         @mouse.z = 9999
  27.         @now_cursor_index = 0
  28.         self.next_icon
  29.       end
  30.       
  31.       def self.update
  32.         RGE::Mouse.update
  33.         @mouse.x, @mouse.y = RGE::Mouse.pos
  34.         @mouse.x -= @press_x - 1
  35.         @mouse.y -= @press_y - 1
  36.         @mouse.update
  37.         self.next_icon if RGE::Graphics.frame_count % @change_cursor_time == 0
  38.       end
  39.       
  40.       def self.next_icon
  41.         if @now_cursor_index < @change_number
  42.           @now_cursor_index += 1
  43.         else
  44.           @now_cursor_index = 1
  45.         end
  46.         @mouse.bitmap.clear
  47.         @rect.x = @mouse_width*(@now_cursor_index-1)
  48.         @mouse.bitmap.blt(0, 0, @cache, @rect)
  49.       end
  50.       
  51.       def self.change_cursor_time=(value)
  52.         @change_cursor_time = value
  53.       end
  54.       
  55.       # 下面这些都是适用于游戏里改变一切
  56.       def self.change_number=(value)
  57.         @change_number = value
  58.       end
  59.       
  60.       def self.mouse_width=(value)
  61.         @mouse_width = value
  62.         self.init
  63.       end
  64.       
  65.       def self.mouse_height=(value)
  66.         @mouse_height = value
  67.         self.init
  68.       end
  69.       
  70.       def self.press_x=(value)
  71.         @press_x = value
  72.       end
  73.       
  74.       def self.press_y=(value)
  75.         @press_y = value
  76.       end
  77.       
  78.       def self.name=(value)
  79.         @name = value
  80.         self.init
  81.       end
  82.       end
  83.   end
  84. end
复制代码
上面那脚本可以配合:

注意:在main之前先要init(update不再支持init)
另外游戏中可以改变那些数据,你知道的,看脚本。
但是发现在PhantomApp里应用会鼠标会卡,于是给我的那个原版:
  1. #==============================================================================
  2. # ■ MouseEx    by一箭烂
  3. #------------------------------------------------------------------------------
  4. #  通过增加模组,让图片显示鼠标。
  5. #==============================================================================

  6. module MouseEx
  7.   
  8.   @mouse = Sprite.new
  9.   @name = "cursor"
  10.   @press_x = 1
  11.   @press_y = 1
  12.   @mouse_width = 32
  13.   @mouse_height = 32
  14.   @change_number = 2
  15.   @change_cursor_time = 20
  16.   
  17.   def self.init
  18.     @mouse.bitmap = Bitmap.new(@mouse_width,@mouse_height)
  19.     @cache = Bitmap.new(@name)
  20.     @rect = Rect.new(0,0,@mouse.bitmap.width,@mouse.bitmap.height)
  21.     @mouse.z = 9999
  22.     @now_cursor_index = 0
  23.     self.next_icon
  24.   end
  25.   
  26.   def self.update
  27.     Mouse.update
  28.     @mouse.x, @mouse.y = Mouse.pos
  29.     @mouse.x -= @press_x - 1
  30.     @mouse.y -= @press_y - 1
  31.     @mouse.update
  32.     self.next_icon if Graphics.frame_count % @change_cursor_time == 0
  33.   end
  34.   
  35.   def self.next_icon
  36.     if @now_cursor_index < @change_number
  37.       @now_cursor_index += 1
  38.     else
  39.       @now_cursor_index = 1
  40.     end
  41.     @mouse.bitmap.clear
  42.     @rect.x = @mouse_width*(@now_cursor_index-1)
  43.     @mouse.bitmap.blt(0, 0, @cache, @rect)
  44.   end
  45.   
  46.    def self.change_cursor_time=(value)
  47.     @change_cursor_time = value
  48.   end
  49.   
  50.   # 下面这些都是适用于游戏里改变一切
  51.   def self.change_number=(value)
  52.     @change_number = value
  53.   end
  54.   
  55.   def self.mouse_width=(value)
  56.     @mouse_width = value
  57.     self.init
  58.   end
  59.   
  60.   def self.mouse_height=(value)
  61.     @mouse_height = value
  62.     self.init
  63.   end
  64.   
  65.   def self.press_x=(value)
  66.     @press_x = value
  67.   end
  68.   
  69.   def self.press_y=(value)
  70.     @press_y = value
  71.   end
  72.   
  73.   def self.name=(value)
  74.     @name = value
  75.     self.init
  76.   end
  77. end
复制代码
最后了:
就是Ph::Resource,我要说这个Ph::Resource是会去的整个磁盘路径是吧,
但是RGE(好像)不会兼容地区性语言为繁体的电脑的中文路径,于是那些RGE一遇上那些电脑中文路径,
就会路径乱码导致无法读取文件(我的机子就是一个例子),于是我建议把前面的磁盘路径给删掉。
最后如果不嫌弃的话,我可以帮助一下参与制作PhantomApp。

本帖子中包含更多资源

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

x

点评

距离RGE2还有多么漫长的日子啊,现在好像1.04,2.0......  发表于 2011-2-18 17:47
是吗?...那我就期待下一个版本了。  发表于 2011-2-18 17:33
呵呵,MouseEx是我从Davy那里借来的,手上的1.0版本稍微修正了一下MouseEx,但是也不是很满意。打算RGE2在继续弄。  发表于 2011-2-18 12:58
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-3 09:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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