Jump to content

  • Log In with Google      Sign In   
  • Create Account


Flump9

Member Since 18 Sep 2011
Offline Last Active Jan 16 2012 03:52 PM
-----

Posts I've Made

In Topic: Starting out

14 January 2012 - 08:55 AM

Seems like Java would be the better option for you then.

Not only because you are already familiar with it, and it's always good to stick with the language you're familiar with, but also because Java allows for better publishing options, you don't just get PC/Mac as possible platforms, you can make your game to run on the web and Android, and that's just a huge perk.

I don't have much Java experience myself, so I can't really help you in that area, but I hear that Eclipse is the best you can get as an IDE for Java.


Thanks. I'm sticking with java and am going to follow the new bostons tutorial so I learn functions and whatnot, and I have seen some other tutorials and one is specifically for making a game. :) and ive always used eclipse :D

In Topic: Problems with console text game

22 December 2011 - 06:49 AM


BTW how do i use that cin method with user input?what type of code would i write?Like if statements or whatever


I'm not sure I understand what you mean. You just want the user to enter their name once when the program starts? Then you could just include the following code somewhere before the while (or even in main):

string name;
cout << "Enter your name: ";
cin >> name;

You don't need any ifs. You just ask for their name and store it in your string variable.


I figured out how to do it.Thanks



In Topic: Problems with console text game

22 December 2011 - 04:29 AM

First, I wouldn't use System("exit"). It doesn't seem like you really need it. If the user enters 3 you can just return.

The menu keeps popping up because the while condition is still true. For example, say the user enters 1. You print:
Let us Begin then,

and then break out of the switch/case. The while condition will still be true - choice is still not equal to 3, it is equal to 1. Therefore it will print out the menu again and get the user input again.

There are probably different ways to do it, but here is one idea. How about designing a couple of functions.. maybe StartGame() and PrintHelp() which has all of the code you want for playing the game and printing the help menu:

switch(choice) //Switch
    {
    case 1:
    cout << "Let us Begin then," << endl;
    StartGame(); //Start the game.
    break;
    case 2:
    cout << "The aim of the game is to survive!"  << endl;
    PrintHelp(); //Print the help menu.
    break;
    case 3:
    return;
}

To store user input in a string you can just use cin:

string a;
cin >> a;


BTW how do i use that cin method with user input?what type of code would i write?Like if statements or whatever

In Topic: Problems with console text game

22 December 2011 - 03:44 AM

First, I wouldn't use System("exit"). It doesn't seem like you really need it. If the user enters 3 you can just return.

The menu keeps popping up because the while condition is still true. For example, say the user enters 1. You print:
Let us Begin then,

and then break out of the switch/case. The while condition will still be true - choice is still not equal to 3, it is equal to 1. Therefore it will print out the menu again and get the user input again.

There are probably different ways to do it, but here is one idea. How about designing a couple of functions.. maybe StartGame() and PrintHelp() which has all of the code you want for playing the game and printing the help menu:

switch(choice) //Switch
    {
    case 1:
    cout << "Let us Begin then," << endl;
    StartGame(); //Start the game.
    break;
    case 2:
    cout << "The aim of the game is to survive!"  << endl;
    PrintHelp(); //Print the help menu.
    break;
    case 3:
    return;
}

To store user input in a string you can just use cin:

string a;
cin >> a;


Thanks,that helped me a lot.I have made it so that if you type 1 it will make choice 3,where help will just stay the same as i want it to go back to the menu.

In Topic: Need Help Making a pong game

21 December 2011 - 02:48 PM

The reason why your code doesn't work is that you use variables, that are defined in the main function, in other functions.
The key variable is the one that gives errors.

For your other question about collisions:
Circle rectangle collisions

Hope this helps.


Please can you point those out for me?

PARTNERS