| View previous topic :: View next topic |
| Author |
Message |
IllusionSlayer Grandmaster Cheater
Reputation: 0
Joined: 12 Dec 2007 Posts: 539
|
Posted: Sat Nov 22, 2008 9:01 pm Post subject: Learning C++ |
|
|
Hey cheatengine me and my buddies are getting together to make learn how to program and make video games.. We are hoping to learn in C++ and were wondering where to start. We know some stuff about C++ like the basic stuff (Else, if, cout, cin, integers ,switch, bool) All that stuff but we wanna know where to learn C++ for game programming. and how to make simple games like a Tetris base game then were ganna keep increasing in our skills. But we wanted to know how to start where to start and if you have any good tutorials if you could please post them! TYVM
_________________
Last edited by Dark_Byte on Fri Feb 13, 2010 13:10 pm; edited 94 times in total |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Nov 22, 2008 9:21 pm Post subject: |
|
|
Don't bother until you have an extremely solid understanding of the language.
There's far more to it than meets the eye.
www.cplusplus.com
|
|
| Back to top |
|
 |
zDaniel365z Cheater
Reputation: 0
Joined: 20 Sep 2007 Posts: 43
|
Posted: Sat Nov 22, 2008 9:30 pm Post subject: |
|
|
| slovach wrote: | Don't bother until you have an extremely solid understanding of the language.
There's far more to it than meets the eye.
www.cplusplus.com |
true, there is far more to it than meets the eye
and yeah you do need a bit of more basic ground covered (realy does help if you have more knowledge in your langauge of choice before going into something big(and dark in your case =/))...
=/ though way you said it kinda seems negative and "fuck off" message can be sensed =/
as for the actualy subject:
try: http://www.gamedev.net/
look around, might not be the best site but stilll
look into using either Direct-X or OpenGL since C\C++ alone can't get you far in coding GUI for games =\
try not to give your self a gaint task for a game (ei. making the next WoW) , you WILL fail and get dissapointed, =P start off small even though it might be pointless/dull/anouying, and build up =P
=/ if you want an easier way to make games take a look into flash/action scriptiing =P action script shouldnt be hard... and flash well isnt hard either =P ... just all depends on how dedicated you are to learning things
_________________
Failure. When your best just isn't good enough.
Cannibalism.When milk and cookies just aren't enough. |
|
| Back to top |
|
 |
IllusionSlayer Grandmaster Cheater
Reputation: 0
Joined: 12 Dec 2007 Posts: 539
|
Posted: Sat Nov 22, 2008 11:03 pm Post subject: |
|
|
So does anyone now how to make a guessing game where you guess then when you win it asks if you want to play again and if you say yes it does?
_________________
Last edited by Dark_Byte on Fri Feb 13, 2010 13:10 pm; edited 94 times in total |
|
| Back to top |
|
 |
benlue Moderator
Reputation: 0
Joined: 09 Oct 2006 Posts: 2142
|
Posted: Sat Nov 22, 2008 11:29 pm Post subject: |
|
|
| tres9027 wrote: | | So does anyone now how to make a guessing game where you guess then when you win it asks if you want to play again and if you say yes it does? | | Code: | #include <iostream.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
long secretnumber = 0, user_number = 0;
const long MAX = 100, MIN = 1;
// Create random number
srand(time(NULL));
secretnumber = (rand() % (MAX - MIN + 1)) + MIN;
cout<<"I'm going to randomize a number and you have to find it!"<<endl<<endl;
// Loops forever until user finds the number
while (user_number != secretnumber)
{
cout<<"Pick a number : ";
cin >> user_number;
if (secretnumber > user_number)
cout << "Higher!"<<endl<<endl;
else if (secretnumber < user_number)
cout << "Lower!"<<endl<<endl;
else
cout << "gj!"<<endl<<endl;
}
system("PAUSE");
} | ?
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sat Nov 22, 2008 11:38 pm Post subject: |
|
|
Just be warned with the post above, if the input fails, you're going to go into an infinite loop.
| Code: | std::cin >> guess;
if(std::cin.fail()){
std::cin.clear();
std::cin.ignore(sizeof(std::streamsize), '\n');
} |
|
|
| Back to top |
|
 |
IllusionSlayer Grandmaster Cheater
Reputation: 0
Joined: 12 Dec 2007 Posts: 539
|
Posted: Sun Nov 23, 2008 12:27 am Post subject: |
|
|
ya we solved this before you posted and we ran into to the invalid input thing
_________________
Last edited by Dark_Byte on Fri Feb 13, 2010 13:10 pm; edited 94 times in total |
|
| Back to top |
|
 |
manc Grandmaster Cheater
Reputation: 1
Joined: 16 Jun 2006 Posts: 551
|
Posted: Sun Nov 23, 2008 12:34 pm Post subject: |
|
|
Heres another version made by me:
| Code: | #include "windows.h"
#include <iostream>
#include "stdio.h"
using namespace std;
//-----------------------------------------------
int Guess, Generated_num, intcheck;
char w_h[] = " Guess Higher! ";
char w_l[] = " Guess Lower! ";
char correct[] = " You guessed right! Start a new game? [1:Yes/2:No] ";
//-----------------------------------------------
int check(int inGuess, int RandomNum)
{
if(inGuess != RandomNum)
{
if(inGuess > RandomNum)
return 1;
if(inGuess < RandomNum)
return 2;
}
return 3;
}
//-----------------------------------------------
int main()
{ system("COLOR 5f");
BOOL WINAPI SetConsoleTitle(
__in LPCTSTR Guess The Number Game!
cout << "Welcome to guess the number." << endl;
cout << "The secret number lies within 1-100" << endl;
::srand(time(NULL));
newgamejump:
Generated_num = (::rand()%100)+1;
incorrectjump:
cout << " Guess : " ;
cin >> Guess;
intcheck = check(Guess, Generated_num);
switch(intcheck)
{
case 1:
cout << w_l << endl;
goto incorrectjump;
case 2:
cout << w_h << endl;
goto incorrectjump;
case 3:
cout << correct << endl;
cin >> intcheck;
if(intcheck == 1)
goto newgamejump;
}
return 0;
}
|
_________________
|
|
| Back to top |
|
 |
|