赞 | 6 |
VIP | 4 |
好人卡 | 58 |
积分 | 5 |
经验 | 58579 |
最后登录 | 2024-6-30 |
在线时间 | 1478 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 508
- 在线时间
- 1478 小时
- 注册时间
- 2011-9-17
- 帖子
- 1316
|
本帖最后由 iisnow 于 2011-10-30 13:34 编辑
工程、脚本做好了:
方法:
$scene.other_timer(time)
设置第二个时间
$scene.get
得到,第二个时间剩余(误差1s)
$scene.off
关闭第二个时间
由于对Sprit……类的研究不多,脚本很粗糙
脚本:
- class Scene_Map
- def other_timer(time)
- @spriteset.other_timer(time)
- end
-
- def get
- return @spriteset.get_time
- end
-
- def off
- @spriteset.off
- end
-
-
- end
- class Spriteset_Map
- def other_timer(time)
- @timer_sprite.show_other(time)
- end
-
- def get_time
- return @timer_sprite.get_other
- end
-
- def off
- @timer_sprite.off
- end
-
- end
- class Sprite_Timer < Sprite
- def initialize
- super
- self.bitmap = Bitmap.new(88, 48)
- self.bitmap.font.name = "Arial"
- self.bitmap.font.size = 32
- self.x = 640 - self.bitmap.width
- self.y = 0
- self.z = 500
- @other = Sprite_Timer_Other.new
- update
- end
-
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
- if @other.bitmap != nil
- @other.dispose
- end
- super
- end
-
- def update
- super
- self.visible = $game_system.timer_working
- @other.update
- if $game_system.timer / Graphics.frame_rate != @total_sec
- self.bitmap.clear
- @total_sec = $game_system.timer / Graphics.frame_rate
- min = @total_sec / 60
- sec = @total_sec % 60
- text = sprintf("%02d:%02d", min, sec)
- self.bitmap.font.color.set(255, 255, 255)
- self.bitmap.draw_text(self.bitmap.rect, text, 1)
- end
- end
-
- def show_other(time)
- @other.show(time)
- end
-
- def get_other
- return @other.get_time
- end
-
- def off
- @other.showing = false
- @other.time = -1
- $game_time_space = -1
- end
-
- end
- class Sprite_Timer_Other < Sprite
- attr_accessor :showing
- attr_accessor :time
- def initialize
- super
- self.bitmap = Bitmap.new(88, 48)
- self.bitmap.font.name = "Arial"
- self.bitmap.font.size = 32
- self.x = 640 - self.bitmap.width
- self.y = 40
- self.z = 500
- if $game_time_space == nil
- @showing = false
- $game_time_space = 0
- @time = -1
- else
- if $game_time_space < 0
- @showing = false
- @time = -1
- else
- @showing = true
- @time = $game_system.timer - $game_time_space
- end
- end
- update
- end
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
- super
- end
-
- def update
- super
- if @time <= 0
- self.visible = @showing
- @showing = false
- $game_time_space = -1
- return
- end
- @time = $game_system.timer - $game_time_space
- self.visible = @showing
- if @time / Graphics.frame_rate != @total_sec
- self.bitmap.clear
- @total_sec = @time / Graphics.frame_rate
- min = @total_sec / 60
- sec = @total_sec % 60
- text = sprintf("%02d:%02d", min, sec)
- self.bitmap.font.color.set(255, 255, 255)
- self.bitmap.draw_text(self.bitmap.rect, text, 1)
- end
- end
-
复制代码
Project4_i.rar
(252.22 KB, 下载次数: 12)
改好了~
再试试…… |
|