Troubleshooting this TutorialSometimes, even though you try hard to understand the information in a tutorial, things don't work out quite like you want it to. This page is here to help you resolve any problems you might be having with the Texture Atlases tutorial. The Common Mistakes section describes common problems that people have when doing the things in this tutorial, and how to resolve them. The Frequently Asked Questions section describes questions that people have that aren't related to mistakes, but rather, trying to understand the stuff better or exploring how it can be used. If your problem or concern isn't addressed here, feel free to add a comment below, so that I know where you're having trouble. I like to keep these pages fairly clean, so I may remove comments that I felt like have been addressed. If I remove your comment and you don't feel like the problem has been fixed, repost the question and we'll take another look at it. If a tutorial has a mistake in it, I will fix the mistake and reply to the comment with a brief explanation. However, after a couple of weeks I'll likely go back and remove the original comment as well as my reply, because, hopefully, the problem will have been fixed, and it won't be a concern any more. |
Common MistakesNone listed yet… |
Frequently Asked QuestionsNone listed yet… |


InvalidOperationException: when i build i get that error int my AnimatedSprite class file???
I'm also getting an InvalidOperationException error. in the AnimatedSprite class, it highlights spriteBatch.begin(); saying Begin cannot be called again until End has been successfully called.
Make sure you are only using spriteBatch.Begin in either the AnimatedSprite.cs file or the Game1.cs file. If you are using it in both, then you need to move the call "animatedSprite.Draw(spriteBatch, new Vector2(50, 50));" outside of the spriteBatch.Begin(); of the Game1.cs file.
Thank you very much for taking the time to post this helpful response.
I am getting a logical error. In animatedSprite class frame is changing whenever update is called but the draw function is called randomly…
Yeah, Update and Draw are not necessarily called back to back. It is possible, especially if you've set various extra properties for your game, that the game could be getting updated far more often than it is drawn (or the other way around).
From your other comment, it looks like you got the problem taken care of. Good work!
I found out the mistake…
I mixed up source rectangle's parameters…
I have a problem when running my program. It looks like the game is updated far more than it is drawn. Then the figure in the window (the image) is just blinking but is never changed. Any ideas? Thanks.
And another question. In XNA how can I slow down the motion, I mean the speed of the man?
Hi everyone im having the same problems as Szilard. Please post how you fixed your problem if so. Also having a problem with keyboard controls. I could move my static sprite fine now that i am trying to use an animated sprite i cannot move it.
I might be stupid, but in texture atlas part 2, it says "To create a new class, right click on your project in the Solution Explorer, and choose Add > New Item from the popup menu. The Add New Item dialog will appear. Select the Class template" however i can't find the class template anywhere.. I'm using Visual Studio 2010 if that helps
as suspected, i was stupid.. found it now, i was fiddling in contents:P
may i ask where you found it please… i cannot seem to find it
found it :)
the same problem here i cant find the class template where is it????
found it wtf xDDD
Trying to run the program kicks back the following errors:
Error 1 The type or namespace name 'Game1' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Aaron\Documents\Visual Studio 2010\Projects\WindowsGame1\WindowsGame1\WindowsGame1\Program.cs 13 20 WindowsGame1
Error 2 The type or namespace name 'Game1' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Aaron\Documents\Visual Studio 2010\Projects\WindowsGame1\WindowsGame1\WindowsGame1\Program.cs 13 37 WindowsGame1
Program.cs
using System;
namespace WindowsGame1
{
#if WINDOWS || XBOX
static class Program
{
/ <summary>
/ The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
using (Game1 game = new Game1())
{
game.Run();
}
}
}
#endif
}
All steps followed in the tutorial, with other code copy/pasted to verify. I am not sure what this other error is in the Program.cs that prevents it from running.
Got it…. added
using TextureAtlas;
to the top fixed it up.
Post preview:
Close preview