Skip to main content
gamedev.net
🔒 Locked

different way of learning

Started by ChristianFrantz Oct 29, 2012 at 11:55 PM 30 replies 6.3k views
Original Post
ChristianFrantz
ChristianFrantz
I have 3 xna books and theyre each kicking my ass. I can't seem to get the material thru my brain no matter how many times I go over it. Are there any alternative ways to learning a language? Videos dont work for me either
If you see a post from me, you can safely assume its C# and XNA :)
EddieV223
EddieV223
XNA isn't a language, its a library. If you want to learn c# there are live classes at 3dbuzz.com , as well as tutorials across the internet including video tutorials.

If books, tutorials and videos are not working for you, try knowledge suppositories.
ChristianFrantz
ChristianFrantz
I know c# well enough to understand the code. I just need longer explanations of why something does what it does
If you see a post from me, you can safely assume its C# and XNA :)
Haps
Haps
You could try looking bits up in the MSDN as you run into them.
Alpha_ProgDes
Alpha_ProgDes
Wouldn't it be easier for you to start writing something and when you get stuck, then post your problem here so others can help you?
Beginner in Game Development?  Read here. And read here.  
ChristianFrantz
ChristianFrantz
yeah but id end up with at least 5 new topics a day and thatd be annoying lol
If you see a post from me, you can safely assume its C# and XNA :)
Alpha_ProgDes
Alpha_ProgDes
For you? Or us? Don't forget. You're not the first person with these problems and you're not the last. So asking them and getting your questions answered is gonna help someone else in the long run.
Beginner in Game Development?  Read here. And read here.  
Servant of the Lord
Servant of the Lord
In addition, since others have already had those problems as Alpha_ProgDes mentioned, you'll more likely be googling for the answers about 5 times a day, and find the answer within 15 minutes of googling and not actually need to post. You'll probably only have a question you can't already find the answer to only once a week or so.
ChristianFrantz
ChristianFrantz
It seems unnecessary tho. I learn better when I figure things out by myself. I hate seeing code and then copying it word for word.
If you see a post from me, you can safely assume its C# and XNA :)
Haps
Haps
I'm in complete agreement with Servant of the Lord - Google key words related to the concept. You'll usually hit an old post, blog, or tutorial discussing it.

It's not even to "copy working code" - You're bound to find the explanation written out somewhere. If you use the MSDN, you'll at least find a boring but accurate description of methods and their uses, too. The education catalog has pretty well-documented samples that explain what happens in each block and why it's necessary.

Programming is about understanding new concepts, not simply picking up a new command to use. It does take time and a lot of re-reading - Days or weeks in some cases. It happens to us all, and you might feel like you're not getting anywhere, but you will.

Since the thread is already up, do you want to post a couple examples of things that you're having trouble with?
superman3275
superman3275
The best way to learn is to do. C++ and SFML didn't click for me until I started writing my own code. I rigorously copied down the examples. The key here is to change the examples. Experiment with them. Look at, say, an images functions and try them all out. As you read constantly think about how you can apply this knowledge and you'll have it in no time. The only way to learn is to do.

The only way I'm learning good programming habits is to code. I'm slowly figuring out where to apply the single responsibility principle, how encapsulation should be implemented, good design patterns / principles, etc. The only way to actually understand a subject is to rigorously practice in the subject.
ChristianFrantz
ChristianFrantz
alright i made this from scratch, but the paddles dont move. anyone know whats wrong?

[source lang="csharp"] protected override void Initialize()
{
// TODO: Add your initialization logic here

KeyboardState state = Keyboard.GetState();

if (state.IsKeyDown(Keys.Up))
{
paddle1Pos.Y -= 3;
}

if (state.IsKeyDown(Keys.Down))
{
paddle1Pos.Y += 3;
}

base.Initialize();
}

///
/// LoadContent will be called once per game and is the place to load
/// all of your content.
///

protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);

// TODO: use this.Content to load your game content here
ball = Content.Load("ball");
paddle = Content.Load("paddle");
}

///
/// UnloadContent will be called once per game and is the place to unload
/// all content.
///

protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}

///
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
///

/// Provides a snapshot of timing values.
protected override void Update(GameTime gameTime)
{
int minY = 0;
int minX = 0;
int maxY = 600 - ball.Height;
int maxX = 1000 - ball.Width;

// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();

// TODO: Add your update logic here

ballPos += ballSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

if (ballPos.X > maxX)
{
ballPos.X = maxX;
ballSpeed.X *= -1;
}

if (ballPos.X < minX)
{
ballSpeed.X *= -1;
ballPos.X = minX;
}

if (ballPos.Y < minY)
{
ballPos.Y = minY;
ballSpeed.Y *= -1;
}

if (ballPos.Y > maxY)
{
ballPos.Y = maxY;
ballSpeed.Y *= -1;
}

Rectangle paddle1Rect = new Rectangle((int)paddle1Pos.X, (int)paddle1Pos.Y, paddle.Width, paddle.Height);
Rectangle ballRect = new Rectangle((int)ballPos.X, (int)ballPos.Y, ball.Width, ball.Height);

if (ballRect.Intersects(paddle1Rect))
{
ballSpeed *= -1;
}

base.Update(gameTime);
}

///
/// This is called when the game should draw itself.
///

/// Provides a snapshot of timing values.
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.White);

// TODO: Add your drawing code here
spriteBatch.Begin();

spriteBatch.Draw(paddle, paddle1Pos, Color.White);
spriteBatch.Draw(ball, ballPos, Color.White);

spriteBatch.End();
base.Draw(gameTime);
}
}
}
[/source]
If you see a post from me, you can safely assume its C# and XNA :)
Haps
Haps
You put your keyboard polling within Initialize. Initialize is not called every frame, you would want that in Update.
ChristianFrantz
ChristianFrantz
thanks. those are the kinds of things that help me learn. books dont really explain that
If you see a post from me, you can safely assume its C# and XNA :)
L. Spiro
L. Spiro
If I had to guess, I would say it is because the code for moving the paddles is located inside Initialize(), which is only called once (I would hope, otherwise it needs a new name).


[EDIT]
I idled for a while before replying.
[/EDIT]


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
ChristianFrantz
ChristianFrantz
I managed to make a pong game but with no ai. Where do i go from there?
If you see a post from me, you can safely assume its C# and XNA :)
Alpha_ProgDes
Alpha_ProgDes
Another chance to post my famous list. Hold, please.

EDIT: Here we go.

  1. Pong
  2. Breakout
  3. Space Invaders (credit to GearSlayer360)
  4. Missile Command
  5. Asteroids
  6. Tetris
  7. Pac-Man
  8. Tic-Tac-Toe (credit to 3Ddreamer)
  9. ????
  10. Make Money

The reason for this list is because you know how these games work. The rules and how all the parts are supposed to work. So it's easy to go down the list and learn new skills as you complete each game. For a really good tutorial on 2D game development, google for Lazy Foo SDL
Beginner in Game Development?  Read here. And read here.  
ChristianFrantz
ChristianFrantz
breakout is easy enough. i made that in java and C++. i tried snake after that but failed space invaders would be a challenge because you have the shields that protect you from enemy bullets, and a whole array of enemies that move together. and lets not forget the actual process of shooting a bullet which i never understood
If you see a post from me, you can safely assume its C# and XNA :)
Tasaq
Tasaq

and lets not forget the actual process of shooting a bullet which i never understood


I don't consider this a programing or api knowledge problem. I see this as an imagination problem. It's just like a puzzle, but harder one. You have certain elements( types like float, int, in xna case also Vectors, containers like lists, you can create your own classes and structers), only thing is to think of how to combine this pieces of puzzle into whole.

As I always suggest, piece of paper is your best friend. Draw your problem (in case of shooting you got a plane/vehicle and a bullet). Write what defines a plane and what defines a bullet(position, velocity etc.). Draw some vectors (for instance, from plane in shoting direction). Search for relations, experiment. If you won't try you won't accomplish a thing

The most importan thing of all is to never give up
I learned basics of xna from http://rbwhitaker.wikidot.com/xna-tutorials , maybe it will help you too ;)
NightCreature83
NightCreature83

I managed to make a pong game but with no ai. Where do i go from there?

But the comment above initialise would have when the game1.cs file is generated. Have a look at the comments above the functions in the main game class after creating a new XNA game from the wizards. They say when and how often they are executed also the //TODO comments kind mention what you should do in them.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.