While following the scrolling tutorial for the XNA Platformer Starter Kit (3.1), I ran into an issue with the Level.Draw() method. This problem only occurs if you are using XNA 4.0 or higher with the tutorial.
In the tutorial (http://msdn.microsoft.com/en-us/library/dd254919(v=xnagamestudio.31).aspx) it has the line -
spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None, cameraTransform);
But this fails, as the SpriteBatch.Begin() signature and SpriteBlendMode Enum has changed in XNA 4.0.
Instead, use the following line (or pass in NULL(s) for default parameter options.
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null, cameraTransform);
Example Passing in NULLs -
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cameraTransform);
Hopefully this will save someone a a few minutes! =^]
Hey, did you get the whole script to work on XNA 4.0?
I need some help with it. Can you help me? Email me preferably.
FYI – There is a download for the XNA 4 platformer sample on App Hub.
http://create.msdn.com/en-US/education/catalog/sample/platformer