Ekim_Gram

Members
  • Content count

    1313
  • Joined

  • Last visited

Community Reputation

418 Neutral

About Ekim_Gram

  • Rank
    Contributor
  1. I'm currently working on a Car System Simulator for educational use in Tech. Ed. classes. My partner and I are using Adobe Director 11.5 and I'm using the Lingo scripting language to code all the functionality for the 'game.' I've run into a problem, though, regarding the interaction between the gas gauge and the variable that keeps track of how many gallons of gas have been used. I've got a few variables: gallonsUsed milesTraveled mpg Now, every time a gallon of gas is used I would like the needle on the gas gauge to rotate -12 degrees, I've got that part down. What I can't seem to figure out is how to get the simulator to detect when it passed the next "threshold" of the gallons, when a full gallon of gas has been used. The milesTraveled is a float with 4 decimal points due to our math (.5 real time = 1 minute game time) which is why I can't really use the mod operator (milesTraveled mod mpg)
  2. (c++) 2 noob questions ! :)

    To answer your first question, you have a few options there. The most common is to put a cin statement before the return statement to pause the program, otherwise there is nothing else telling it to wait. i.e.: int main() { std::cout << "Hello, world!"; char pause; std::cin >> pause; return 0; } On a Windows OS there is a header file that allows you to use the statement system("pause"); I'm pretty sure if you #include <system.h> that should do it but I may be wrong - it's been about 5 years since I last worked with C++. Would it be possible to rephrase your second question? I can't quite get what you're saying, I have an idea but I'd like to make sure.
  3. I hope you do know that you could have put everything into one post.
  4. Problem with functions... I think

    There is also no 'return 0;' in the main function.
  5. Quote: Tile tile001-140 m_map.push_back( tile001-140 ); FOR GOD'S SAKE! USE AN ARRAY AND A FOR LOOP!
  6. ?s about Tile maps and Tile mapping

    I used boolean arrays to represent the blocks. #ifndef BLOCKS_H #define BLOCKS_H // colors of the rainbow enum {RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET}; // blocks[shape][orientation][x][y] enum {OBLOCK, IBLOCK, SBLOCK, ZBLOCK, LBLOCK, JBLOCK, TBLOCK}; // Hard-coded shape definitions const int blocks[7][4][4][4] = { // OBLOCK { { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, }, }, // IBLOCK { { { 0, 0, 0, 0 }, { 1, 1, 1, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, }, { { 0, 0, 0, 0 }, { 1, 1, 1, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, }, }, // SBLOCK { { { 0, 0, 0, 0 }, { 0, 0, 1, 1 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 0, 1, 1 }, { 0, 0, 0, 1 }, { 0, 0, 0, 0 }, }, { { 0, 0, 0, 0 }, { 0, 0, 1, 1 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 0, 1, 1 }, { 0, 0, 0, 1 }, { 0, 0, 0, 0 }, }, }, // ZBLOCK { { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 1, 1 }, { 0, 0, 0, 0 }, }, { { 0, 0, 0, 1 }, { 0, 0, 1, 1 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 1, 1 }, { 0, 0, 0, 0 }, }, { { 0, 0, 0, 1 }, { 0, 0, 1, 1 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }, }, }, // LBLOCK { { { 0, 0, 0, 0 }, { 0, 1, 1, 1 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 1, 1 }, { 0, 0, 0, 0 }, }, { { 0, 0, 0, 1 }, { 0, 1, 1, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }, { { 0, 1, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }, }, }, // JBLOCK { { { 0, 0, 0, 0 }, { 0, 1, 1, 1 }, { 0, 0, 0, 1 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 1 }, { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 1, 0, 0 }, { 0, 1, 1, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, }, }, // TBLOCK { { { 0, 0, 0, 0 }, { 0, 1, 1, 1 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 0, 1, 1 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 1, 1, 1 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, }, { { 0, 0, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 }, }, }, }; #endif BLOCKS_H And this was the draw function I used: void CPiece::Draw() { for (int i=0; i<4; i++) for (int j=0; j<4; j++) if (grid[i][j] == 1) Engine->DrawImageToScreen(block_image, ((i+xPos)*(BLOCK_WIDTH)), ((j+yPos)*(BLOCK_HEIGHT))); } I think the code is pretty self-explanitory. BLOCK_WIDTH/HEIGHT is the width/height of the bmp I used to represent one colored square.
  7. I'm actually looking into using XML for a weapon system now. Has anybody else tried that?
  8. ?s about Tile maps and Tile mapping

    You don't need tile mapping for Tetris.
  9. Quote:Original post by T1Oracle What is so hard about binary serialization and creating a simple editor that can edit the contents of such a file? In my last programming class I did that for 90% of the projects, and I finished most of them in less than 4hrs of work. None of them were as simple as this problem. Your editor could be a simple text based consol app. Maybe it's because, as I stated, I haven't done any game programming in over a year and I've lost that way of thinking. I don't even think programming qualifies as a hobby for me now, it's just something I know how to do.
  10. Quote:Original post by tgraupmann Quote:Original post by Anonymous Poster Why not just create a simple file format for such objects? If you make it a text based format you can just edit them, much like you would a scripting language, but without so much hassle creating a parser and what have you. Then when you're satisfied with your weapons variety, pack them all into a single data file (binary format if you don't want users going in and making the basic pistol do 5000 damage or something) and read that file at load time. Might as well use a database ;p So are you saying scripting would be better for event programming rather than what I'm asking about?
  11. Very simple concept that I've been thinking about for the past few months on and off (I rarely program now but I would like to do this). Many games have many weapons and I'm sure it isn't fun to just hard code all the weapon data in C++ and having to recompile it and all. Say I have the following class: class Weapon { int range; int damage; SDL_Surface *image; } That's all pretty self-explanatory. Would it be easier to use an embedded scripting language like Python or Lua to create all that data for the game rather than having declarations like: Weapon Laser; Laser.range = 500; Laser.damage = 10; Laser.image = "lazer.pmg"; I've always been interested in embedded scripting languages in games but never really learned how. C++ and C# are my two main languages for this so if anybody has any tips, tutorials and the such, I'm all for it. And for the record, I've read a little bit on both Boost::Python and Boo.
  12. XYZ-axis different in 3dsmax

    Just change to one of the four views.
  13. I would say stick with what you spent so much money on, yarr, matey.
  14. [web] Web Hosting

    1and1 and Dreamhost are two of my favourites. I personally prefer 1and1 though.
  15. looking for SDL tutorials

    Cone 3D