Project1
标题:
【备份】蚂蚁的帖子
[打印本页]
作者:
redant
时间:
2009-4-24 21:29
标题:
【备份】蚂蚁的帖子
本帖最后由 redant 于 2009-8-10 23:09 编辑
【序】
算做个备份吧 以后回来也容易看
4.24 【关于雷子的《零之血嗜》引发的……】
TAG【桃花纷飞、图片旋转、事件脚本】
昨晚偶尔翻出雷子的标题作品 原来只是看看效果 昨儿算是正式开工程看了看
因为 有我想知道的效果 【桃花纷飞】
for i in 15..30
$game_screen.pictures[i].show(
"title_fly1.png",1,300+rand(40),
500+rand(40),rand(50),rand(50),255,1)
$game_screen.pictures[i].rotate(rand(30))
end
for i in 31..40
$game_screen.pictures[i].show(
"title_fly2.png",1,300+rand(40),
500+rand(40),rand(50),rand(50),255,1)
$game_screen.pictures[i].rotate(rand(30))
end
循环
for i in 15..40
$game_screen.pictures[i].fly
$game_screen.pictures[i].rotate(rand(30))
end
以上反复
复制代码
26。显示图片
$game_screen.pictures[图片编号].show("图片名字", 原点, 画面x坐标, 画面y坐标, x轴放大率, y轴放大率, 不透明度, 显示方式)
这个稍微复杂些,分开来讲会比较好~~~
图片名字就是要显示的图片的名字。
原点就是显示图片的原点位置,0代表左上,1代表中心。
画面的x坐标和y坐标就是图片原点的画面的x坐标和y坐标。
x轴放大率和y轴放大率就是以原点为中心的x方向和y方向放大率,100为正常大小。
不透明度就是图片的不透明度,为0到255。
显示方式其实就是图片的合成方式,0是正常,1是加法,2是减法。
比如$game_screen.pictures[1].show("BunnyGod", 1, 320, 240, 100, 100, 255, 0)
就是在画面中心显示一张正常大小,完全不透明,显示方式为正常,编号为1的叫做BunnyGod的图片。
27。移动图片
$game_screen.pictures[图片编号].move(移动时间, 原点, 画面x坐标, 画面y坐标, x轴放大率, y轴放大率, 不透明度, 显示方式)
原理和显示图片一样,由于图片已经显示,所以原本的图片名字也变成了移动时间。
比如$game_screen.pictures[1].move(20, 0, 0, 0, 100, 100, 0, 0)
就是在20帧内移动编号为1的图片并让其渐渐消失(注意:图片的移动都是渐变式的,不仅是位置,图片的大小和透明度也会跟着一起渐渐变化,就是用来做淡出和淡入图片用的。)。
28。旋转图片
$game_screen.pictures[图片编号].rotate(旋转速度)
这个旋转速度是由什么来决定的呢?到底代表着什么?其实这个代表的就是图片在每1帧内的旋转角度,而不是“速度”,由于旋转角度大了,自然速度看起来就快。这个值可以是负数,用来决定旋转的方向。正数是顺时针转,负数是逆时针转。
比如$game_screen.pictures[1].rotate(18)就是让一号图片以每帧18度的速度旋转。
29。图片消失
$game_screen.pictures[图片编号].erase
比如$game_screen.pictures[1].erase就是让编号为1的图片消失。
复制代码
rand(所有数) 雷子设定除了不透明度和显示方式以外 全部随机
fly 是自己定义的 让我好找= =|
#--------------------------------------------------------------------------
# ● 以下内容应用在飞翔粒子刷新
#--------------------------------------------------------------------------
def fly
if @number%3==1
@x -= 6
@y -= 6
@opacity -=3
elsif @number%3==2
@x -= 4
@y -= 4
@opacity -=2
else
@x -= 3
@y -= 3
@opacity -=1
end
if @opacity < 5 or @x < -100 or @y < -300 or @y > 500
@x = rand(900)+100
@y = rand(360)+150
@opacity = 200
end
end
复制代码
就能做出 花瓣纷飞 大小 旋转不一的情况 [LINE]1,#dddddd[/LINE]
本贴由论坛斑竹redant结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^
#==============================================================================
class Window_Picture_Command2 < Window_Selectable
attr_accessor :last_index
attr_accessor :active
attr_accessor :icon_name
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize(commands,type=2)
# 由命令的个数计算出窗口的高
super(0, 0, 640, 480)
@item_max = commands.size
@commands = commands
@name_sprite = nil
@dash = []
@sprite = []
@icon_name = icon_name
@last_icon = @icon_name
@count = 0
@type = type
@move_index = self.index
self.opacity = 0
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@name_sprite.dispose unless @name_sprite.nil?
for sprite in @sprite
sprite.dispose unless sprite.nil?
end
@name_sprite = nil
draw_com_name #if Momo_IconCommand::COM_NAME_DROW
@sprite = []
for i in 0...@item_max
draw_picture_item(i, @type)
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
for index in @dash
if @sprite[index] != nil
@sprite[index].dispose
@sprite[index].bitmap.dispose
end
end
end
#--------------------------------------------------------------------------
# ● 描绘图片项目
# index : 项目编号
# type : 描绘类型
# type = 1 只支持键盘
# type = 2 双面支持
#--------------------------------------------------------------------------
def draw_picture_item(index, type)
@sprite[index] = Sprite.new
@sprite[index].z = 9998
if @commands[index][0] == nil
p "图片名设置有误"
end
if @commands[index][1] == nil
p "图片X坐标设置有误"
end
if @commands[index][2] == nil
p "图片Y坐标设置有误"
end
bitmap = RPG::Cache.picture(@commands[index][0])
@sprite[index].bitmap = bitmap
@sprite[index].x = @commands[index][1]
@sprite[index].y = @commands[index][2]
@sprite[index].index = index
for i in
[email protected]
@sprite[i].update
end
# @sprite[index].update
if $xiaoshi == true
@sprite[index].opacity = 0
end
if @sprite[index].index != self.index
@sprite[index].opacity = 155
else
@sprite[index].opacity = 255
end
@dash.push(index)
end
#--------------------------------------------------------------------------
# ● 刷新图片项目
#--------------------------------------------------------------------------
def update_item
if Mouse.get_mouse_pos != nil
$mouse_x,$mouse_y = Mouse.get_mouse_pos
end
if @type == 2 and $stop == false
for index in @dash
if @sprite[index] != nil
top_x = @sprite[index].x
top_y = @sprite[index].y
bottom_x = top_x + @sprite[index].bitmap.width
bottom_y = top_y + @sprite[index].bitmap.height
if ($mouse_x > top_x) and ($mouse_y > top_y) and
($mouse_x < bottom_x) and ($mouse_y < bottom_y)
self.index = @sprite[index].index
if @move_index != self.index
if $xiaoshi == true
else
Se.ok
end
@move_index = self.index
end
end
if $xiaoshi == true
@sprite[index].opacity = 0
else
if @sprite[index].index != self.index
@sprite[index].opacity = 240
else
@sprite[index].opacity = 255
end
end
end
end
elsif @type == 1
for index in @dash
if @sprite[index].index != self.index
@sprite[index].opacity = 155
else
@sprite[index].opacity = 255
end
end
end
end
#--------------------------------------------------------------------------
# ● 图片项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
@sprite[index].opacity = 155
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias window_picture_command_update update
def update
window_picture_command_update
update_item
icon_update
com_name_update
if @active
@count += 1
icon_flash
@count = 0 if @count == 20
else
@count = 0
end
if self.active
# 判断当前光标位置
case @last_index
when 0 # 攻击
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 光标指向物品
$game_system.se_play($data_system.cursor_se)
@index = 3
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 光标指向攻击
$game_system.se_play($data_system.cursor_se)
@index = 3
end
# 方向键右被按下的情况下
if Input.repeat?(Input::RIGHT)
# 光标指向防御
$game_system.se_play($data_system.cursor_se)
@index = 2
end
# 方向键左被按下的情况下
if Input.repeat?(Input::LEFT)
# 光标指向法术
$game_system.se_play($data_system.cursor_se)
@index = 1
end
when 1 # 法术
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 光标指向物品
$game_system.se_play($data_system.cursor_se)
@index = 3
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 光标指向攻击
$game_system.se_play($data_system.cursor_se)
@index = 0
end
# 方向键右被按下的情况下
if Input.repeat?(Input::RIGHT)
# 光标指向防御
$game_system.se_play($data_system.cursor_se)
@index = 2
end
# 方向键左被按下的情况下
if Input.repeat?(Input::LEFT)
# 光标指向法术
$game_system.se_play($data_system.cursor_se)
@index = 2
end
when 2 # 防御
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 光标指向物品
$game_system.se_play($data_system.cursor_se)
@index = 3
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 光标指向攻击
$game_system.se_play($data_system.cursor_se)
@index = 0
end
# 方向键右被按下的情况下
if Input.repeat?(Input::RIGHT)
# 光标指向防御
$game_system.se_play($data_system.cursor_se)
@index = 1
end
# 方向键左被按下的情况下
if Input.repeat?(Input::LEFT)
# 光标指向技能
$game_system.se_play($data_system.cursor_se)
@index = 1
end
when 3 # 物品
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
# 光标指向物品
$game_system.se_play($data_system.cursor_se)
@index = 0
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
# 光标指向攻击
$game_system.se_play($data_system.cursor_se)
@index = 0
end
# 方向键右被按下的情况下
if Input.repeat?(Input::RIGHT)
# 光标指向防御
$game_system.se_play($data_system.cursor_se)
@index = 2
end
# 方向键左被按下的情况下
if Input.repeat?(Input::LEFT)
# 光标指向法术
$game_system.se_play($data_system.cursor_se)
@index = 1
end
end
@last_index = self.index
end
end
#--------------------------------------------------------------------------
# ● 更新光标举行
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
self.cursor_rect.set(x+5000, y, cursor_width, 32)
end
#######################
def draw_com_name
@name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
end
####################
def icon_update
for i in
[email protected]
@sprite[i].update
end
end
def icon_flash
if @count % 20 == 0 or @count == 2
@sprite[index].flash(Color.new(255, 255, 255, 128), 10)
end
end
############
def text_reset
@count = 0
@x_plus = 0
self.bitmap.clear
src_rect = Rect.new(0, -5, 560, 128)
back_help = Bitmap.new("Graphics/system/menu/back/特技框.png")
self.bitmap.blt(0, -5, back_help, src_rect, 255)
#定义蓝色(很PL 不是吗?) Momo_IconCommand::COM_NAME_COLOR
self.bitmap.font.size = 16
#文字的大小
case @name
when "攻击"
self.bitmap.font.color = Color.new(255, 10, 10, 255)
when "特技"
self.bitmap.font.color = Color.new(255, 255, 0, 255)
when "物品"
self.bitmap.font.color = Color.new(5, 255, 0, 255)
when"防御"
self.bitmap.font.color = Color.new(5, 20, 255, 255)
end
self.bitmap.draw_text(25, 0, 260, 32, @name)
end
def com_name_update
# if move_index?
@name_sprite.name = get_com_name
if self.x<100#80
@name_sprite.x = self.x + 275
elsif self.x < 200#150
@name_sprite.x = self.x + 279
else self.x < 300#220
@name_sprite.x = self.x + 282
end
if self.y<200#190
@name_sprite.y = 145
elsif self.y < 300#250
@name_sprite.y = 210
else self.y < 400#320
@name_sprite.y= 295
end
# 文字出现的坐标 以固定在下面
#+ Momo_IconCommand::COM_NAME_Y_PLUS
@name_sprite.z = 9998 #self.z + 1
@name_sprite.active = self.active
@name_sprite.visible = self.visible
@name_sprite.update
end
def get_com_name
make_name_set if @name_set.nil?
name = @name_set[self.index]
name = "" if name.nil?
return name
end
def make_name_set
@name_set = []
@name_set[0] = Momo_IconCommand::ATTACK_NAME
@name_set[1] = Momo_IconCommand::SKILL_NAME
@name_set[2] = Momo_IconCommand::GUARD_NAME
@name_set[3] = Momo_IconCommand::ITEM_NAME
#@name_set[4] = Momo_IconCommand::ESCAPE_NAME
end
def move_index?
return self.index != @last_index
end
def need_reset
@name_sprite.need_reset = true# if Momo_IconCommand::COM_NAME_DROW
end
def need_reset?
return (@name != @last_name or @need_reset)
end
end
#==============================================================================
# ■ Se
#------------------------------------------------------------------------------
# ■ 音效模块
#==============================================================================
module Se
def self.ok
$game_system.se_play($data_system.cursor_se)
end
def self.no
$game_system.se_play($data_system.cancel_se)
end
end
#==============================================================================
# ■ Sprite
#------------------------------------------------------------------------------
# ■ index 选择光标
#==============================================================================
class Sprite
attr_accessor :index
end
复制代码
鼠标结合图标战斗的脚本 部分功能没实现 不过我要的功能还有 哇卡 足够了
#==============================================================================
# ■ 完整鼠标系统(八方向)
#------------------------------------------------------------------------------
# 使用时务必配合专用寻路算法
# By whbm
#==============================================================================
#下面做一下介绍与使用说明:
# 在屏幕上单击鼠标的时候,会自动进行寻路,这里为了速度更快并且为了进行迷
#宫时的难度寻路被限定在当时的屏幕内部。(否则玩家直接点到终点,呵呵....知道
#后果了吧)
# 在角色移动过程中再次单击鼠标(即双击)并在单击第二次鼠标的时候不松手,
#角色将会跟随鼠标方向移动。(这个应该好理解,不用多说吧)当角色贴着欲被启动
#的事件的时候,单击NPC即可启动事件。若未贴着,将会产生自动寻路到NPC附近的某
#点,那时在单击NPC即可。
# 当鼠标停在某些事件上时候会发现有不同的图标,设置方法为:宝箱事件请在事
#件的执行内容中添加 注释,注释内容为 Item 注意大小写。NPC事件请在事件的执行
#内容中添加 注释注释内容为 NPC 注意大小写。若不箱改变某事件的图标,则不要写
#那两个注释。
# 当把脚本转到您工程的时候千万别忘了那个寻路用的脚本。
#==============================================================================
class Game_Event
attr_accessor :flag
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
# 处理地图的类。包含卷动以及可以通行的判断功能。
# 本类的实例请参考 $game_map 。
#==============================================================================
class Game_Map
def show_rate(event)
return 1
end
#--------------------------------------------------------------------------
# ● 检查鼠标处是否有自定义的事件并返回类型
#--------------------------------------------------------------------------
def check_event_custom(mouse_x, mouse_y)
for event in $game_map.events.values #循环所有事件检查
rate = show_rate(event)
event_width = (RPG::Cache.character(event.character_name,event.character_hue).width / $c3_每一步的帧数) * rate
event_height = (RPG::Cache.character(event.character_name,event.character_hue).height / 8) * rate
if mouse_x > event.screen_x - event_width / 2 and mouse_x < event.screen_x + event_width / 2 and mouse_y + 32 > event.screen_y + 32 - event_height and mouse_y + 32 < event.screen_y + 32
for i in 0...event.list.size
if event.list[i].parameters[0] == "Item" #类型判断
event.flag = 1
elsif event.list[i].parameters[0] == "Npc" #类型判断
event.flag = 2
elsif event.list[i].parameters[0] == "Place"
event.flag = 3
else
event.flag = 0 if $game_player.get_mouse_sta != 3 #无标志
end
return event.flag #返回事件类型标志
end
end
end
return 0 if $game_player.get_mouse_sta != 3 #如果不是在跟随鼠标状态,则返回无标志
return $mouse_icon_id #使鼠标图不变化
end
#--------------------------------------------------------------------------
# ● 检查鼠标处是否有事件可以开启
#--------------------------------------------------------------------------
def check_event_custom_start(mouse_x, mouse_y)
for event in $game_map.events.values #循环所有事件检查
#事件角色图片宽度、高度
rate = show_rate(event)
event_width = (RPG::Cache.character(event.character_name,event.character_hue).width / $c3_每一步的帧数) * rate
event_height = (RPG::Cache.character(event.character_name,event.character_hue).height / 8) * rate
#判断是否鼠标在事件上
if mouse_x > event.screen_x - event_width / 2 and mouse_x < event.screen_x + event_width / 2 and mouse_y + 32 > event.screen_y + 32 - event_height and mouse_y + 32 < event.screen_y + 32
way_x = $game_player.x - event.x
way_y = $game_player.y - event.y
if [1,0,-1].include?($game_player.x-event.x) and [1,0,-1].include?($game_player.y-event.y)
for i in 0...event.list.size
if ["Item","Npc","Place"].include?(event.list[i].parameters[0]) #当事件属于自定义事件
#判断主角朝向
if way_x == -1
p_direction = 3 if way_y == -1
p_direction = 6 if way_y == 0
p_direction = 9 if way_y == 1
elsif way_x == 0
p_direction = 2 if way_y == -1
p_direction = 8 if way_y == 1
else
p_direction = 1 if way_y == -1
p_direction = 4 if way_y == 0
p_direction = 7 if way_y == 1
end
event.start #开启事件
return 1, p_direction #返回即将开启事件以及角色朝向
end
end
end
end
end
return 0, 5 #返回不会开启事件以及角色朝向不变
end
#--------------------------------------------------------------------------
# ● 检查鼠标处是否存在自定义事件 for 寻路
#--------------------------------------------------------------------------
def check_event_custom_exist(mouse_x, mouse_y)
for event in $game_map.events.values #循环所有事件检查
#事件角色图片宽度、高度
rate = show_rate(event)
event_width = (RPG::Cache.character(event.character_name,event.character_hue).width / $c3_每一步的帧数) * rate
event_height = (RPG::Cache.character(event.character_name,event.character_hue).height / 8) * rate
if mouse_x > event.screen_x - event_width / 2 and mouse_x < event.screen_x + event_width / 2 and mouse_y + 32 > event.screen_y + 32 - event_height and mouse_y + 32 < event.screen_y + 32
for i in 0...event.list.size
return 1, event if ["Item", "Npc","Place"].include?(event.list[i].parameters[0]) #返回存在自定义事件以及事件体
end
end
end
return 0, event #返回不存在自定义事件,以及事件体
end
end
#=================以下两个用来调整战斗时的手感问题,可以自己试试。
$敌人选框扩大 = 20
$角色选框扩大 = 30
#==============================================================================
# ● API调用
#==============================================================================
$ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
$GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
$ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
$GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
$Window_HWND = $GetActiveWindow.call
$GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
module Mouse
LEFT = 0x01
RIGHT = 0x02
#---------------------------
# ● 等待函数
#----------------------------
def self.wait(duration)
for i in 0...duration
#update所有 尤其是queding 以及图像
# Input.update
# update
# hua_d
# queding
break if i >= duration
end
end
#############################
def self.init(sprite = nil)
$ShowCursor.call(0)
@show_cursor = false
#############################
@mouse_sprite = Sprite.new
@mouse_sprite.z = 99999
# @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/mouse')
# @mouse_sprite.src_rect.set(0,0,32,32)
@j = 0
@k = 0
##########################
@left_press = false
@right_press = false
@left_trigger = false
@right_trigger = false
@left_repeat = false
@right_repeat = false
@click_lock = false
update
end
def self.exit
@mouse_sprite.bitmap.dispose
@mouse_sprite.dispose
@show_cursor = true
$ShowCursor.call(1)
end
def self.mouse_debug
return @mouse_debug.bitmap
end
def self.update
############################
# wait(8)
@mouse_sprite.src_rect.set(0+@j*32,0+@k*32,32,32)
if @j >=3
@j = 0
@k += 1
if @k >= 7
@k = 0
end
end
#@j+=1 下次变换图片
@j+=1
#########################
left_down = $GetKeyState.call(0x01)
right_down = $GetKeyState.call(0x02)
if Graphics.frame_count * 3 / Graphics.frame_rate != @total_sec
@total_sec = Graphics.frame_count * 3 / Graphics.frame_rate
@a = !@a
end
if $scene.is_a?(Scene_Map) == false
$mouse_icon_id = 0
end
if $mouse_icon_id != $mouse_icon_id_last
case $mouse_icon_id
when 1
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/GetItem')
when 2
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/TalkTo')
when 3
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 11
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 12
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 13
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 14
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 16
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 17
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 18
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 19
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/Mouse')
when 0
@mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/mouse')
end
@mouse_sprite.src_rect.set(0,0,32,32)
$mouse_icon_id_last = $mouse_icon_id
end
@click_lock = false
mouse_x, mouse_y = self.get_mouse_pos
if @mouse_sprite != nil
@mouse_sprite.x = mouse_x
@mouse_sprite.y = mouse_y
end
if left_down[7] == 1
@left_repeat = (not @left_repeat)
@left_trigger = (not @left_press)
@left_press = true
else
@left_press = false
@left_trigger = false
@left_repeat = false
end
if right_down[7] == 1
@right_repeat = (not @right_repeat)
@right_trigger = (not @right_press)
@right_press = true
else
@right_press = false
@right_trigger = false
@right_repeat = false
end
end
def self.get_mouse_pos
point_var = [0, 0].pack('ll')
if $GetCursorPos.call(point_var) != 0
if $ScreenToClient.call($Window_HWND, point_var) != 0
x, y = point_var.unpack('ll')
if (x < 0) or (x > 10000) then x = 0 end
if (y < 0) or (y > 10000) then y = 0 end
if x > 640 then x = 640 end
if y > 480 then y = 480 end
return x, y
else
return 0, 0
end
else
return 0, 0
end
end
##############################K'#######################################
def self.kk_trigger?(mouse_code)
if mouse_code == LEFT
return @left_trigger
elsif mouse_code == RIGHT
return @right_trigger
else
return false
end
end
def self.in?(rect)
mouse_x, mouse_y = Mouse.get_mouse_pos
return (mouse_x > rect.x and mouse_x < rect.x + rect.width and mouse_y > rect.y and mouse_y < rect.y + rect.height)
end
##############################K'#######################################
def self.press?(mouse_code)
if mouse_code == LEFT
if @click_lock
return false
else
return @left_press
end
elsif mouse_code == RIGHT
return @right_press
else
return false
end
end
def self.trigger?(mouse_code)
if mouse_code == LEFT
if @click_lock
return false
else
return @left_trigger
end
elsif mouse_code == RIGHT
return @right_trigger
else
return false
end
end
def self.repeat?(mouse_code)
if mouse_code == LEFT
if @click_lock
return false
else
return @left_repeat
end
elsif mouse_code == RIGHT
return @right_repeat
else
return false
end
end
def self.click_lock?
return @click_lock
end
def self.click_lock
@click_lock = true
end
def self.click_unlock
@click_lock = false
end
end
module Input
if @self_update == nil
@self_update = method('update')
@self_press = method('press?')
@self_trigger = method('trigger?')
@self_repeat = method('repeat?')
end
def self.update
@self_update.call
Mouse.update
end
def self.press?(key_code)
if @self_press.call(key_code)
return true
end
if key_code == C
return Mouse.press?(Mouse::LEFT)
elsif key_code == B
return Mouse.press?(Mouse::RIGHT)
else
return @self_press.call(key_code)
end
end
def self.trigger?(key_code)
if @self_trigger.call(key_code)
return true
end
if key_code == C
return Mouse.trigger?(Mouse::LEFT)
elsif key_code == B
return Mouse.trigger?(Mouse::RIGHT)
else
return @self_trigger.call(key_code)
end
end
def self.repeat?(key_code)
if @self_repeat.call(key_code)
return true
end
if key_code == C
return Mouse.repeat?(Mouse::LEFT)
elsif key_code == B
return Mouse.repeat?(Mouse::RIGHT)
else
return @self_repeat.call(key_code)
end
end
end
##################################K'################################
class Window_Selectable
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
self_update
if self.active and @item_max > 0
index_var = @index
tp_index = @index
mouse_x, mouse_y = Mouse.get_mouse_pos
mouse_not_in_rect = true
for i in (top_row * @column_max)...[@item_max ,top_row * @column_max + page_item_max].min
@index = i
update_cursor_rect
top_x = self.cursor_rect.x + self.x + 16
top_y = self.cursor_rect.y + self.y + 16
bottom_x = top_x + self.cursor_rect.width
bottom_y = top_y + self.cursor_rect.height
if (mouse_x > top_x) and (mouse_y > top_y) and
(mouse_x < bottom_x) and (mouse_y < bottom_y)
mouse_not_in_rect = false
if tp_index != @index
tp_index = @index
$game_system.se_play($data_system.cursor_se)
end
break
end
end
if mouse_not_in_rect
@index = index_var
update_cursor_rect
Mouse.click_lock
if Mouse.kk_trigger?(Mouse::LEFT)
x1 = self.x + self.contents.width / 2 + 8
y1 = self.y + self.height - 16 #
y2 = self.y - 4
rect_down = Rect.new(x1,y1,24,24)
rect_up = Rect.new(x1,y2,24,24)
# p Mouse.get_mouse_pos , rect_down
if Mouse.in?(rect_down)
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# 光标向后移动一页
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
if Mouse.in?(rect_up)
if self.top_row > 0
# 光标向前移动一页
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
else
Mouse.click_unlock
end
end
end
end
##################################K'################################
class Window_NameInput
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
self_update
if self.active
index_var = @index
mouse_x, mouse_y = Mouse.get_mouse_pos
mouse_not_in_rect = true
for i in (0...CHARACTER_TABLE.size).to_a.push(180)
@index = i
update_cursor_rect
top_x = self.cursor_rect.x + self.x + 16
top_y = self.cursor_rect.y + self.y + 16
bottom_x = top_x + self.cursor_rect.width
bottom_y = top_y + self.cursor_rect.height
if (mouse_x > top_x) and (mouse_y > top_y) and
(mouse_x < bottom_x) and (mouse_y < bottom_y)
mouse_not_in_rect = false
break
end
end
if mouse_not_in_rect
@index = index_var
update_cursor_rect
Mouse.click_lock
else
Mouse.click_unlock
end
end
end
end
class Window_InputNumber
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
self_update
mouse_x, mouse_y = Mouse.get_mouse_pos
if self.active and @digits_max > 0
index_var = @index
mouse_not_in_rect = true
for i in 0...@digits_max
@index = i
update_cursor_rect
top_x = self.cursor_rect.x + self.x + 16
bottom_x = top_x + self.cursor_rect.width
if (mouse_x > top_x) and (mouse_x < bottom_x)
mouse_not_in_rect = false
break
end
end
if mouse_not_in_rect
@index = index_var
update_cursor_rect
Mouse.click_lock
else
Mouse.click_unlock
end
end
if @last_mouse_y == nil
@last_mouse_y = mouse_y
end
check_pos = (@last_mouse_y - mouse_y).abs
if check_pos > 10
$game_system.se_play($data_system.cursor_se)
place = 10 ** (@digits_max - 1 - @index)
n = @number / place % 10
@number -= n * place
n = (n + 1) % 10 if mouse_y < @last_mouse_y
n = (n + 9) % 10 if mouse_y > @last_mouse_y
@number += n * place
refresh
@last_mouse_y = mouse_y
end
end
end
class Scene_File
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
mouse_x, mouse_y = Mouse.get_mouse_pos
Mouse.click_lock
idx = 0
for i in @savefile_windows
top_x = i.x + 16
top_y = i.y + 16
bottom_x = top_x + i.width
bottom_y = top_y + i.height
if (mouse_x > top_x) and (mouse_y > top_y) and
(mouse_x < bottom_x) and (mouse_y < bottom_y)
i.selected = true
if @file_index != idx
@file_index = idx
$game_system.se_play($data_system.cursor_se)
end
Mouse.click_unlock
else
i.selected = false
end
idx += 1
end
self_update
end
end
class Arrow_Enemy
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
mouse_x, mouse_y = Mouse.get_mouse_pos
idx = 0
for i in $game_troop.enemies do
if i.exist?
top_x = i.screen_x - self.ox
top_y = i.screen_y - self.oy
bottom_x = top_x + self.src_rect.width
bottom_y = top_y + self.src_rect.height
if (mouse_x > top_x - $敌人选框扩大) and (mouse_y > top_y - $敌人选框扩大) and
(mouse_x < bottom_x + $敌人选框扩大) and (mouse_y < bottom_y + $敌人选框扩大)
if @index != idx
$game_system.se_play($data_system.cursor_se)
@index = idx
end
end
end
idx += 1
end
self_update
end
end
class Arrow_Actor
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
mouse_x, mouse_y = Mouse.get_mouse_pos
idx = 0
for i in $game_party.actors do
# if i.exist?
top_x = i.screen_x - self.ox
top_y = i.screen_y - self.oy
bottom_x = top_x + self.src_rect.width
bottom_y = top_y + self.src_rect.height
if (mouse_x > top_x - $角色选框扩大) and (mouse_y > top_y - $角色选框扩大) and
(mouse_x < bottom_x + $角色选框扩大) and (mouse_y < bottom_y + $角色选框扩大)
if @index != idx
$game_system.se_play($data_system.cursor_se)
@index = idx
# end
end
end
idx += 1
end
self_update
end
end
#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
# 处理主角的类。事件启动的判定、以及地图的滚动等功能。
# 本类的实例请参考 $game_player。
# 鼠标控制角色的主程序
#==============================================================================
class Game_Player
if @self_alias == nil
alias self_update update
@self_alias = true
end
#--------------------------------------------------------------------------
# ● 得到鼠标的状态
#--------------------------------------------------------------------------
def get_mouse_sta
return @mouse_sta
end
#--------------------------------------------------------------------------
# ● 完整鼠标系统
#--------------------------------------------------------------------------
def update
mouse_x, mouse_y = Mouse.get_mouse_pos
@mtp_x = mouse_x
@mtp_y = mouse_y
unless $game_system.map_interpreter.running? and @mouse_sta == 2 #鼠标状态不为跟随状态
#得到鼠标图标方向
$mouse_icon_id = $game_map.check_event_custom(mouse_x,mouse_y) if not [11, 12, 13, 14, 16, 17, 18, 19].include?($mouse_icon_id)
else
#令鼠标图标为正常
$mouse_icon_id = 0 if @mouse_sta != 2
end
#单击鼠标时进行判断寻路或跟随
if Mouse.trigger?(Mouse::LEFT) #当点击鼠标时
unless $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing #各种无效情况的排除
#初始化
@mouse_sta = 1
p_direction = 5
#检查鼠标处能否开启事件
event_start,p_direction = $game_map.check_event_custom_start(mouse_x, mouse_y)
#若在移动中再次点击鼠标左键(即双击左键),则改鼠标状态为跟随状态
@mouse_sta = 2 if @paths_id != nil and @paths_id != @paths.size
if @mouse_sta != 2
#鼠标状态不为跟随状态则取数据并初始化路径
trg_x = (mouse_x + $game_map.display_x / 4) / 32
trg_y = (mouse_y + $game_map.display_y / 4) / 32
@paths = []
@paths_id = 0
if event_start == 0 #若不能开启事件
if trg_x != $game_player.x or trg_y != $game_player.y #若目标不为自身则开始寻路
find_path = Find_Path.new
@paths = find_path.find_player_short_path(trg_x, trg_y, @mtp_x, @mtp_y)
end
else #若能开启事件则改变角色朝向
@direction = p_direction
end
end
end
end
#开始移动
if @mouse_sta != nil and @mouse_sta == 1 #若鼠标状态为寻路状态
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing #排除无效情况
if @paths_id != nil and @paths != nil and @paths_id <= @paths.size #若没有完成路径
case @paths[@paths_id] #判断路径
when 6
@last_move_x = true
move_right
@paths_id += 1
@direction = 6
when 4
@last_move_x = true
move_left
@paths_id += 1
@direction = 4
when 2
@last_move_x = false
move_down
@direction = 2
@paths_id += 1
when 8
@last_move_x = false
move_up
@direction = 8
@paths_id += 1
#斜四方向
when 1
@last_move_x = false
move_lower_left
@direction = 1
@paths_id += 1
when 3
@last_move_x = false
move_lower_right
@direction = 3
@paths_id += 1
when 7
@last_move_x = false
move_upper_left
@direction = 7
@paths_id += 1
when 9
@last_move_x = false
move_upper_right
@direction = 9
@paths_id += 1
end
end
end
elsif @paths != nil and @mouse_sta == 2 #当鼠标状态为跟随,且在移动中
if Mouse.press?(Mouse::LEFT) #持续按住鼠标
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing #排除无效情况
#跟随方向判断并跟随
rate = $game_map.show_rate(self)
width = (RPG::Cache.character(self.character_name,self.character_hue).width / $c3_每一步的帧数) * rate
height = (RPG::Cache.character(self.character_name,self.character_hue).height / 8) * rate
self_ox = (self.screen_x - width / 2 + self.screen_x + width / 2) / 2
self_oy = (self.screen_y - height + self.screen_y) / 2
#self_ox = self.screen_x
#self_oy = self.screen_y
if (@mtp_x - self_ox)*(@mtp_x - self_ox) + (@mtp_y - self_oy)*(@mtp_y - self_oy) >= 961
if @mtp_x > self_ox
if self_oy - @mtp_y < 0.4 * (@mtp_x - self_ox) and
@mtp_y - self_oy < 0.4 * (@mtp_x - self_ox)
move_right
$mouse_icon_id = 16
@direction = 6
end
if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
@mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
move_lower_right
$mouse_icon_id = 13
@direction = 3
end
if @mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x ) and
@mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
move_upper_right
$mouse_icon_id = 19
@direction = 9
end
if @mtp_y - self_oy > 2.4 * ( @mtp_x - self_ox )
move_down
$mouse_icon_id = 12
@direction = 2
end
if @mtp_y - self_oy < - 2.4 * ( @mtp_x - self_ox )
move_up
$mouse_icon_id = 18
@direction = 8
end
end
if @mtp_x < self_ox
if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
@mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x )
move_left
$mouse_icon_id = 14
@direction = 4
end
if @mtp_y - self_oy > 0.4 * ( self_ox - @mtp_x ) and
@mtp_y - self_oy < 2.4 * ( self_ox - @mtp_x )
move_lower_left
$mouse_icon_id = 11
@direction = 1
end
if @mtp_y - self_oy < - 0.4 * ( self_ox - @mtp_x ) and
@mtp_y - self_oy > - 2.4 * ( self_ox - @mtp_x )
move_upper_left
$mouse_icon_id = 17
@direction = 7
end
if @mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
move_down
$mouse_icon_id = 12
@direction = 2
end
if @mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
move_up
$mouse_icon_id = 18
@direction = 8
end
end
end
#...................................................................
if @mtp_x > self_ox
if @mtp_y - self_oy > - 0.4 * ( @mtp_x - self_ox ) and
@mtp_y - self_oy < 0.4 * ( @mtp_x - self_ox )
$mouse_icon_id = 16
@direction = 6
end
if @mtp_y - self_oy > 0.4 * ( @mtp_x - self_ox ) and
@mtp_y - self_oy < 2.4 * ( @mtp_x - self_ox )
$mouse_icon_id = 13
@direction = 3
end
if @mtp_y - self_oy < - 0.4 * ( @mtp_x - self_ox ) and
@mtp_y - self_oy > - 2.4 * ( @mtp_x - self_ox )
$mouse_icon_id = 19
@direction = 9
end
if @mtp_y - self_oy > 2.4 * ( @mtp_x - self_ox )
$mouse_icon_id = 12
@direction = 2
end
if @mtp_y - self_oy < - 2.4 * ( @mtp_x - self_ox )
$mouse_icon_id = 18
@direction = 8
end
end
if @mtp_x < self_ox
if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
@mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x )
$mouse_icon_id = 14
@direction = 4
end
if @mtp_y - self_oy > 0.4 * ( self_ox - @mtp_x ) and
@mtp_y - self_oy < 2.4 * ( self_ox - @mtp_x )
$mouse_icon_id = 11
@direction = 1
end
if @mtp_y - self_oy < - 0.4 * ( self_ox - @mtp_x ) and
@mtp_y - self_oy > - 2.4 * ( self_ox - @mtp_x )
$mouse_icon_id = 17
@direction = 7
end
if @mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
$mouse_icon_id = 12
@direction = 2
end
if @mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
$mouse_icon_id = 18
@direction = 8
end
end
#...................................................................
end
else #没状态的情况
$mouse_icon_id = 0
@mouse_sta = 0
@paths_id = @paths.size #终止寻路移动
end
end
self_update
end
end
Mouse.init
END { Mouse.exit }
复制代码
这个东西 直接拷过来了 鼠标素材图就是4*8 估计以后还要改 先备个份
.青山不改,绿水长流,兄弟!后会有期!
驾~~~~~~
2.坏人:你倒是喊啊,你喊破喉咙也没人救你
女人:救命啊~~~~救命啊
好人:你这个恶贼,竟然敢在光天化日之下强抢民女,吃我一剑!
坏人:啊!~~~大侠饶命~
3.路人甲:此剑XX尺XX寸,重XX斤XX两
后面还有武侠大片,经典剧情
.背后疗伤法 多数是X主角受内伤或中毒后,要治伤势,必有一男的在背后双掌对其背部。两人一前一后盘腿坐下,后面的一顿猛拍,这时双手的上方会有烟雾出现,后面的一般双目紧闭。直到伤者的口里吐出血来,这时治疗全程结束。
2.脱衣去寒法 也是受重伤时发生的情节,通常倒楣的都会是女主角。女主角可能受了重伤,他们为了躲敌人,隐蔽到深山。而且,那个深山一定会下雨。女主角受不了寒冷,男主角此时往往就会用身体帮她取暖,要女主角把衣服脱了。但是女主角都会不干,所以男主角就会插插两下(点穴啦) 而且都会点两边肩膀那,哈哈~然后女主角就不动了。 如果有设计哑穴的话,男主角连哑穴也会点,然后就会,演下去……
3.两女共处法 如果武侠有那种2女都喜欢1男的情况,通常都会有几集是三个人因某种原因同时在一起,男主角喜欢的是女主角,但是女配角因为武功比较弱,所以都会因为保护男主角受伤,所以男主角就会对女配角好一点。这时候女主角就一定会留书出走,曰:“我成全你们!xxx是个好姑娘!你要好好对待她!”然后就不见了。
4.下雨躲庙法 这个剧情也是很让人开心的喔! 而且不是山神庙就是土地庙,反正那神都要拿大刀立着然后呢!我们就会看到破庙扔猩火,男女主角各把淋湿的衣服都披在“晾衣绳”上,透过火光,2人都……你可不要想歪哦,没有一丝不挂,都会穿着白色衣物的
5武侠界绝顶客栈 龙门客栈:打架专用,你如果看到有人打架,背景大多是。 悦来客栈:中国最大的连锁店面经营由此开始了,你可以在各省份中看到他的分店,无论是江南还是塞北,就算在远赴西藏,上面还是斗大四个汉字--悦来客栈。
6.被蛇咬伤时 不管是男主角、或是女主角,在森林穿行时都会被毒蛇咬。这时没受伤的为了表示他/她的诚意,都会帮受伤的那人吸毒。而且在我的记忆中,女主角每次都会被咬到小腿,男主角都会被咬到手。女主角都会很害羞的不要,然后男主角就会被骂:你想死啊?然后偶而会被再插插两下点穴,被咬的小腿此刻露出肌肤,考验女主角的身材,哈哈!男主角通常被咬时,女主角都会被设计是不大会武功的,情急之下顾不得自身安危帮男主角吸血,然后自己会晕倒,最后男主角就感动,马上陷入情网。
7.蒙面纱法 这种事会发生在女主角身上。女的可能是有某种原因,脸上蒙面纱,不知道长什么样子。往往这样的女孩都美丽绝伦。但是要碰上玩世不恭的男主角,再一阵纠缠之下,男的无意中的掀起了女主角的面纱,然后就等着看男主角惊为天人的表情吧。
8.好人被冤枉法 好人一定会一直被陷害,被陷害的好人在看到尸体的时候,一定会呆呆的把插在死者身上的刀拔起(九成以上的几率),在这个时候,一定会有大批武林人士或死者的亲友冲进来指着好人大喊:“你!你为什么杀他?!”好人一定会拿着刚拔出的赃物,摇头说:“不是我!不是我!”接着众人一定会吼到:“证据确凿,你休想狡辩!”所以说啊,科学辩案很重要的哦。
9.关键时刻咽气法 记得当年看射雕时有一镜头, 江南七怪被杀于桃花岛,靖蓉赶到时有一人尚未咽气,欲写下文字提供线索,他竟然写杀我者乃……然后再写下一横一竖时。正好咽气。其实白痴都知道他要写谁杀的他,而且最可笑的是他撑着写这四个字的时间,已经足够写两遍——西毒了。
10.主角不死定律 主角在乱刀、乱箭、乱棍之中怎么都打不死,配角一上就伤,反派一击即死!·
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1