• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED image_blend in HTML5

Hey hi,

can anyone give any advice on how to correctly draw blended sprites in HTML5?

So I have this HTML5 project and I always use image_blend = make_color_hsv and for some to get drawn correctly I had to convert rgb to bgr, some do not get drawn at all and some do only use the first 4 blends.

sprite_set_cache_size also seems to do nothing unfortunately.

Any advice would be hugely appreciated! Thank you so much!

EDIT: Sometimes I have to convert rgb to bgr but actually there have been several unrelated problems mixed up that made it seem like image_blend wouldn't work. except somtimes having to convert the color it works perfectly fine
 
Last edited:

True Valhalla

Full-Time Developer
GMC Elder
Have you uploaded the game to a hosting service like Bluehost for testing purposes? Image blending can be inconsistent when testing locally so let's cross that off the list first.
 

FrostyCat

Redemption Seeker
The best practice with colour blending in HTML5 is to avoid it whenever possible. If you do have to use it, blend with as few distinct colours as you can. In particular, avoid tweening the blend colour.
 
Have you uploaded the game to a hosting service like Bluehost for testing purposes? Image blending can be inconsistent when testing locally so let's cross that off the list first.
I did upload it to 000webhost and it shows the described behaviour. But in this behaviour it is pretty much completely consistent. Always the same thing gets drawn with another color, the same thing doesnt get drawn at all etc.

The best practice with colour blending in HTML5 is to avoid it whenever possible. If you do have to use it, blend with as few distinct colours as you can. In particular, avoid tweening the blend colour.
That is definitely something I'm guilty of. But can this cause these problems? I thought it should work like stated in the manual for sprite_set_cache_size that at least the first few colors should be drawn correctly? I will tone that down and try again

EDIT: hm after a bit of testing I found out that draw_sprite_part_ext just doesnt work for html. It had nothing to do with the blending. No blending left in the game except image_blend = c_white; (does this still blend the sprite? how could you avoid it?) and it still doesn't work.
 
Last edited:
Top