void Light() {
SDL_SetAlpha(yellow, SDL_SRCALPHA, 80);
Draw(yellow, xpos+20, ypos);
}
It blits a surface called yellow, which is simply a yellow 40x40 cube on the player, but i need it to be only on the player. I tried blitting it not onto surface "screen" but on the "player" surface, then, it works as it should, but i can''t erease it after its blitten once. What could i do?
[SDL] Primitive 2d light effects, problems....
I want to do a primitive light effect when the players gun is fired, i simply do this:
Blitting it onto the player surface keeps it on the plaeyr surface.
you''d need two player surfaces one with the effect, and one without.
and as long as you''re doing that, why not go draw a nicer looking effect on the player and laod it as the image with the gun firing?
you''d need two player surfaces one with the effect, and one without.
and as long as you''re doing that, why not go draw a nicer looking effect on the player and laod it as the image with the gun firing?
You're blitting it directly to the player surface which means it'll stay there because you change the pixel values in the player bitmap to erase it you'd have to reload the player image from it's file. However constantly doing that would not be a good idea. One solution would be to have another copy of the player surface you could use and overwrite the one you put the yellow square on when you want to erase it.
[edit]C-Junkie beat me to it, and I'd recomend his solution of drawing your own nicer version of the light effect[/edit]
[edited by - Monder on April 12, 2004 10:01:23 AM]
[edit]C-Junkie beat me to it, and I'd recomend his solution of drawing your own nicer version of the light effect[/edit]
[edited by - Monder on April 12, 2004 10:01:23 AM]
Why not just draw it on the gamescreen directly? Just keep updating the effect for, say, 200-300 ticks, then stop. Next redraw, it''ll be gone.
i like the idea of drawing it as a whole new sprite. You could make it much more precise and cool that way.
no, i mean have the character_normal sprite, then a character_when_gun_fires sprite. Swap the two when your fire the gun instead of trying to overlay two graphics. It''s not very dynamic, but it would look really nice.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement