Color gradient on sprite

L

lumini

Guest
Hi there! I've been working recently on a project and it is getting more and more to the final stage. But recently I have noticed that there is a huge impact on my game's speed. But let's explain.

Untitled.png

To accomplish the gradient in the picture I am blending the sprite for my ground ( using draw_sprite_general for both drawing and blending). Now the problem is, when I have a lot of instances in the room, the speed drops significantly , because every step the draw step is executed for every single instance. Also, the gradient is changing each second (by shifting the color), that's why it is executed every step.

My question here is: is there a different approach or a simpler way to draw a color gradient on a sprite like I provided? Please help... :) ^_^
 
S

Supercoder

Guest
Uh, I might be completely wrong, but how does your lighting script work? Aka if you take out the lighting code does it run normally?

As for the gradient, your method sounds fairly efficient. Something you could do is have a background that changes colour and covers the entire screen, and only have line shaped "holes" that show the rainbow pattern. You could probably accomplish this by drawing black to a surface, subtracting the walls, and drawing in, but don't quote me on that :p
 
L

lumini

Guest
Uh, I might be completely wrong, but how does your lighting script work? Aka if you take out the lighting code does it run normally?

As for the gradient, your method sounds fairly efficient. Something you could do is have a background that changes colour and covers the entire screen, and only have line shaped "holes" that show the rainbow pattern. You could probably accomplish this by drawing black to a surface, subtracting the walls, and drawing in, but don't quote me on that :p
I tried removing the lightning script and it does completely nothing to the game. It is still slow. But I managed to discover the problem here with your suggestions. Looks like the auto-tiling was making problems here. Thanks ! :)
 
Top