Feel free to make posts to this forum. If people have questions that you know the answers to, feel free to reply to them. If enough people ask about certain topics, I'll make a tutorial for it.
Just playing around with your sprite tutorials (Smiley animation at this stage). In regards to using a texture atlas (character animation) where you have a background color on each frame (say black). Is there a way so you can your main game background say blue and when you place your character on top of your background, make XNA block out the black background in the texture atlas.
I thought it may have been something to do with graphics.GraphicsDevice.Clear(Color.Black); but that doesn't seem to work.
Sorry it took a while to respond. I've been out of town.
Perhaps the best way to do what you are trying to do is to make an image that has transparency in it to begin with. I actually thought that the image I had uploaded had transparency, but now that you mention it, I think I probably need to do that still.
If the area around your object is transparent, then I think the problem should take care of itself. But if not, you might need to tell it to use alpha blending, which is just a small change…. Use the line below:
The other thing that you could do is use SpriteBlendMode.Additive here, instead, which will cause your colors to be 'added' together. In this case, black stuff ends up being transparent, but then things that are kind of black end up being kind of transparent, which probably isn't exactly what you want in this case. The tutorial on Additive Blending with Sprites might help, if this is what you are trying to do.
But it sounds like what you really want is just an image that is transparent in the background, and then use alpha blending, like I said at first.
Hopefully that helps get you going!
(I'll try to get you an image of the smiley animation that is transparent too.)
First of all i like to thank you for providing this excellent web site about xna, i sure have learned a lot about XNA :D. I was checking out your Content pipeline Extension tutorial and a couple of questions came up. First i was wondering what kind of things i can do in the importer. You said it wasn't for processing that's what the content processor is for, but i was wondering, if i had a file that is for a specific level, and it contains more than an array, like objects, events, etc. How do you recommend reading the information. I mean it could eassly be put into a level object, but if i did that then what good is my content processor? You also said that if i had a database i could put them in the database in the importer, so i can do all my insert querys in the importer? and like the question b4, then why would i need the processor? Mi other question is when you said taht after the processor, the data structure is then placed in a temporary xnb, so when you read the file using the content type reader
protected override TRead Read(ContentReader input, TRead existingInstance)
is the TRead existingInsstance the data structure stored in the xnb?
Also is it possible to use the XML deserializer when reading the files in the importer? Im sorry that i have so many questions, and i hope it isn't to much trouble to answer them. Thank you very much
OK, let's see how to go about answering all of these…. :) In the end, it doesn't really matter where you do different things. The idea is that you separate importing and processing stuff into the Importer and Processor, but it really doesn't matter where you do it. In the end, all you really need is for the ContentTypeReader to load an object that contains the data that you want. So theoretically, you could really just do nothing with it until it gets to the ContentTypeReader, and then do all of your work. Like I said, it really doesn't matter where you do the different things. It's not like the C# compiler will say "Hey! What are you doing?! You're doing processing in the Importer. I can't compile this!"
Having said that, it is a good idea to separate the two things (importing and processing) logically into the two different components of the content pipeline. A big reason to do this is that you can reuse a content processor if multiple content importers can get their data into sort of a standardized format. This is how the content pipeline works for Model objects. For example, there is an importer for .fbx models called something like FbxModelImporter and another one for .x models called something like XModelImporter, but they both share a common processor called ModelProcessor. There are also ways that you could share an importer, and then use different processors after that, as well. So it is mostly about reusability.
As far as serialization goes, that sounds like a great idea. Using something like XML serialization in C# would probably do a great job in the ContentTypeWriter and the ContentTypeReader. I've never used that, but it seems like it would work well. If you get around to doing it that way, let me/us know how it turns out.
The TRead existingInstance should theoretically be an existing instance of the type of object that you are reading in, but in my experience, it is pretty much just null. For a while I wondered if it would create a default instance if I had a constructor of my class with no arguments (something like public Level()), but it doesn't seem to really matter what kind of constructors you have, it always is null. I have one other idea about this, but I'll need to experiment for a little while, so I might put a follow up post later today or tomorrow, but like I said, it seems to be null most of the time.