| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2016-11-3 |
| 在线时间 | 46 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 46 小时
- 注册时间
- 2015-1-22
- 回帖
- 18
|
发表于 2015-3-3 14:20:31
|
显示全部楼层
要導入影片的話,這裡有一個方法
http://forum.gamer.com.tw/C.php?bsn=04918&snA=20313
連結不知道看不看的到,所以我複製在下方
先放這個檔案到遊戲位置 http://www.mediafire.com/download.php?8cwdn15dax6e9bu
(當然是解壓出來)
腳本編輯器插入新腳本
名稱打 RMFlash (不確定是不是必要)
在右邊內容貼下面的資料
- class String
- CP_ACP = 0
- CP_UTF8 = 65001
- def u2s
- m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
- w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")
- len = m2w.call(CP_UTF8, 0, self, -1, nil, 0)
- buf = "\0" * (len*2)
- m2w.call(CP_UTF8, 0, self, -1, buf, buf.size/2)
- len = w2m.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil)
- ret = "\0" * len
- w2m.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil)
- return ret
- end
- def s2u
- m2w = Win32API.new("kernel32", "MultiByteToWideChar", "ilpipi", "i")
- w2m = Win32API.new("kernel32", "WideCharToMultiByte", "ilpipipp", "i")
- len = m2w.call(CP_ACP, 0, self, -1, nil, 0);
- buf = "\0" * (len*2)
- m2w.call(CP_ACP, 0, self, -1, buf, buf.size/2);
- len = w2m.call(CP_UTF8, 0, buf, -1, nil, 0, nil, nil);
- ret = "\0" * len
- w2m.call(CP_UTF8, 0, buf, -1, ret, ret.size, nil, nil);
- return ret
- end
- def s2u!
- self[0, length] = s2u
- end
- def u2s!
- self[0, length] = u2s
- end
- end
- class Bitmap
- RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
- RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
- def address
- buffer, ad = "xxxx", object_id * 2 + 16
- RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 8
- RtlMoveMemory_pi.call(buffer, ad, 4); ad = buffer.unpack("L")[0] + 16
- RtlMoveMemory_pi.call(buffer, ad, 4); return buffer.unpack("L")[0]
- end
- end
- class RMFlash
- API_NEW = Win32API.new("RMFlash", "_new", "piil", "l")
- API_UPDATE = Win32API.new("RMFlash", "_update", "l", "v")
- API_FREE = Win32API.new("RMFlash", "_free", "l", "v")
- API_PLAYING = Win32API.new("RMFlash", "_is_playing", "l", "i")
- API_PAUSE = Win32API.new("RMFlash", "_pause", "l", "v")
- API_RESUME = Win32API.new("RMFlash", "_resume", "l", "v")
- API_BACK = Win32API.new("RMFlash", "_back", "l", "v")
- API_REWIND = Win32API.new("RMFlash", "_rewind", "l", "v")
- API_FORWARD = Win32API.new("RMFlash", "_forward", "l", "v")
- API_CURFRAME = Win32API.new("RMFlash", "_cur_frame", "l", "i")
- API_TOTALFRAME = Win32API.new("RMFlash", "_total_frames", "l", "i")
- API_GOTOFRAME = Win32API.new("RMFlash", "_goto_frame", "li", "v")
- API_GETLOOP = Win32API.new("RMFlash", "_get_loop", "l", "i")
- API_SETLOOP = Win32API.new("RMFlash", "_set_loop", "li", "v")
- API_CLEARALL = Win32API.new("RMFlash", "_clear_all", "v", "v")
- API_VALID = Win32API.new("RMFlash", "_valid", "l", "i")
- API_SENDMSG = Win32API.new("RMFlash", "_send_message", "liii", "l")
- CUR_PATH = Dir.pwd
- def self.get_version
- end
- def self.clear_all
- API_CLEARALL.call
- end
- def self.load(name, width, height, v = nil)
- new("#{CUR_PATH}/#{name}".u2s, width, height, v)
- end
- attr_reader :valid
- def initialize(flash_name, flash_width, flash_height, viewport = nil)
- @sprite = Sprite.new(viewport)
- @sprite.bitmap = Bitmap.new(flash_width, flash_height)
- @value = API_NEW.call(flash_name, flash_width, flash_height, @sprite.bitmap.address)
- @loop = API_GETLOOP.call(@value) > 0
- @valid = API_VALID.call(@value) > 0
- end
- def viewport
- @sprite.viewport
- end
- def update
- API_UPDATE.call(@value)
- end
- def dispose
- API_FREE.call(@sprite.bitmap.address)
- end
- def playing?
- API_PLAYING.call(@value) > 0
- end
- def pause
- API_PAUSE.call(@value)
- end
- def resume
- API_RESUME.call(@value)
- end
- def back
- API_BACK.call(@value)
- end
- def rewind
- API_REWIND.call(@value)
- end
- def forward
- API_FORWARD.call(@value)
- end
- def current_frame
- API_CURFRAME.call(@value)
- end
- def total_frames
- API_TOTALFRAME.call(@value)
- end
- def goto_frame(goal_frame)
- API_GOTOFRAME.call(@value, goal_frame)
- end
- def x
- @sprite.x
- end
- def x=(v)
- @sprite.x = v
- end
- def y
- @sprite.y
- end
- def y=(v)
- @sprite.y = v
- end
- def z
- @sprite.z
- end
- def z=(v)
- @sprite.z = v
- end
- def width
- @sprite.bitmap.width
- end
- def height
- @sprite.bitmap.height
- end
- def loop?
- @loop
- end
- def loop=(v)
- if @loop != v
- @loop = v
- API_SETLOOP.call(@value, v)
- end
- end
- def msg_to_flash(msg, wParam, lParam)
- return API_SENDMSG.call(@value, msg, wParam, lParam)
- end
- # 例
- WM_MOUSEMOVE = 0x0200
- def make_long(a, b)
- return (a & 0xffff ) | (b & 0xffff) << 16
- end
- def on_mouse_move(x, y)
- return msg_to_flash(WM_MOUSEMOVE, 0, make_long(x, y))
- end
- end
- module Kernel
- alias origin_exit exit unless method_defined? :exit
- def exit(*args)
- RMFlash.clear_all
- origin_exit(*args)
- end
- end
- #fls = RMFlash.load("2.swf", 640, 480)
- #while true
- # Graphics.update
- # Input.update
- # fls.update
- # break if Input.trigger?(13)
- #end
- #fls.dispose
- #exit
- =begin
- class RMFlash
- API_NEW = Win32API.new("RMFlash", "_new", "piil", "l")
- API_UPDATE = Win32API.new("RMFlash", "_update", "l", "v")
- API_FREE = Win32API.new("RMFlash", "_free", "l", "v")
- #def self.new(*args)
- # obj = super(*args)
- # obj.send :initialize, *args
- # obj
- #end
- def initialize(flashname, fw, fh)
- end
- end
- RMFlash.new
- exit
- =end
复制代码
在
new("#{CUR_PATH}/#{name}".u2s, width, height, v)
的
#{CUR_PATH}/
和
#{name}
之間插入一個路徑
可以改變放影片檔的地方
例如
new("#{CUR_PATH}/move/#{name}".u2s, width, height, v)
就是遊戲資料夾的move資料夾
-----
使用方式是在遊戲中
於地圖上或是公用事件插入下面腳本 (2014/05/25)
- fls = RMFlash.load("goldom.swf",544,416)
- fls.x = 0
- fls.y = 0
- fls.loop = 0
- while true
- Graphics.update
- Input.update
- fls.update
- break if !fls.playing?
- break if Input.trigger?(Input::B)
- end
- fls.dispose
复制代码
$scene = Scene_Map.new 加了是為了解決影片畫面會滯留的問題
而 (Input::A) 是說按下 A鍵 取消播放
可依照設計者的狀況做更改
AvB_2.swf 是影片檔名` 可改成自己要用的
但是副檔名一律要是swf
640,480 是解析度(顯示的大小)
fls.x = 0 fls.y = 0 是顯示時候的x軸y軸起點
如果要讓遊戲開頭放op
在腳本編輯器的main裡面加入這個腳本 或是 新建一個腳本
這個腳本只使用swf檔
可用格式工廠進行轉檔
來源: 66RPG
協助: 釣到一隻猴子
(猴子兄 都不知道在忙啥阿)
另外我想有些從xp開始玩的人應該會對vx只有544*416 有點不習慣
以下是66rpg看到的擴展方法
在main里加入Graphics.resize_screen(640,480) ......... (放begin的上面就好)
Spriteset_Map 裡面修改 "viewport.new" 的数值(544,416修改为640,480)
Game_Map:
@margin_x = (width - 這邊改20
@margin_y = (height - 這邊改15
@display_y = [@display_y + distance, (height - 改15
@display_x = [@display_x + distance, (width - 改20
"-" 的後面一定要空一格 |
评分
-
查看全部评分
|