IggyT

Members
  • Content count

    7
  • Joined

  • Last visited

Everything posted by IggyT

  1. Taking less of a programming approach, I took out a picture editor and put everything where I wanted it. I think it'll become more difficult to make a program to contain the chaos rather than to manually contain it yourself. Unifying your artwork into a specific format will cut down the processing time/take away those bugs that can creep in from when something unexpected arises in another file. I don't know much about picture editors but if you found one with a grid I'm sure it'd help out a lot. (the alternative if making your own grid)
  2. Making a "Game" using C: Where should I start?

    If in the console you can use a simple char map[20][70]; //array And then use loops to set the outlying borders. Then a simple collision check would be to see when the character moves if that next space is whatever you use for borders, and if it is then -1 from his current location after you calculated that movement so that he's not inside the border before you display. alternatively you can set the borders at the declaration of the array, too. @SuperVGA ...huh, I had no idea they were so messy. I received the code from a friend that had been using it a while and blindly trusted it, thanks for the link.
  3. moving 2d array to 3d array

    [quote name='greenzone' timestamp='1311065135' post='4837264'] if i have an array of floats how can i turn that array into a multidimensional array. ex: [color="#8b0000"]sector[9] = {1,2,3,4,5,6,7,8,9}[/color] what i want is to change "sector" into "sector2"......[color="#8b0000"]sector2[3][3]={{1,2,3},{4,5,6},{7,8,9}};[/color] So if you under stand the function required and logic an explanation would be awesome.[color="#8b0000"] [color="#000000"]Im using c++[/color] thanks Green [/color] [/quote] It sounds like you want to just put the information from one array into another array, correct? If so this sounds like you just need a nested loop to solve your re-locating problem. [code] int first=3; int second = 3; int sector[9] = {1,2,3,4,5,6,7,8,9}; int sector2[first][second]; for(int i = 0, s_count = 0; i<first; i++) for(int j = 0; j<second; j++, s_count++) //update s_count here so that it can update as the j position updates. sector2[i][j] = sector[s_count]; for(int i = 0, s_count = 0; i<first; i++) //this is for displaying the results and not part of the transfer process for(int j = 0; j<second; j++) cout<<sector2[i][j]; [/code] In this code s_count is kept track of so that you can add to each new array section first run through it starts at 0, the second at 3, third at 6...etc EDIT: I suggest doing as Krohm suggested, sketch this out, it'll give you a better understanding than someone just explaining it to you would.
  4. Making a "Game" using C: Where should I start?

    Are you talking about making a DOS game? If not, and working with only console application, then something you'll want to look into is how to clear the screen so that each new display is the only thing displayed. EDIT: took out some bad information
  5. [quote name='MirageUY' timestamp='1311038817' post='4837128'] I read a little about python and i got one book from c# and some videotutorials. But i want to know if C# is the best first language or is there another better. [/quote] Here's a wiki here that goes over a lot of this : [url="http://wiki.gamedev.net/index.php/How_do_I_get_Started#Choosing_a_programming_language"]http://wiki.gamedev.net/index.php/How_do_I_get_Started#Choosing_a_programming_language[/url] What it really boils down to is what do you want to get out of your language in the end. C# is similar to C and C++ and if you want to bridge it'd most likely be the best choice. Python decreases development time because it's a scripting language and once you learn it there's a good chance you'll just stick with it. From what I understand it's easy to use.
  6. Should positions be defined as ints or floats?

    Floats aren't 100% precise but this is a problem based on calculations being base 2 and can cause some collision errors. Int would be simplest to work with, it's easy to iterate and most positions in games can be scaled up or down to an int. Unless you're doing calculations that require you to use fractions or division (really the same thing)...I don't suggest using float.
  7. [code]int DoLoad() //why output an int? { ifstream Profile1; Profile1.open("Profile1F.txt"); string Profile1V[6]; //this is an array of strings while (!Profile1.eof()) //this is a good practice { Profile1 >> Profile1V[5]; //with this you only access the last value of your array and therefore overwrite it every iteration } cout<<Profile1V[5]; //with this you only display the said last value of the array of strings Profile1.close(); //good practice return 0; }[/code] To make this simple, the only reason it's displaying 0 is the fact that you are only accessing the last memory section of the string array that you're making and you keep writing over it in each iteration of your loop so you end up with only the last value of your file. As a short lesson on arrays, arrays are safe temporary pointers, they allocate the size of whatever you're making the array of in memory space (in the case of strings you're making it the size of the string class in 6 slots side-by-side in memory) int array[6]; // is the same as declaring six separate integers. To access the first value of an array you start with 0 first value would be accessed using : array[0]; and the last is accessed using : array[5]; //one less than the number you originally used to allocate its size because the memory space begins with 0 Strings have the capability to resize themselves when you give them a new value ([u]a string is a class that holds a resizeable const char array[/u]) so what you might want to do if you are only taking bool-type information in the file is just resize the string and add the new value in. (Or alternatively you can catenate like I did below.) [code]string DoLoad() { ifstream Profile1; Profile1.open("Profile1F.txt"); string Profile1V; //this is a class that holds an array value for (int i = 0; !Profile1.eof(); i++) { Profile1V += " "; //this will resize your string by one space by telling your string to add in a blank space. THIS ONLY WORKS WITH STRINGS. getline(Profile1,Profile1V[i]); //this will read to the newline symbol in each line of your file cout<<"\n"<<Profile1V; //this needs to be erased after you see the proof because it's unnecessary } Profile1.close(); return Profile1V; //send a copy of the string out into your program where you should put it in a function or loop that sorts it }[/code] This is a way of doing this, but to be honest you need to look into how arrays work and learn it very well. It's crucial to programming (as are pointers and addresses.) As a simple way of checking each of the values and putting them into a useable format do something like : [code] string info = DoLoad(); //sets the value to what's output in my function above int size = info.length(); //sets to an easy to find and use variable holding amount of information you need bool YesOrNo[size]; //dynamically allocated array based on your information needs for(int i = 0; i<size; i++) //this checks each spot in your const char array (the string class called info I made above) { if(info[i] == '0') YesOrNo[i] = false; else if(info[i] == '1') YesOrNo[i] = true; else cout<<"\nThere was an error in loading!"<<endl; //while debugging or even after you need things like this to know why you program isn't working as planned. } //set the value accordingly here or use the bool array and have the values held elsewhere [/code] If you want to use this, give me some credit. But I suggest you make your own because it's your game and you'll need to decide how to deal with data.