Bitmap Vs Sprite

Status
Not open for further replies.

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,073
Reaction score
446
First Language
Portuguese - Br
Primarily Uses
RMMV
Hi people!

I'm making some visual modifications to the timer.
So was messing around with the sprite functions and bitmap and I'm trying to understand a little bit of it.

So, what is the advantage of using one or another?
I mean, I can use the sprites to make the timer(the numbers) instead of using bitmap?
For example, if I want to add escape characters or icons in the timer, or even, make an animation for it to glow or raise its scale to make a breath effect in the numbers.
How should I approach that? Go all in sprites? Or stay with the bitmap, like the default code?
Because I notice that I can change opacity with the sprite.opacity. But I cannot do that with bitmap(maybe if I change the alpha value).
Well, I'm a little lost, so any tips for me will be cool!
Thanks!
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
965
Reaction score
708
First Language
English
Primarily Uses
RMMV
@Eliaquim Well, an empty bitmap is essentially a blank canvas onto which you can 'paint' images and text. Each sprite contains a bitmap. The sprite has code to deal with opacity, rotation, and so on that a bitmap by itself does not have.

In the case of the default RPG Maker timer, the bitmap which the time is being painted to is already set to a sprite. So, if you want to tinker with the opacity of the entire timer, it would be fairly easy to do so in the Sprite_Timer code with minimal work.

However, if you want to animate each individual digit of the timer, it would probably be best to create a separate sprite (and bitmap) for each digit. Adjusting the code of Sprite_Timer is probably the easiest way to do so. Convert the current time into a string, break the string up into single digits, create a new sprite (and bitmap) for each digit, paint the digits to the bitmap of each sprite, set the x/y values to line up the digits beside each other, and so on.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,828
Reaction score
5,519
First Language
Indonesian
Primarily Uses
RMVXA
So, what is the advantage of using one or another?
No, both complement each other.

Sprite contains bitmap, sprite handler the x,y position of the bitmap, opacity, and other functions. It can even tell to display a slight portion of the bitmap which is the reason why you don't see a full SV battler sheet, but instead, a frame of them (it's handled in the Sprite).
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,073
Reaction score
446
First Language
Portuguese - Br
Primarily Uses
RMMV
Ok! I think I can get it a little better now.
When do you mean by creating another sprite(and a bitmap), I have to create like another:
Code:
Sprite_TimerBackground.prototype(etc...)
Or is it for me to create other sprites and bitmaps inside the Sprite_Timer?
Like:
Code:
Sprite_Timer.prototype.createBitmapBackground = function() {
    this.bitmapBackground = new Bitmap(96, 48);
    etc....
};
With this method above, I manage to add an image, but it is always above the timer.

But, when I create a different Sprite(Sprite_TimerBackground.prototype(etc...)), I manage to put it below the timer, but I have to change the functions to add it at a lower layer of the timer:

Code:
Spriteset_Base.prototype.createUpperLayer
Well, anyways, What do you think is the best approach?

I also think to create a window to be displayed below the timer. So what is best to do in this case, make a window for me to use as a background? Or create the background using sprite?

EDIT1:
Oh! I think I understand the logic now!
Code:
Sprite_Timer.prototype.createBitmap = function() {
    this.background = new Sprite()
    this.background.bitmap = ImageManager.loadSystem("raze");//new Bitmap(this.timer.bitmap.width, this.timer.bitmap.height));
    //this.background.bitmap.gradientFillRect(0, 0, 96, 48, 'green', 'blue', false);
    //
    this.timer = new Sprite();
    this.timer.bitmap = new Bitmap(Eli.Param.SuperTimer.Width, Eli.Param.SuperTimer.Height);
    this.timer.bitmap.fontSize = Eli.Param.SuperTimer.FontSize;
    this.timer.bitmap.fontFace = Eli.Param.SuperTimer.FontFace;
    this.timer.bitmap.fontItalic = Eli.Param.SuperTimer.Italic;
    this.timer.bitmap.textColor = Eli.Param.SuperTimer.TextColor;
    this.timer.bitmap.outlineColor = Eli.Param.SuperTimer.OutlineColor;
    this.timer.bitmap.outlineWidth = Eli.Param.SuperTimer.OutlineWidth;
    this.opacity = Eli.Param.SuperTimer.Opacity;
    this.blendMode = Eli.Param.SuperTimer.Blend;
    //

    this.addChild(this.background);
    this.addChild(this.timer);
};
 
Last edited:

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,178
Reaction score
4,299
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 Posts

Latest Profile Posts

Well, looks like I need to build myself a quest system. Or really just a system for "Helpful voices" to talk to the player. I'm sure nothing will go wrong listening to them.... They're "helpful". :LZSwink:

Should be pretty easy with PIXI just letting me write all over the screen. :LZSexcite:
I'm starting to think I just dont like anime since the last one I enjoyed was none of them.
It's still here...
Hi guys, Im new here. Im using RPGMMV. In this community i would like to learn more and become better rpg developer.
The main character for the first game was originally going to become a member of the party in the third game but I'm probably changing him to an important NPC instead. That brings the third game's total ensemble roster down to nine with one optional secret character.

Forum statistics

Threads
95,591
Messages
930,301
Members
125,896
Latest member
Yilou
Top