moJoe

Villager
Member
Joined
Mar 10, 2021
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMMV
Yo!
Quick question: is there a way to change the .tint of only a section of a Sprite? For example:

JavaScript:
var IconSet = new Sprite();
IconSet.bitmap = ImageManager.loadSystem('IconSet');
IconSet.tint = 0x666666// Darken this only for one Icon as its clicked; keeping all other Icons with an unchanged tint;

Long story short I'm trying to create multiple buttons from one Sprite that changes tints per Button as a Button is clicked.

Any help would be greatly appreciated. :)
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,419
Reaction score
1,830
First Language
EN
Primarily Uses
RMMZ
The default Sprite#tint property applies to the entire Sprite object. To tint only an area of an image I think you'd have to manually draw a semi-transparent overlay, either by blitting (could damage the cache if you're not careful) or a separate Sprite...

Instead, I suggest simply making one sprite per button. You can still load the sheet as a single image, but adjust each button's frame so it only shows one clickable part per button. Then you should be able to tint each button separately.

You may find it helpful to check out the code for Sprite_Button (rpg_sprites.js) and how it is used in the core scripts (rpg_windows.js), especially if your buttons have rectangular hitboxes. :kaohi:

Alternatively you could search for a plugin that lets you interact with events and/or pictures by clicking, then do everything else with event commands, e.g. Tint Picture?
 

moJoe

Villager
Member
Joined
Mar 10, 2021
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMMV
@caethyril Yep, multiple sprite_buttons seems like the way to go. Just wanted to make sure the alternative of tinting a section wasn't possible before I dived in - considering that there's gonna' be a lot of buttons. Thank you!
 

Latest Threads

Latest Profile Posts

Generate Actors, Dark Fantasy Monsters, & I Heard There Was a Chosen One, | RPG Maker News #42

Work on Cat Quest: The Last Catmancer continues slowly but surely. :kaopride: Today I received the Game Over screen from @Finnuval!
GameOver.png
Hey everyone! No Studio Blue RPG Maker Critiques Stream today! But you can always check the playlist for old streams you've missed!

I ran out of paper sheets to draw, so I guess I'm forced to do digital for a while now...
x778xt8.jpg

Still haven0t found a colouring style that I like :kaoswt:

Forum statistics

Threads
111,443
Messages
1,061,144
Members
144,806
Latest member
HowlingMeteor277
Top