Jump to content

  • Log In with Google      Sign In   
  • Create Account


A star


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
21 replies to this topic

#21 Trienco   Crossbones+   -  Reputation: 1945

Like
0Likes
Like

Posted 27 January 2013 - 10:05 AM

I can pretty much promise you that the problem is with your code


Well, considering his new thread about this very issue ( http://www.gamedev.net/topic/637918-a-star-tutorials-sfml/ ), I don't think the problem is in "his" code, because apparently all he did so far is copy/paste some seriously awful code from the internet, include the .cpp in another .cpp, be confused about it not working and then asking for someone to do all the programming for him.

Okay, technically it still is in his code, considering that "include <Astar.cpp>" was most certainly not in the original code. Still, this looks like yet another case of wanting to write a game without first learning the absolute basics of the chosen language.

Edited by Trienco, 27 January 2013 - 10:08 AM.

f@dzhttp://festini.device-zero.de

Sponsor:

#22 Chad Smith   Members   -  Reputation: 1041

Like
2Likes
Like

Posted 27 January 2013 - 12:09 PM

I/we can get your previous code to compile just fine using the exact instructions that had been given previously.  I even went out of my way to download and install Code::Blocks to test it out so I can show you that it is not a Code::Blocks issue.

 

Your biggest issue though is that you're just not ready for this.  I am pretty sure every programmer at some point has been there before.  Bit off more then they can chew.  I have done it multiple times and it hurt me.  Just take your time learning  the language.  Every single feature you learn in the language make some VERY simple projects using those features to test it out.  The more you code on your own the more you will understand what exactly the code is doing before you even run it.  When you need help understanding something we will gladly help you and give you some ideas.  We aren't going to write your code for you and you telling us "I just want a premade solution that I can just plug into my code" will get you people that don't want to help you.

 

The fact you copied and pasted this code and expected it to work is a red flag to us.  You can't do that.  Could you tell us what what your code is doing actually right now?  You don't need it to compile for you to get a good idea on what will happen.  Just follow your code line by line.

 

We do want to help you as this is what this community is for.  Though we aren't just going to give you all the answers to your program and write all your code for you.  Again we see you tried to include a .cpp file, that was a huge red flag for us even more to see that you aren't ready for this.

 

here is a quick lesson in working with multiple files.

 

Lets say you have the following class:

 


 

class Foo
{
public:
     Foo();
     
     int GetX();

private:
     int x;
};

 

What should we do with this class?  We should put it in a header file.  Though if we just did that and started including it with no include guards then we would be in trouble.  We would be getting compiler errors galore!  So what do we do to stop that?  We use include guards

Foo.h


// The first thing you need to do in header files is use include guards
#ifndef FOO_H_ // It's just common to name it like this.  it doesn't HAVE to be like that
#define FOO_H_ // make sure you do use the same name though for no own.

class Foo
{
public:
     Foo();
     
     int GetX();

private:
     int x;
};

// Ok, now after your class and code that belongs in a header file you need a #endif
#endif //Your header file now has include guards  Include this header file when you need to use it.

 

 

 

Lets say you want to write the implementation details for the Foo Class.  You need to do that in it's separate .cpp file (also called source files).  First is first, you include the Foo.h header file then implement your class.  You do not use include guards .cpp files.  Only in header files.

 

Now you're ready to use this anywhere.  When ever you need to use the Foo class you would just include Foo.h.  That easy.

 

Just slow down what you want to do and start from the basics to learn the language.  Sadly we can't go out and make the next biggest game without knowing how to use the language.

 

Again, we want to help you, but we can't just give your all your code nor can you expect to just find your code online and use it that way.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS