Need Help on Code

Hey guys and gals, I'm 15 and looking to start writing some code for anything, games mostly though and I was wondering if the Test Based game is headed in the right direction. Is it the right habit / am I doing anything that will end me up in a bad coding habit? This is in Visual Studio Professional 2013.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
#include <conio.h>

using namespace std;

int main()
{
	char getName[50];

	cout << "Hello!, Would you tell me your name?" << endl;
	cin >> getName;
	cout << endl;
	cout << "Ok " << getName << ", could you help me with a task?" << endl;
	cout << endl;
	
	int choiceOne;
	cout << "Yes = 1, No = 2" << endl;
	cin >> choiceOne;
	cout << endl;

	if (choiceOne == 1)
	{
		cout << "Good! " << getName << " now follow me." << endl;
		cout << endl;
		cout << "5 minutes later..." << endl;
		cout << endl;
		cout << "---------------------- Press Enter ----------------------" << endl;
		_getch();

		cout << "Ok " << getName << "this is my house, I need help moving the boxes from upstairs to down here." << endl;
		cout << endl;
		cout << "Walk upstairs = 1, Stay on floor 1 =2" << endl;

		int choiceTwo;
		cin >> choiceTwo;
		cout << endl;

		if (choiceTwo == 1)
		{
			cout << "It Works 1" << endl;
		}

		if (choiceTwo)
		{
			cout << "It Works 2" << endl;
		}

	}

	if (choiceOne == 2)
	{
		cout << "You know " << getName << " I'm going to remember this." << endl;
		cout << "So be it I guess... Well go on now I have things to do." << endl;

	}

	return 0;
}
Text based games are generally not going to help you begin game programming. It doesn't teach you to utilize graphics or external libraries or anything. On top of that, they are usually much harder to write and don't generate much attraction. I recommend giving SFML a spin. It has a great documentation and is easy to get the hang of. Once you've made a game or two with that, try some Java if you're serious about games. If you really like C++ try out DirectX or OpenGL.

Here is the link to SFML and everything you need:
http://en.sfml-dev.org

Edit:
After downloading it, check out the Learn->Tutorials->Visual Studios page here:
http://www.sfml-dev.org/tutorials/2.3/start-vc.php

and just the tutorials page in general, it has everything you need to make simple game with SFML. The good thing about SFML is that it is cross platform, meaning you can use the same code on Mac, Linux, and Windows, without a problem. (Generally)

Good Luck!
Last edited on
Thank you!, Ill check that out. Also I was told that Java, C#, and other languages to make games out of are simpler than C++, therefore I wanted the extreme challenge of C++.

Also, I'm running my computer on Windows and Linux to develop games on, (it was a hand down from my local computer store.) Are you saying that if I make a game in windows, ill be able to open that game up under my Linux and play it?

Thanks Alot!!!
Are you saying that if I make a game in windows, ill be able to open that game up under my Linux and play it?

If by "open it" you mean execute the same object file, then no. Object files are not compatible across Winfows and Linux.

What R23MJ meant by "cross-platform" is that you can take the same source code, compile it and bind it with the SFML library for a particular platform and have an executable that runs on that platform.


Last edited on
Ok cool, thanks Anon for clarifying that up :) Ill be on my marry way!
Topic archived. No new replies allowed.