I am writing a time script that has a rotating graphic that represents the time of day. Here is the current sprite I am using:
$game_time.hour?(24) returns the current hour on the 24 hour clock. I can also use $game_time.hour?(12), which will only return 1-12. There are only 12 graphics to load.
The problem is, which ever hour I start on doesn't have a graphic. Every time it hits the starting hour (currently 2), the graphic doesn't load. I don't know why, though. I tried a bunch of things, but nothing worked.
Any help is appreciated. Peace.
Code:
class Sprite_Wheel < Sprite
def initialize
super()
self.bitmap = RPG::Cache.picture("Wheel#{$game_time.hour?(12)}")
self.x = 160
self.y = 460 - self.bitmap.height
refresh
end
def refresh
self.bitmap.clear
@hour = $game_time.hour?(12)
bitmap = RPG::Cache.picture("Wheel#{@hour}")
self.bitmap.blt(0, 0, bitmap, bitmap.rect)
end
def update
super
refresh if @hour != $game_time.hour?(12)
end
end
$game_time.hour?(24) returns the current hour on the 24 hour clock. I can also use $game_time.hour?(12), which will only return 1-12. There are only 12 graphics to load.
The problem is, which ever hour I start on doesn't have a graphic. Every time it hits the starting hour (currently 2), the graphic doesn't load. I don't know why, though. I tried a bunch of things, but nothing worked.
Any help is appreciated. Peace.