• Create Account

## Help me please!

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.

24 replies to this topic

316
Like
0Likes
Like

Posted 17 April 2012 - 12:56 PM

Hello guys,

I am a little bit scared for making this topic because i think i cant find help or you will start to laught .
I am 14 years old and i dont make Informatic at school cuz iam in 8-a and i started to studi C++ like 3 weeaks ago and i am really excited in programing and I try to improve my language so I am asking you to teache me or give a good link for learning how to program(i want to start making a game like snake then go to 2D simple game.)
Also i have a tacher who learn me c++ but i want to know more and more if u want to help me please leave a comment.
My skipe is vladmihail(sorry for bed eng i am ok when i speak )

[mod edit: please reserve custom text colours for emphasis only -- rip-off]

### #2Zael  Members

154
Like
0Likes
Like

Posted 17 April 2012 - 02:04 PM

Don't be scared. I started when I was just two years younger than you, except I started with Quick Basic. I am very impressed that you trying C++ at such a young age. Some pretty basic tutorials are available at: http://www.cprogramming.com/tutorial/c++-tutorial.html and http://www.cplusplus.com/doc/tutorial/. The important thing with programming is not just learning the syntax (language) but also getting into a logical mindset and developing your ability to think through a problem. I strongly recommend trying some of the problems from http://projecteuler.net/ to build up your ability to think through problems as you start to understand the language. Depending on where you are in Math (Algebra or Pre-Algebra?) you should be able to do some of the easier problems without too much difficulty. Feel free to PM me (or just post) any questions, and I will try to answer them. At one point I started writing an Intro to C++ book aimed directly at your age group; however, life has taken over, and to be I honest I enjoy programming more than writing about it.

316
Like
0Likes
Like

Posted 18 April 2012 - 01:35 PM

Thanks very much Zael for replay i aleardy done the http://www.cplusplus.com/doc/tutorial/ and it was awesome.

P.S:I am traying to make a maze

316
Like
0Likes
Like

Posted 19 April 2012 - 12:29 PM

Hey guys i want to ask you something very important for all the beginers:
1-How many hours we shold stay to learn C++,the point is to make simple games like maze,snake etc.
2-How many lessons should i learn?(i am currently at Arrays)
3-How many years/months it will take to become an intermediar?
4-Do you love porgraming?
5-Are the proggramers search on marketing?
Thx for reading,please try to respond as many questions is possible!

### #5Naros  Members

491
Like
1Likes
Like

Posted 19 April 2012 - 02:34 PM

I can't comment on your first three questions. It's really hard to quantify the time involved because it's highly dependent upon your own comprehension and devotion to learning the language well. It's also based upon whether you have prior experience with other languages too.

As for myself, I do love programming. I was fortunate at a very young age to have been exposed to programming. My father introduced me to Basic at age 7 and sometime between then and age 10, I was programming in Pascal and by early teens, I made the leap to C/C++. Programming has always been a passion of mine. I've been in the industry professionally for almost 15 years and that passion continues to burn today as strong as it did at 7.

### #6Zael  Members

154
Like
0Likes
Like

Posted 19 April 2012 - 06:54 PM

Like crancran said, 1 and 3 will vary based on previous experience and just how quickly you learn things. I think 2 is a little bit more definable, but I think it is more about making sure you know the content of said lessons than the actual number of lessons you go through.

I personally think you should feel comfortable with the everything up to and including Object Oriented Programming before starting a 2D game (from the tutorial series at http://www.cplusplus.com/doc/tutorial/). I would start trying a simple text based adventure game (kind of like the you-choose-the-ending type books) by the time you get through Control Structures. Depending on the simplicity of the game and the 2D library you choose to work with, you could conceivable start writing a 2D game at that time as well, but I wouldn't recommend it yet. Also, even though they are not really called out in that tutorial series I would strongly recommend looking at and learning how to use std::vector and std::string as soon as possible. While it is good to know about raw arrays and character sequences they can lead to a lot of bugs that are easily avoided by using the string and vector classes.

As for 4, I started my first full-time job as a software developer last year at about this time. I still love programming, and still spend a lot of my evenings working on personal programming projects (most of them game related). I still hope to break into the game industry someday (probably as an indie), but I have to pay off my student loans first. For me programming has always been a creative outlet. I can literally create worlds with whatever rules I set for them, and then see them on my computer screen. Nothing else I know has ever let me do anything like it.

5) I don't quite understand question 5 to be honest.

P.S. SDL requires the use of pointers. I have never used SFML, but if it doesn't require the use of Pointers then you could probably create a simple Snake clone by the time you have finished Control Structures. I would still recommend getting classes and inheritance down. They make your code much more managable.

316
Like
0Likes
Like

Posted 20 April 2012 - 01:48 AM

Thanks you for comment.I aleardy made a text-base game and it was really simple . Now i am trying to learn char(i know this is a very important lesson).
I can learn like 1-1.30 hour per moring(i preffer to learn when i am fresh) and i think is ok,right?
Also i know how to use strings .But i dont know wath is a vector *
When i will learn enought i will try to learn SDL because i saw its very powefull and popular .
1)When i will finish http://www.cplusplus.com/doc/tutorial/ can i say : -I know somethink about programming? more important ,if i finish
that tutu can i start learning SDL?(basics)

2)And the i have a problem with DEV programs,i am using DEV-C++ also i have Microsoft Visual Studio C++ Express 2010 and the problem is i dont know who is better and wath i need to choose to make a game and here is wath i mean : Windows Application , Console Application , Static Librari , DLL , Empty Project . And I dont know wath this mean and wath i need to choose to make a game Please help

3)Also i dont see the difference between : String,int,char,using name space( <= here i may wrong)
And an ex is : char question[] = "Please, enter your first name: " ; char greeting[] = "Hello,. I can use STring or int,so why i need to put char??(My lord)

Thanks you very much for comments and for the help and please keep helping me Have a nice day!

### #8rip-off  Moderators

10730
Like
1Likes
Like

Posted 20 April 2012 - 05:06 AM

When i will finish http://www.cplusplus.com/doc/tutorial/ can i say : -I know somethink about programming?

Yes, you can certainly say you know something about programming when you finish those tutorials. You probably know some stuff about programming already. But there is more to learn. Take it from me, there will always be more to learn. I think this is a good thing.

more important ,if i finish that tutu can i start learning SDL?(basics)

I understand the attraction, but I'd advise you to get comfortable with with the C++ language by building "big" text based projects first before you start using something like SDL. The issue here is that building any game is a non-trivial project. There are skills you will need to build such a project. Trying to learn them, while simultaneously trying to learn how to do graphics and learning a third party library all at the same time will be challenging.

You can make games in the console, by using characters as graphics. But stick to simpler projects first while you're building your skills in program flow, data structures and writing algorithms.

And the i have a problem with DEV programs,i am using DEV-C++ also i have Microsoft Visual Studio C++ Express 2010 and the problem is i dont know who is better

Use Visual C++, it is the best C++ IDE on Windows.

... and wath i need to choose to make a game and here is wath i mean : Windows Application , Console Application , Static Librari , DLL , Empty Project . And I dont know wath this mean and wath i need to choose to make a game

You want to make Console Applications for the moment.

Also i dont see the difference between : String,int,char...

Give it some time, the differences between the data types will become clearer. It might help to understand the terminology:
[list]
[*] "int" is short for "integer", which bascially means whole numbers (e.g. 0, -13, 42, etc)
[*] "char" is short for "character", which are individual text representations of letters, numbers and symbols.
[*] "string" is a computer science name for a sequence of characters. Any bit of text can be considered a string - a word, a sentence, a line or paragraph made of multiple sentences, up to a book or even a compilation of books could be stored in a single string. You can even have strings with just a single character, or even an empty string which has no characters.

... using name space( <= here i may wrong)

The "using namespace" directive is different from the other types. It is merely a short cut. If you didn't have it, you'd have to write code like this:
#include <string>
#include <iostream>

int main()
{
std::string message = "Hello, World";
std::cout << message << std::endl;
}

This is because the contents of <string> and <iostream> are in the standard namespace, called "std". Namespaces are good when you have very large projects that use lots of libraries. Each library might have it's own namespace, and this means that library A's types and functions can be differentiated from library B's, even if the library developers happened to use the same name.

Namespaces are an advanced concept, don't worry about them for the moment.

And an ex is : char question[] = "Please, enter your first name: " ; char greeting[] = "Hello,. I can use STring or int,so why i need to put char??(My lord)

C++ is a strongly, explicitly typed programming language. This means that the language insists you mention the expected types of variables, function parameters and return values, etc.

Here, you are creating arrays of characters, initialised with the contents of a string literal. I would suggest you do not use arrays of characters to represent text, they are error prone. Stick to string question = "Please, enter your first name: " in your own code for the time being, unless you are completing a tutorial.

316
Like
0Likes
Like

Posted 20 April 2012 - 05:50 AM

Thanks you very much for such a good explication!
I aleardy know wath u explicate there about Namespace std; but i wanted to ask somethink else but is not important.
And when u mean Text Games is that kind of games where it ask you for name , choose a race and choose a number 1,2,3 ,no?

316
Like
0Likes
Like

Posted 20 April 2012 - 06:11 AM

Because if u want me to do a Text game i think i will need just : char,int,array,cin.cout,if,else,while,do while? not too much .I was thinking at making a maze but i am too stupid to make an object to move around (I CANT find any tutus on net)
I thought if i make something like this will work but i am pretty sure it wont work : so if we have a char ,,&,, and a room:
1 2 3 (<== room)
4 & 6
7 8 9
and he is siting on 5 i can make him to move using an algoritm like : 8-5 = 2 if he want to go to 2 but i cant imagin how to move an object around using MATH (i am not so bad at match but this is very hard) whitout that ideea from up i cant imagin something else...
I was thinking at this cuz when i made the tic-tac toe it was like this, but i want to make him to move perfect not in many screens if u understand.
And i was thinking to add:

(i cant make it to work on the forum but u can try it for yourself)
* * * * * * * * * * * *
* *
* Hello, Vlad! *
* *
********************

so i made this program:

// [i]ask for a person's name, and generate a  greeting[/i]
#include <iostream>
#include <string>

int main()
{
std::cout << "Please enter your first name: ";
std::string name;
std::cin >> name;

// [i]build the message that we intend to write[/i]
const std::string greeting = "Hello, " + name + "!";

// [i]build the second and fourth lines of the output[/i]
const std::string spaces(greeting.size(), ' ');
const std::string second = "* " + spaces + " *";

// [i]build the first and fifth lines of the output[/i]
const  std::string first(second.size(), '*');

// [i]write it all[/i]
std::cout << std::endl;
std::cout << first << std::endl;
std::cout << second << std::endl;
std::cout << "* " << greeting << " *" << std::endl;
std::cout << second << std::endl;
std::cout << first << std::endl;

return 0;
}

(i dont know if this is a rule but when i want to use the string amd i use << xxx << instend of + xxx + is not working)
If someone know a better way to show the ,,*,, please post it,thanks for reading,please comment
and a way to put the ,*, as the walls(it dosent matter if they are solid -for text game dosent mater, but if u know how to make it solid leave anathor post .
Finally i want to thanks to everyone for such a good COMUNITY! Have a nice day !

[mod edit: added code tags -- rip-off]

### #11theo2005  Members

114
Like
0Likes
Like

Posted 20 April 2012 - 09:23 AM

Because if u want me to do a Text game i think i will need just : char,int,array,cin.cout,if,else,while,do while? not too much .I was thinking at making a maze but i am too stupid to make an object to move around (I CANT find any tutus on net)
I thought if i make something like this will work but i am pretty sure it wont work : so if we have a char ,,&,, and a room:
1 2 3 (<== room)
4 & 6
7 8 9
and he is siting on 5 i can make him to move using an algoritm like : 8-5 = 2 if he want to go to 2 but i cant imagin how to move an object around using MATH (i am not so bad at match but this is very hard) whitout that ideea from up i cant imagin something else...
I was thinking at this cuz when i made the tic-tac toe it was like this, but i want to make him to move perfect not in many screens if u understand.
And i was thinking to add:

(i cant make it to work on the forum but u can try it for yourself)
* * * * * * * * * * * *
* *
* Hello, Vlad! *
* *
********************

so i made this program:

// ask for a person's name, and generate a greeting
#include <iostream>
#include <string>

int main()
{
std::cout << "Please enter your first name: ";
std::string name;
std::cin >> name;

// build the message that we intend to write
const std::string greeting = "Hello, " + name + "!";

// build the second and fourth lines of the output
const std::string spaces(greeting.size(), ' ');
const std::string second = "* " + spaces + " *";

// build the first and fifth lines of the output
const std::string first(second.size(), '*');

// write it all
std::cout << std::endl;
std::cout << first << std::endl;
std::cout << second << std::endl;
std::cout << "* " << greeting << " *" << std::endl;
std::cout << second << std::endl;
std::cout << first << std::endl;

return 0;
}
(i dont know if this is a rule but when i want to use the string amd i use << xxx << instend of + xxx + is not working)
If someone know a better way to show the ,,*,, please post it,thanks for reading,please comment
and a way to put the ,*, as the walls(it dosent matter if they are solid -for text game dosent mater, but if u know how to make it solid leave anathor post .
Finally i want to thanks to everyone for such a good COMUNITY! Have a nice day !

Use code tags please (there's a button in the text editor shaped like "<>".

write
using namespace std;

at the top of your code (below #include <iostream>)

That way you don't have to write out 'std::' all the time

316
Like
0Likes
Like

Posted 20 April 2012 - 10:03 AM

Thx,

316
Like
0Likes
Like

Posted 20 April 2012 - 04:17 PM

Guys i have a very important question for you!! please respond as quickly is possible!!!
1) How can i make a main menu where the player will see start game,save game,load,credits,exit.Then i want to start the main game in a different screen,like the pages from the book,damn eng.
2)And can i color the numbers or the letters?
Thanks for helping me out! Have a nice day!

P.S:If u teach me how to make the main menu please take your time and teach me how to make a script for saving and loading the game,TY!

### #14rip-off  Moderators

10730
Like
1Likes
Like

Posted 21 April 2012 - 11:10 AM

How can i make a main menu where the player will see start game,save game,load,credits,exit.Then i want to start the main game in a different screen,like the pages from the book,damn eng.

What specific parts of making a main menu are you having trouble with? What have you got working so far?

And can i color the numbers or the letters?

Standard c++ does not provide you with a way to do this. You can use platform specific APIs to do this.

For example, on Windows you can call a function SetConsoleTextAttribute to do this:
#include <string>
#include <iostream>
#include <Windows.h>

int main()
{
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
WORD colours[] =  { FOREGROUND_RED, FOREGROUND_GREEN, FOREGROUND_BLUE };
for(int i = 0 ; i < 3 ; ++i)
{
SetConsoleTextAttribute(console, colours[i]);
std::cout << "Dark!" << std::endl;
SetConsoleTextAttribute(console, colours[i] | FOREGROUND_INTENSITY);
std::cout << "Bright!" << std::endl;
std::string s;
std::getline(std::cin, s);
}

const WORD Yellow = FOREGROUND_RED | FOREGROUND_GREEN;
SetConsoleTextAttribute(console, Yellow);
std::cout << "Dark Yellow!" << std::endl;
SetConsoleTextAttribute(console, Yellow | FOREGROUND_INTENSITY);
std::cout << "Bright Yellow!" << std::endl;

std::string s;
std::getline(std::cin, s);
}

There are similar BACKGROUND colour constants. As illustrated, you can get other colours by combining the colours using the bitwise OR operator. The colours you can make are illustrated like so, and as demonstrated you can use the FOREGROUND_INTENSITY to make a brighter colour.

P.S:If u teach me how to make the main menu please take your time and teach me how to make a script for saving and loading the game,TY!

Take things one step at a time. Get a simple menu to work first - don't include "save" or "load" for the moment.

316
Like
0Likes
Like

Posted 21 April 2012 - 12:57 PM

Rip-off u are one of the best guy from here and i want to thanks you very much for helping a noob how to fix out the problems.
I want to make Main menu where u can see the start game and exit(u said no save/load )
And i was looking for a
CONSOLE RPG GAME tutorial but i cant find one (i want to have it for the future)

### #16rip-off  Moderators

10730
Like
0Likes
Like

Posted 21 April 2012 - 01:19 PM

I want to make Main menu where u can see the start game and exit(u said no save/load )

I understand. Still, what specific parts of making a main menu are you having trouble with? What have you got working so far?

316
Like
0Likes
Like

Posted 22 April 2012 - 02:18 AM

I have problem have problem with all the main menu but i made an @ to move around in a room and now i am trying to add a new room(i only need to make a room then to add & no? i mean to connect them eachother)

### #18Zael  Members

154
Like
1Likes
Like

Posted 22 April 2012 - 11:17 AM

Typically in a text based game a menu will be simple output with different input option.

int choice = 0;
while(choice != 2)
{
std::cout << "What would you like to do?\n";
std::cout << "1) Start a new game\n";
std::cout << "2) Quit\n";
cin >> choice;
switch (choice)
{
case 1:
startGame();
break;
case 2:
return;
break:
}
}
`

Does that make sense or are you asking something else?

316
Like
-2Likes
Like

Posted 23 April 2012 - 08:23 AM

Man...thx for helping but i am not stupid,i am making a Dos Rpg game not a text game cuz that is too simple

### #20Zael  Members

154
Like
0Likes
Like

Posted 23 April 2012 - 10:35 AM

Didn't mean to insult you. You would be surprised at some of the simple things people will ask how to do. In a cmd window I am not aware of any mouse functions (could be wrong), so you may still need to do a simple menu like that when the user makes choices. Of course maybe you are more creative than I. Ideally you would use a system library that reads each key as it is pressed (instead of waiting for the user to hit the enter key). Most text based games I have played use a method like that with certain keys toggling a menu.

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.