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

[转载发布] KModTimer ACE

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

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-8-3 07:56:48 | 显示全部楼层 |阅读模式
    KModTimer ACE
    Version 1.0.0

    by Kyonides Arkanthes


    Introduction

    This is a simple scriptlet that provides some extra features for your timer sprite like custom font name and size and even a colored background. The last feature can be deactivated as well.

    The embedded comments include a list of all the newly available script calls.

    The Script

                    Ruby:       
    1. # * KModTimer ACE * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   v1.0.0 - 2023-05-02
    4. # * Script Calls * #
    5. # - Reset Timer's Setup
    6. # $game_timer.reset
    7. # - Change Timer's X Alignment - Positions: :left, :center or :right
    8. # $game_timer.pos_x = X-Alignment
    9. # $game_timer.font_name = "Font Name"
    10. # $game_timer.font_size = Number
    11. # $game_timer.set_font("Font Name", Number)
    12. # - Change the Font Color
    13. # $game_timer.font_color(Red, Green, Blue)
    14. # $game_timer.font_color(Red, Green, Blue, Alpha)
    15. # - Change the Background Color
    16. # $game_timer.bg_color(Red, Green, Blue)
    17. # $game_timer.bg_color(Red, Green, Blue, Alpha)
    18. # - Toggle Background Color - Boolean: true or false
    19. # $game_timer.use_bg = Boolean
    20. module KModTimer
    21.   # Initial Values
    22.   FONT_NAME = "Arial"
    23.   FONT_SIZE = 32
    24.   # Color Ranges (0..255) [Red, Green, Blue, Alpha]
    25.   FONT_COLOR = [255, 255, 255, 255]
    26.   BG_COLOR   = [0, 0, 0, 80]
    27.   USE_BG_COLOR = true
    28.   # Choose the Position: :left, :center or :right
    29.   POSITION_X = :left
    30. # * End of Setup Section * #
    31.   extend self
    32.   attr_accessor :refresh
    33. end
    34. class Sprite_Timer
    35.   def create_bitmap
    36.     self.bitmap = Bitmap.new(96, 48)
    37.     bg_setup
    38.     font_setup
    39.   end
    40.   def bg_setup
    41.     @bg_color = Color.new(*$game_timer.bg_color)
    42.   end
    43.   def font_setup
    44.     font = self.bitmap.font
    45.     font.name = $game_timer.font_name
    46.     font.size = $game_timer.font_size
    47.     font.color.set(*$game_timer.font_color)
    48.   end
    49.   def redraw_backdrop
    50.     bm = self.bitmap
    51.     $game_timer.use_bg ? bm.fill_rect(bm.rect, @bg_color) : bm.clear
    52.   end
    53.   
    54.   def redraw
    55.     if KModTimer.refresh
    56.       KModTimer.refresh = nil
    57.       bg_setup
    58.       font_setup
    59.     end
    60.     redraw_backdrop
    61.     bitmap.draw_text(bitmap.rect, timer_text, 1)
    62.   end
    63.   def update_x
    64.     case $game_timer.pos_x
    65.     when :left
    66.       self.x = 0
    67.     when :center
    68.       self.x = (Graphics.width - self.bitmap.width) / 2
    69.     when :right
    70.       self.x = Graphics.width - self.bitmap.width
    71.     end
    72.   end
    73.   def update_position
    74.     update_x
    75.     self.y = 0
    76.     self.z = 200
    77.   end
    78. end
    79. class Game_Timer
    80.   include KModTimer
    81.   alias :kyon_mod_timer_gm_sys_init :initialize
    82.   def initialize
    83.     kyon_mod_timer_gm_sys_init
    84.     reset
    85.   end
    86.   def reset
    87.     @font_name = FONT_NAME.dup
    88.     @font_size = FONT_SIZE
    89.     @font_color = FONT_COLOR.dup
    90.     @bg_color = BG_COLOR.dup
    91.     @use_bg = USE_BG_COLOR
    92.     @pos_x = POSITION_X
    93.   end
    94.   def set_font(new_name, new_size)
    95.     KModTimer.refresh = true
    96.     @font_name = new_name
    97.     @font_size = new_size
    98.   end
    99.   def font_name=(new_name)
    100.     KModTimer.refresh = true
    101.     @font_name = new_name
    102.   end
    103.   def font_size=(new_size)
    104.     KModTimer.refresh = true
    105.     @font_size = new_size
    106.   end
    107.   def font_color(red, green, blue, alpha=255)
    108.     KModTimer.refresh = true
    109.     @font_color = [red, green, blue, alpha]
    110.   end
    111.   def bg_color(red, green, blue, alpha=255)
    112.     KModTimer.refresh = true
    113.     @bg_color = [red, green, blue, alpha]
    114.   end
    115.   def use_bg=(bool)
    116.     KModTimer.refresh = true
    117.     @use_bg = bool
    118.   end
    119.   attr_reader :font_name, :font_size, :font_color, :bg_color,  :use_bg
    120.   attr_accessor :pos_x
    121. end
    复制代码


    Terms & Conditions

    Feel free to use it.
    Optionally, you could include my nickname in your game credits.
    That's it.


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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 08:29 , Processed in 0.108848 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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