Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm making a cow zombie survival game. I have the game code sorted but when the game goes from game over to playing, the cows stay in the same position.

Whats the code to reset the scene?

share|improve this question
   
This is relative to your code design. No one know how to do this. You made it, you should know about it! It's like a engineer making a car and asking where to put the keys. – Gustavo Maciel May 18 '12 at 1:22
^If you could down vote comments I would, that is a horrible analogy for what OP is asking. It's more like an engineer making a car and asking how to turn it off, because his car just keeps running when you remove the key. The car runs fine and it works for him, the only problem is getting it to stop and restart again properly. – hammythepig Jun 27 '12 at 16:45

2 Answers

You question is a little too vague, you should put in some code or give more references so that people can help you.

But IMO you must have forgotten to remove the drawing reference for those in the draw() function, so even after you change the "scene" (whatever you mean by that) your cows are drawn again on top of it.

That's the best I could do, hope I could help somehow.

share|improve this answer
Heres the code i have for the game, all i want is the code to reset the cow's position. pastebin.com/D37KtgbX – RussNicholls May 17 '12 at 11:42
Sorry I don't have much experience with XNA, but you seem to use a "device.Clear" that shoud do what you are asking for. Double check the code to see if you aren't drawing a spriteBatch in the wrong place or something like that. Sorry for not being able to help more. – Galvanize May 17 '12 at 11:55

From what I can tell from your code, you'll want to clear out the random blocks you created. Something like:

protected override void Initialize()
{
    base.Initialize();

    blockPositions.Clear();

    ...
 }

blockPositions seems to be a list of 2D positions that represent blocks (but it looks like you've just placed your own "cowman" texture in there). Try reading through your code, see how much you can understand. Use the debugger to step through your code and see how the flow works. The more you do this the more you'll understand.

Additionally, I assume you're using Visual Studio, which has great support for code completion, Intellisense. It's a really easy way to see what methods are available to you for all your objects.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.