Bitmap Vs Sprite

Status
Not open for further replies.

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,060
Reaction score
441
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,816
Reaction score
5,506
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,060
Reaction score
441
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,158
Reaction score
4,295
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

How do you do when you want to work on projects but the game companies make so many games available for free because of the quarantine?
Kes
I have just stepped down from being a Mod, so please don't send me any more pm's with Mod questions. Thanks
The laptop I've had for almost 3 years has blue screened and is stuck on a boot loop. Can't wait to make games on nothing!
Made a brief video showcasing early game play... Got a copyright claim by BIG UP! (https://big-up.style/) for using music I bought from here (Future Steam Punk Pack). Now I wonder if I should strip any purchased music from here out of my game. :LZSskeptic:
Cleaned character animation and new room


I'm not sure if I should open a thread for this in games in development..

Forum statistics

Threads
95,475
Messages
929,439
Members
125,717
Latest member
Schiraz
Top