Applying an image to a sprite.

Blitz3D Forums/Blitz3D Beginners Area/Applying an image to a sprite.

D_Town_Tony(Posted 2004) [#1]
I want to apply blood, cuts, etc to my character as he gets hurt, I am able to apply just flat color but am so far unable to use images of blood splatter and such, anyone able to help.


Sunteam Software(Posted 2004) [#2]
How are you applying the flat colours? Is this a 2D or 3D question?


D_Town_Tony(Posted 2004) [#3]
3D.


jhocking(Posted 2004) [#4]
Sprites aren't really the best way to do cuts and blood on characters. They work well for bulletholes on walls, footprints on the ground, etc. but for stuff on characters you usually want to alter the texture of the model, possibly altering/swapping the main texture or possibly using masked textures on a new texture layer.

That said, applying an image to a sprite is just like applying a texture to any other entity. Seriously, use the command EntityTexture to apply the images to your sprites.


D_Town_Tony(Posted 2004) [#5]
I messed up with the title of this thread. I want to add blood,cuts,burn effects to characters as well as background objects, I've been looking at the texture paint example by David Bird that came with blitz and rather then just painting with a solid color like red(when it goes over skin colors it gets a little to neon) I'd like to use an image if possible, any idea how this can be doen.


Sunteam Software(Posted 2004) [#6]
I think because you can't access the texture on an entity you'll need to keep a copy of the texture(s) image for each entity then when applying you simply set the buffer to the texture buffer drawimage at the right place/orientation and then reapply the texture.

However someone else might know a better way.


eBusiness(Posted 2004) [#7]
I think it is possible to multitexture, at least it is with lightmaps, I'm not shure what commands to use.


FlameDuck(Posted 2004) [#8]
(when it goes over skin colors it gets a little to neon)
Use a different blend mode. To draw from one texture to another, take a look at the CopyRect function.


Genexi2(Posted 2004) [#9]
at the right place/orientation


And how would you find that exactly btw?


D_Town_Tony(Posted 2004) [#10]
When I use a different texture blend the texture just becomes invisble


jhocking(Posted 2004) [#11]
"And how would you find that exactly btw?"

I'm not sure what he meant by orientation, but for place you'd use the VertexU and VertexV commands on the vertices of the polygon collided against to determine the UV coordinates of that polygon. Then DrawImage to the pixel coordinates corresdponding to those UV coordinates.

That's all a real pain however, and probably wouldn't work well due to seams in the texture mapping. But who knows; that's certainly the most accurate way to do things. Maybe Terabit (aka Mr. Tattoo) has some advice here.