设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 85|回复: 0

[转载发布] ToggleTimer XP

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58751
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68660

    灌水之王

    发表于 2026-7-26 18:51:41 | 显示全部楼层 |阅读模式
    ToggleTimer XP

    by Kyonides


    Introduction

    Do you want to be able to show or hide the default game timer?
    Then don't wait anymore and start using my script right away!


    It also includes a feature to let you set its horizontal alignment with ease.

    Please read the embedded comments before using it.

    The Script

                    Ruby:       
    1. # * ToggleTimer XP * #
    2. #   Scripter : Kyonides
    3. #   2024-11-28
    4. # This scriptlet allows you to show or hide the default timer.
    5. # It lets you set its horizontal alignment as well.
    6. # There are just 2 CONSTANTS that you need to configure here.
    7. # Warning! 3 Methods Have Been Modified #
    8. # Sprite_Timer: initialize & update
    9. # Interpreter:  command_124 (Control Timer)
    10. # * Script Calls * #
    11. # - Show Timer - #
    12. # $game_system.show_timer = true
    13. # - Hide Timer - #
    14. # $game_system.show_timer = false
    15. # - Align Timer - #
    16. # Alignment Options: 0 or :left, 1 or :center & 2 or :right
    17. # Example:
    18. # $game_system.align_timer = :left
    19. # OPTIONAL: Set Hidden Timer #
    20. # hidden_timer(minutes, seconds)
    21. module KTimer
    22.   DEFAULT_VISIBLE = true
    23.   # Alignment Options: 0 or :left, 1 or :center & 2 or :right
    24.   ALIGN_X = :right
    25. end
    26. class Game_System
    27.   alias :kyon_toggle_timer_gm_sys_init :initialize
    28.   def initialize
    29.     kyon_toggle_timer_gm_sys_init
    30.     @show_timer = KTimer::DEFAULT_VISIBLE
    31.     @align_timer = KTimer::ALIGN_X
    32.   end
    33.   attr_accessor :show_timer, :align_timer
    34. end
    35. class Sprite_Timer
    36.   def initialize
    37.     super
    38.     @width = 88
    39.     self.bitmap = Bitmap.new(@width, 48)
    40.     self.bitmap.font.name = "Arial"
    41.     self.bitmap.font.size = 32
    42.     refresh_align_x
    43.     self.y = 0
    44.     self.z = 500
    45.     update
    46.   end
    47.   def refresh_align_x
    48.     case @align_x = $game_system.align_timer
    49.     when 0, :left
    50.       self.x = 0
    51.     when 1, :center
    52.       self.x = 320 - @width / 2
    53.     when 2, :right
    54.       self.x = 640 - @width
    55.     end
    56.   end
    57.   def update
    58.     super
    59.     return unless $game_system.timer_working
    60.     self.visible = $game_system.show_timer
    61.     if $game_system.align_timer != @align_x
    62.       refresh_align_x
    63.     end
    64.     if $game_system.timer / Graphics.frame_rate != @total_sec
    65.       self.bitmap.clear
    66.       @total_sec = $game_system.timer / Graphics.frame_rate
    67.       min = @total_sec / 60
    68.       sec = @total_sec % 60
    69.       text = sprintf("%02d:%02d", min, sec)
    70.       self.bitmap.font.color.set(255, 255, 255)
    71.       self.bitmap.draw_text(self.bitmap.rect, text, 1)
    72.     end
    73.   end
    74. end
    75. class Interpreter
    76.   def command_124
    77.     if @parameters[0] == 0
    78.       $game_system.timer = @parameters[1] * Graphics.frame_rate
    79.       $game_system.timer_working = true
    80.     end
    81.     if @parameters[0] == 1
    82.       $game_system.timer_working = false
    83.       $game_system.show_timer = false
    84.     end
    85.     true
    86.   end
    87.   def hidden_timer(min, sec)
    88.     time = min * 60 + sec
    89.     $game_system.timer = time * Graphics.frame_rate
    90.     $game_system.timer_working = true
    91.     $game_system.show_timer = false
    92.     true
    93.   end
    94. end
    复制代码


    Terms & Conditions

    Free for use in ANY game.
    Due credit is acceptable.
    Mention this forum as well.
    That's it!



    本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/toggletimer-xp.173539/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-4 12:48 , Processed in 0.064225 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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