SFML community forums

General => SFML projects => Topic started by: deeup511 on August 10, 2015, 09:28:46 am

Title: I have been working on Pong for two days. This is my progress.
Post by: deeup511 on August 10, 2015, 09:28:46 am
Hey. I attempted to make a Pong project using multiple header and class files. I tried doing it all in one but it got really messy. This is what I have so far. I have no clue why it is not recognizing the functions from the other headers. Can someone point me in the right direction? I don't know how to fix the paddles.

https://github.com/Devin8/Pong
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: Geheim on August 10, 2015, 09:34:06 am
So what do have so far then? We can't guess how you implemented your stuff, and without any code or a specific question, you won't get any answer.
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: deeup511 on August 10, 2015, 09:35:19 am
https://github.com/Devin8/Pong

FORGOT TO POST IT SORRY!
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: Hapax on August 10, 2015, 12:59:26 pm
Why is main.h declaring main as a class?
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: Geheim on August 10, 2015, 09:43:01 pm
Besides the weird main.h file, you lack some important fundamental C++ knowledge. Before you can use the function, you have to make an instance of your class and call the function then for that instance. Also in your pong game it would be a better choice to make a Paddle instead of a Paddles class and make one instance per player. (For reasons that should be clear after you progress further).

Read up on classes (and other basic C++ topics), they are so important and crucial in most projects, you don't want to miss them :)
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: deeup511 on August 11, 2015, 02:17:22 am
I didn't touch anything in main.h It was automatically like that.
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: Hapax on August 11, 2015, 04:24:21 am
Well, at least it's not linked  ;)

Did you fix the things that Geheim told you about?
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: Mortal on August 12, 2015, 08:03:56 am
omg .. you just remind me of myself a year ago. the "stdafx.h"  was my companion for couple of months until i realized that's it useless when i had my first project with multiple files. if you are using VC10 or VC08 throw it away believe me it doesn't worth it. i just installed VC14 with C++14 supported. i'm now toying with std::bind and lambda.  8)
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: Hapax on August 12, 2015, 08:12:41 pm
Best thing to avoid all of those automatic creations that you might not want or even realise are there is:
Create an Empty Project
It really cleans things up when the only that is there is stuff you put there on purpose.
Title: Re: I have been working on Pong for two days. This is my progress.
Post by: Raincode on August 13, 2015, 11:33:19 pm
Quote
you lack some important fundamental C++ knowledge
I'm sorry, but I would take this as advice.

You have 3 options (as far as I know):
- Learn from the internet (it will require knowledge of using google) about C++. Now this is not really recommended, since you will likely pick up many bad habits while doing so. But it's free, kinda.
- Learn from a good C++ Book for Beginners (check here: https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). It's not free, kinda.
 But the quality of information is definately better.
- Continuing to attempt game programming without working on your basic C++ Skills: not productive.

What you will need (including, but not limited to):
- A basic sense for logic, maths. Don't get me wrong, you don't have to be some super-smart guy or gal, but some basic understanding really helps.
- Motivation: You won't learn it all in a day, or a week. Even a month is unlikey. In fact, you'll never stop learning. It helps to have a realistic goal.
    Yes: "I want to make my own pong clone with C++ and SFML".
     No: "I want to make the next-gen AAA MMORPG".

Good luck and may the bytes be ever in your favor
Raincode