Project1
标题:
请教——被卡住的日夜交替
[打印本页]
作者:
kangxi0109
时间:
2011-8-30 22:39
标题:
请教——被卡住的日夜交替
打开——测试——控制主角在地图中疯狂的,不间歇的跑——
一般不会超过300步,卡住。
特此请教。
测试.rar
(199.34 KB, 下载次数: 41)
2011-8-30 22:38 上传
点击文件名下载附件
dsu_plus_rewardpost_czw
作者:
fux2
时间:
2011-8-30 23:01
本帖最后由 fux2 于 2011-8-30 23:02 编辑
给你一个以前写的昼夜系统吧.
精灵的昼夜.zip
(364.44 KB, 下载次数: 56)
2011-8-30 23:00 上传
点击文件名下载附件
# 创作 by fux2
# 改良 by 精灵
# 导航指令
# mistmara(true/false) 默认:mistmara(false) # 梦魇模式开/关
# settime(小时,分钟) 默认:settime(0,0) # 设定时间
# show(1/0,1/0,1/0) 默认:show(1,1,1) # 显示设置(图标,描述,时间)
# setstop(false) 默认:setstop(true) # 停止时间流动
# setcount(数字) 默认:setcount(1) # 每秒增加多少计数,默认60,现实的1秒等于游戏的1分
#============================================================================
# 之所以全部用全局变量是方便在存档的时候一起存进数据
$time_hour_now = 0 # 设定当前时针
$time_minute_now = 0 # 设定当前分针
$time_count = 60 # 设置时间流逝速度[初始1,每秒加1]
$time_stop_count = 0 # 备用时间流逝速度
$time_totalcount = 0 # 设置总时间
$blink = false # 秒针的闪烁
$time_icon = (($time_hour_now * 60 + $time_minute_now) / 90).to_i # 储存图标时间
$Mistmara_mode = false # 梦魇模式开关
$time_disrc = "凌晨" # 时间描述
$checktime = 0 # 核对时间
$check_tone_time = [] # 色调区间核对
$time_stop_hour = 0 # 临时时间
$time_stop_minute = 0 # 同上
$time_stop_totalcount = 0 # 同上
$showtimer = [1,1,1] # 是否显示时钟(图标,描述,时间)
class Icon < Window_Base
# 时间描述模块,前7组时间段[起始时间,结束时间],中7组时间段描述,后7组时间段色调[[R,G,B,灰],时间]
TIME_BLOCK = [[0,5],[6,8],[9,10],[11,13],[14,16],[17,18],[19,21],[22,23],"凌晨","早上","上午","中午","下午","傍晚","晚上","深夜",[[-102,-102,17,0],120],[[-51,-51,0,0],120],[[-10,-10,20,0],120],[[0,0,0,0],120],[[17,17,0,0],120],[[0,0,-64,0],120],[[-32,-32,64,0],120],[[-68,-68,0,0],120]]
def initialize
super(540,5,200,200)
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 255
self.contents = Bitmap.new(168, 168)
end
# 时间更改
def Time_Changed
unless $time_count == 0
if Graphics.frame_count / (Graphics.frame_rate / 2) != $checktime
$checktime = Graphics.frame_count / (Graphics.frame_rate/ 2)
if !$blink
$blink = true
if $time_totalcount + $time_count < 86400
$time_totalcount += $time_count
else
$time_totalcount = ($time_totalcount + $time_count) % 86400
end
$time_hour_now = $time_totalcount / 3600
$time_minute_now = ($time_totalcount % 3600) / 60
else
$blink = false
end
end
end
end
# 时间状态描述
def Get_time_disrc
if $Mistmara_mode
# 梦魇模式设置
$game_screen.start_tone_change(Tone.new(-136,-170,-102,153),10 * 2)
return "梦魇"
else
# 正常模式
for i in 0..7
if $time_hour_now >= TIME_BLOCK[i][0] && $time_hour_now <= TIME_BLOCK[i][1]
unless $check_tone_time == i
$game_screen.start_tone_change(Tone.new(TIME_BLOCK[i+16][0][0],TIME_BLOCK[i+16][0][1],TIME_BLOCK[i+16][0][2],TIME_BLOCK[i+16][0][3]),TIME_BLOCK[i+16][1].to_i * 2)
end
return TIME_BLOCK[i+8]
end
end
end
end
# 梦魇模式
def Mistmara_mode(statu)
if statu == true
$Mistmara_mode = true
$time_stop_hour, $time_stop_minute , $time_stop_totalcount = $time_hour_now, $time_minute_now, $time_totalcount
$blink = true
else
$Mistmara_mode = false
end
end
# 显示时钟以及文字
def Set_icon
self.Time_Changed
$time_icon = (($time_hour_now * 60 + $time_minute_now) / 90).to_i
$time_disrc = self.Get_time_disrc
self.contents.clear
self.contents.font.size = 20
if $Mistmara_mode
bitmap = Bitmap.new("Graphics/time/time_stop.png")
self.contents.draw_text(0,70,150,32,sprintf("%02d:%02d", $time_stop_hour, $time_stop_minute)) if $showtimer[2] == 1
else
bitmap = Bitmap.new("Graphics/time/time_#{$time_icon}.png")
if $blink
self.contents.draw_text(0,70,150,32,sprintf("%02d:%02d", $time_hour_now, $time_minute_now)) if $showtimer[2] == 1
else
self.contents.draw_text(0,70,150,32,sprintf("%02d %02d", $time_hour_now, $time_minute_now)) if $showtimer[2] == 1
end
end
src_rect = Rect.new(0, 0, 70, 70)
self.contents.blt(0, 0, bitmap, src_rect) if $showtimer[0] == 1
self.contents.draw_text(5,45,150,32,"#{$time_disrc}") if $showtimer[1] == 1
end
end
# 在地图描绘
class Scene_Map
alias fux2 main
def main
@icon = Icon.new
fux2
@icon.dispose
end
alias fux2update update
def update
@icon.Set_icon
fux2update
end
end
# 快捷指令
class Interpreter
def mistmara(statu)
if statu == true
Icon.new.Mistmara_mode(true)
else
Icon.new.Mistmara_mode(false)
end
return
end
def settime(hour,minute)
$time_hour_now = hour.to_i
$time_minute_now = minute.to_i
$time_totalcount = hour * 3600 + minute * 60
end
def setstop(time_stop = true)
if time_stop
unless $time_count == 0
$time_stop_count = $time_count
$time_count = 0
$blink = true
end
else
$time_count = $time_stop_count
end
end
def setcount(count)
$time_count = count.to_i
end
def show(icon,statu,time)
$showtimer = [icon.to_i,statu.to_i,time.to_i]
end
end
复制代码
作者:
各种压力的猫君
时间:
2011-8-31 00:45
本帖最后由 各种压力的猫君 于 2011-8-31 00:53 编辑
表示自己怎么跑都没卡住 = = 1.03版 win7
左上角的事件你写法不对。正确的写法应该是
自动执行
,然后第二行不需要执行公共事件,改成暂时消除事件。
因为开关打开之时那个并行公共事件就已经开始工作了。
——难道是因为这个错误的写法导致循环事件越来越多而耗尽内存卡住 = = ?
作者:
kangxi0109
时间:
2011-8-31 10:47
能用脚本解决就最好啦,在脚本中最好能够调用一些公共事件,以方便一些特殊变量的结算...因为昼夜交替系统是一个基本系统,还附庸有别的一些小系统。
kangxi0109于2011-8-31 18:03补充以下内容:
在下亦脚本盲耳...
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1