A dilemma in plugin production

Status
Not open for further replies.

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,710
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi people!
I need some opinions or advice.

I'm making a plugin that changes Sprite_Timer and Game_Timer.

And it has 3 functions that each one changes the timer image:
startTimerImage / middleTimerImage / finalTimerImage

I think these functions should stay with Sprite_Timer.prototype, since it handles the sprites.
However, I'm in a dilemma to put them in Game_Timer.prototype, and call them in Sprite_Timer.prototype via $gameTimer.middleTimerImage(param);

Because I want the user to be able to use a script call if he wants. I know that he can use Sprite_Timer.prototype.startTimerImage(param) if he wants too, but the script calls are common with $gameTimer...

Or should I make them in Sprite_Timer and in Game_Timer too?

JavaScript:
Sprite.prototype.startTimerImage = function(param){
    // code
};

Game_Timer.prototype.startTimerImage = function(param){
    Sprite.prototype.startTimerImage(param);
};
hahaha, it's not a big deal(or it is? =O), just want to know what you guys think about that what method can be a good practice while making plugins ^^
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
954
Reaction score
520
First Language
Javascript
Primarily Uses
RMMZ
...perhaps even... the Sprite gets the main/real code and the game_timer gets a wrapper like function?
...this way it's really using the Sprite's object for easier manipulation but then can be called/etc. with $gameTimer

Edit:
now I see you did say that above lol
anyways yeah... that's what I would probably do use one to call the other base one, just seems simplest and efficient too.

You could even then create a whole separate function like startTimerImage(param, [timer]) knowing that you would just use $gameTimer as the default if timer parameter isn't specified ;)
Code:
function startTimerImage(param, timer){timer = timer || $gameTimer; timer.startTimerImage(param);}
Seems a bit redundant but could be useful if multiple timer objects.
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,714
First Language
English
Primarily Uses
RMMV
If you mean putting something in Game_Timer that contains a sprite object, I'd say no, because I think that's what causes save files to break (can't save the sprite object).

You could have something in Game_Timer that determines what timer image will be displayed (similar to Game_Character having the name of the file the walking sprite comes from), but do all actual sprite stuff within the sprite class.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,710
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
@ct_bolt
multiple timer objects
Do you mean, multiple timers on the screen? hahaha! I thought about that, but I do not think that will be launched in the first version xD

@Shaz
Hmmm... let's see if I understand you.
If I want to change the color of the Timer Image, I can write a function in Game_Timer that gives me an array: [150, 20, 75, 150];

Then in Sprite_Timer.prototype.update, for example, I put a function that changes the color of the timer image.
this._timerImage.setColorTone(return here the array in game timer);

That would be something like that?

[EDIT] or if I use this inside Game_Timer, I would escape from what you say?
SceneManager._scene._spriteset._timerSprite._timerImage.setColorTone(array);

If you mean putting something in Game_Timer that contains a sprite object, I'd say no, because I think that's what causes save files to break (can't save the sprite object).
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,714
First Language
English
Primarily Uses
RMMV
Oh no, I thought you meant to put a sprite object as a variable in the Game_Timer class.

What is the startTimerImage, middleTimerImage and endTimerImage? What sort of functionality are you having in them? What are the actual images you're going to display?

Without knowing much about how you plan to put it together, I'd probably lean towards creating a Sprite_Timer class (if there isn't one there already), and linking it to Game_Timer.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,710
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
@Shaz Sorry, I edit the post in the time you post another answer xD
In fact, I will do not change a sprite image or create a new one. I just want to change a property of the sprite. Like the color, position x or y, blend, opacity, etc...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,714
First Language
English
Primarily Uses
RMMV
Oh yes, in that case I'd put the value into Game_Timer, and the player will be able to change that, and make the sprite class check that value.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,867
Reaction score
5,240
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.

 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,547
Members
137,835
Latest member
yetisteven
Top