RMMZ Reposition Game_Timer?

Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
251
Reaction score
117
First Language
English
Primarily Uses
RMMZ
Looking for a way to shift the location of the Game_Timer, just to find out that in the base code that its just... there. Its not a window, so moving it isn't as simple as I was expecting. :/

Its counted as a Game_Object, but it doesn't have any x/y/width/height assigned to it... so how does one go about trying to move this item around or am I going to have to simply make a plugin that re-creates it as a window?

Asking because my custom made HUD covers the entire top of the screen, so the timer needs to be shifted down and to the right so it wont be behind other windows.


Edit: It was far too early in the morning for coding, after some breakfast and caffeine I was able to solve this issue with a bit more digging. The timer is counted as a Sprite and I had accidently overlooked it where it had an option to reposition it. I also added in hours since by default if the timer is over 1 hour it goes back to only showing minutes/seconds, which looked very confusing.

For those wanting to move it around: rmmz_sprites.js, line: 3035
if you want/need to add hours to it, you can use this:
Code:
Sprite_Timer.prototype.timerText = function() {
    const hour = Math.floor(this._seconds / 60 / 60) % 60
    const min = Math.floor(this._seconds / 60) % 60
    const sec = this._seconds % 60
    if (hour >= 1) {
        return hour.padZero(1) + ":" + min.padZero(2) + ":" + sec.padZero(2)
    }
    else if (min >= 10) {
        return min.padZero(2) + ":" + sec.padZero(2)
    }
    else {
        return min.padZero(1) + ":" + sec.padZero(2)
    }
}
 
Last edited:

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
160
Reaction score
232
First Language
French, German
Primarily Uses
RMMZ
You're looking for the Sprite_Timer, specifically:
Code:
Sprite_Timer.prototype.updatePosition = function() {
    this.x = (Graphics.width - this.bitmap.width) / 2;
    this.y = 0;
};
That's the code from MZ, but it should be the same for MV.
 

Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
251
Reaction score
117
First Language
English
Primarily Uses
RMMZ
@Nolonar its a bit ironic that you sent that about 5 minutes after I had edited my post saying I had solved the problem, lol

Thanks for responding anyways! :D
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
160
Reaction score
232
First Language
French, German
Primarily Uses
RMMZ
Sorry, I didn't notice there was an edit :kaoswt2:
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,619
Reaction score
5,157
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I always told my DA fans how much I hate slot machines. They're fine in games as a risk-and-reward system. But when you're spending REAL MONEY in a Vegas casino to try and hit the jackpot (which very, very few people will), it can really hurt your budget. Gambling is a bad habit, and I don't like wasting my money on a slim chance. Go to Vegas for the experience, not the jackpot.
Took the kids to a corn maze. They gave us a map and had lights at certain points in the maze. Not overwhelming... or underwhelming... just... whelming.
Okay, vacuuming fruit flies out of the air is surprisingly effective.
Finally finished my menu redesign after like a month of coding! I hate designing menus... Good news though - I thought of a complete redesign for it now, so yay...
Still no scam calls all day... also I got a quick gig designing a mascot drawing for a small business, so I might actually make some green of my own after all. That would be a perfect job for me, since I love art and digital design.

Forum statistics

Threads
104,388
Messages
1,006,025
Members
135,916
Latest member
RewSYso
Top