Advertisement

I'm having trouble getting it all to click...

Started by May 28, 2010 10:08 PM
5 comments, last by awefdbgb 14 years, 5 months ago
I'm referring to programming. I've been doing work with C# in XNA, and It's like I have writer's block or something. I'm still a beginner, and when I want to try a project (presently simple stuff like Tetris or Pong), I kind of don't know where to start past the planning stage. Maybe I need to find a better learning method (trying self-teaching since I can't go to college :/)
Break the problem down into pieces. For instance take pong. You have a ball and two paddles. You know they need to be rendered at a certain spot so you'll give them a position. So your first goal might be to just render two rectangles. Then try to render a circle. All this while you'd be looking up documentation. Then you'd realize you need input so you'd research how to detect keys and set variable like "moveUp" or "moveDown" to true on keydown and false on keyup. In your game loop you'd check these and change the velocity (or directly change the position if you're comfortable with that) if they're true.

Using this line of thinking, where you start from a broad outline of the project then break apart the pieces and solve them individually, works really well.

Also make sure you understand the role classes play and the concept behind OOP. You should already realize that you can think of the paddle and ball like objects with their own methods. Not really necessary for pong, but it's something to think about if you wanted to implement them as classes.

If you want you can paste the code you have using source tags and others could help you. Just keep practicing and thinking about problems and it'll get easier.
Advertisement
This is how my Tetris Clone is setup -

http://img192.imageshack.us/img192/7448/tetrisprojectlist.png

I basically made classes I thought I'd need. But now I'm wondering, what's next?
I'd first suggest a move to the For Beginners section.

After that it's hard to say without seeing actual code. Tetris could be made any number of ways with any number of classes. Just seeing what classes you have is not very indicative of how it actually all works together.
Well at present, I don't have any code outside of the preset code you start with.

I was told that I need to use arrays with the tetris pieces, but I'm not sure exactly how to do it.
Quote: Original post by Slateboard
Well at present, I don't have any code outside of the preset code you start with.

I was told that I need to use arrays with the tetris pieces, but I'm not sure exactly how to do it.


Since you're using XNA I'd really recommend using the XNA creators club tutorials. They have a bunch that will guide you through everything you need to know to make a game.

Once you've done that and you have more specific questions those might be better suited.
Advertisement
"The journey of a thousand miles begins with the first step"

When I get stuck without the click, I just start very basic. In this case you will need to be able to draw the moving block and accept user input. The block should stop moving at the bottom if the screen and a new block should appear.

Remember that the tetris pieces are all constructed from 4 smaller blocks. One way to describe them could be in an array, say a 4x2 describing the offests of the pieces from the first one. The dropped piece can add itself to a field array. There might be better ways to do it, but a start is always good.

This topic is closed to new replies.

Advertisement