neob

Member
  • Content count

    123
  • Joined

  • Last visited

Community Reputation

100 Neutral

About neob

  • Rank
    Member
  1. Getting a Job

    Thank you all. You have all been very helpful.
  2. Getting a Job

    Getting a Job I’m a Computer Science major at a university with the plan of a career as a game programmer. I’m also pretty clueless on how I will get a job once I graduate. How should I search for a company? I think monster would be good, maybe gamedev.net. Once I find a company what steps should I take to apply for the job? Will I need some really good project of mine to demonstrate instead of a resume? Should it be a project that includes all my programming abilities? I will appreciate any information. Thank you all for your time, effort and helpfulness.
  3. Electives

    It doesn’t matter if you went to college and transferred to a university. In my university’s computer science degree, psychology and philosophy are required. I still don’t see the connection or the reason why. If you can get microeconomics, do it. That class tends to be easy and very educational.
  4. Object Problem

    You’re going to laugh. I forgot to do write the constructor in the class .cpp Ha-ha something so simple yet so important :) Thank you both
  5. Object Problem

    I have a member function in a class. The class is named gameLoad. In the .h file it looks like this. int gameFunction(std::vector<unsigned char>&, unsigned long&, unsigned long&, const unsigned char*, unsigned long); In main I try to call this function this way. gameLoad load; int error = load.gameFunction(image, w, h, buffer.size() ? &buffer[0] : 0, (unsigned long)buffer.size()); However this does not compile. Compiler errors are: main.obj : error LNK2028: unresolved token (0A00035F) "public: __thiscall gameLoad::gameLoad(void)" (??0gameLoad@@$$FQAE@XZ) referenced in function "int __cdecl main(int,char * * const)" (?main@@$$HYAHHQAPAD@Z) 1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall gameLoad::gameLoad(void)" (??0gameLoad@@$$FQAE@XZ) referenced in function "int __cdecl main(int,char * * const)" (?main@@$$HYAHHQAPAD@Z) How do I go about fixing this?
  6. Operating Systems - Tutorial?

    I would love to read something like that. You should do it if you have the time and knowledge :)
  7. C++ Pong

    Quote:Original post by Alpha_ProgDes Quote:Original post by neob So you are saying that I should: original position of the paddle - position of contact ? yes. Quote:lol that mud has lots of detritus, I cant see well in it :) I would agree with you but I don't know what detritus is [smile] But if the paddle is at y300 and the ball is hit somewhere around y600... I really dont get it
  8. C++ Pong

    I will use the constructor method, because after 11 points from either AI or P2 the game can close. However the other method would be implemented as well. I have this method startNew() that after a new "goal" has been scored it resets some variables that need to be.
  9. C++ Pong

    So you are saying that I should: original position of the paddle - position of contact ? lol that mud has lots of detritus, I cant see well in it :)
  10. C++ Pong

    Good points I shall fix them, specially the constructor. I have another question. How can I make the ball bounce off the paddle with a more realistic feeling? For example I’m doing it with rand, shouldn’t the ball be affected by the direction the paddle was moving before it hit it?
  11. C++ Pong

    I made this pong game in allegro c++. It compiles and works well for my standards. I’m posting so all the great minds here can judge it and tell me what I did wrong and what can make it better. EDITED:: Right now I’m trying to do this. How can I make the ball bounce off the paddle with a more realistic feeling? For example I’m doing it with rand, shouldn’t the ball be affected by the direction the paddle was moving before it hit it? Thank you for your time. Main.cpp #include "Pong.h" int main() { allegro_init(); install_keyboard(); Pong P; P.setGame(); return 0; } END_OF_MAIN() Pong.h #ifndef H_Pong #define H_Pong #include <allegro.h> #include <cstdlib> #include <time.h> class Pong { public: BITMAP *buffer; time_t secs; int ball_x; int ball_y; int ball_tempX; int ball_tempY; int AI_x; int AI_y; int AI_tempX; int AI_tempY; int p2_x; int p2_y; int p2_tempX; int p2_tempY; int speed; // for ball speed int hits; int AIScore; int p2Score; // Keeps track of circles direction // 1 = up and left, 2 = down and left, 3 = up and right, 4 = down and right int dir; void setGame(); void startNew(); void AIMove(); // Player 1 void p2Move(); // Player 2 void moveBall(); // Controls ball void checkWinner(); // Checks for winner and points scored void menu(); // Updates score and hits // Constructor Pong(); }; #endif Pong.cpp #include "Pong.h" void Pong::setGame() { ball_x = 400; ball_y = 240; ball_tempX = 400; ball_tempY = 240; AI_x = 31; AI_y = 255; AI_tempX = 31; AI_tempY = 255; p2_x = 753; p2_y = 255; p2_tempX = 753; p2_tempY = 255; speed = 1; hits = 0; AIScore = 0; p2Score = 0; set_color_depth(16); set_gfx_mode( GFX_AUTODETECT, 800, 600, 0, 0); buffer = create_bitmap( 800, 600 ); acquire_screen(); // background clear_to_color ( buffer, makecol( 197, 219, 191 )); draw_sprite ( screen, buffer, 0, 0 ); release_screen(); time(&secs); srand( (unsigned int)secs); dir = rand() % 4 + 1; // Check for key press to exit while( !key[KEY_ESC]) { AIMove(); p2Move(); moveBall(); checkWinner(); } } void Pong::startNew() { // comment this later clear_keybuf(); readkey(); // background clear_to_color ( buffer, makecol ( 197, 219, 191 )); // resets ball back to the middle ball_x = 400; ball_y = 240; // resets paddles after victory. AI_x = 31; AI_y = 255; p2_x = 753; p2_y = 255; speed = 1; hits = 0; } // Controls the ball void Pong::moveBall() { ball_tempX = ball_x; ball_tempY = ball_y; // Hits test for ball speed if (hits >= 30) { speed = 5; } else if (hits >= 20) { speed = 4; } else if (hits >= 10) { speed = 3; } else if (hits >= 5) { speed = 2; } if (( dir == 1 ) && ( ball_x > 5 )&& ( ball_y > 5 )) { if (( ball_x == AI_x + 15 ) && ( ball_y >= AI_y ) && ( ball_y <= AI_y + 60 )) { dir = rand() % 2 + 3; hits++; } else { ball_x -= speed; ball_y -= speed; } } else if (( dir == 2 ) && ( ball_x > 5 ) && ( ball_y < 600 )) { if (( ball_x == AI_x + 15 ) && ( ball_y >= AI_y ) && ( ball_y <= AI_y + 60 )) { dir = rand()% 2 + 3; hits++; } else { ball_x -= speed; ball_y += speed; } } else if (( dir == 3 ) && ( ball_x < 800 ) && ( ball_y > 5 )) { if(( ball_x + 5 == p2_x ) && ( ball_y >= p2_y )&& ( ball_y <= p2_y + 60 )) { dir = rand()% 2 + 1; hits++; } else { ball_x += speed; ball_y -= speed; } } else if ((dir == 4 ) && ( ball_x < 800 ) && ( ball_y < 600 )) { if(( ball_x + 5 == p2_x ) && ( ball_y >= p2_y ) && ( ball_y <= p2_y + 60 )) { dir = rand()% 2 + 1; hits++; } else { ball_x += speed; ball_y += speed; } } else { if (( dir == 1 ) || ( dir == 3 )) { ++dir; } else if (( dir == 2 ) || ( dir == 4 )) { --dir; } } acquire_screen(); circlefill ( buffer, ball_tempX, ball_tempY, 5, makecol( 197, 219, 191 )); circlefill ( buffer, ball_x, ball_y, 5, makecol( 22, 136, 11)); draw_sprite( screen, buffer, 0, 0); release_screen(); // Updates menu menu(); rest(5); } // Player 1 void Pong::AIMove() { AI_tempY = AI_y; //if on cpu's side of court if (( ball_x < 391 ) && ( AI_y > 0 )) { // 391?? i could gmake it 400 but //this makes it m,ore natural //attempt to position in the middle if ( AI_y < 183 ) { AI_y +=4; } if ( AI_y > 217 ) { AI_y -= 4; } } //if ball is close to player if (( ball_x < 117 ) && ( AI_y < 540 )) { // attempt y-axis allignment if ( AI_y < ball_y ) { AI_y += 10; } if ( AI_y > ball_y ) { AI_y -= 10; } } acquire_screen(); rectfill( buffer, AI_tempX, AI_tempY, AI_tempX + 10, AI_tempY + 60, makecol ( 197, 219, 191 )); rectfill( buffer, AI_x, AI_y, AI_x + 10, AI_y + 60, makecol ( 218, 173, 50 )); release_screen(); } // Player 2 void Pong::p2Move() { p2_tempY = p2_y; if (( key[KEY_UP] ) && ( p2_y > 0 )) { //--p2_y; p2_y -= 3; } else if (( key[KEY_DOWN] ) && ( p2_y < 540 )) { //++p2_y; p2_y += 3; } acquire_screen(); rectfill( buffer, p2_tempX, p2_tempY, p2_tempX + 10, p2_tempY + 60, makecol ( 197, 219, 191 )); // actual player 2 rectfill( buffer, p2_x, p2_y, p2_x + 10, p2_y + 60, makecol ( 29, 98, 255)); release_screen(); } // Checks for winner void Pong::checkWinner() { if ( AIScore == 11 ) { textprintf_centre_ex(screen, font, 400, 250, makecol(0,0,255),-1, "GAME OVER!!\n\n PLAYER 1 WINS!"); clear_keybuf(); readkey(); AIScore = 0; } else if ( p2Score == 11 ) { textprintf_centre_ex(screen, font, 400, 300, makecol(255,0,0),-1, "GAME OVER!!\n\n PLAYER 2 WINS!"); clear_keybuf(); readkey(); p2Score = 0; } // Checks for goal score if ( ball_x > p2_x + 20 ) { AIScore++; startNew(); } else if ( ball_x < AI_x - 20 ) { p2Score++; startNew(); } } void Pong::menu() { textprintf_centre_ex(screen, font, 50, 10, makecol(218, 173, 50),-1, "Score: %d", AIScore); textprintf_centre_ex(screen, font, 750, 10, makecol(29, 98, 255),-1, "Score: %d", p2Score); textprintf_centre_ex(screen, font, 400, 10, makecol(22, 136, 11),-1, "Hits: %d", hits); } Pong::Pong() { } [Edited by - neob on June 6, 2007 6:44:10 PM]
  12. Pong Clone Help

    By the way, the project is done with C++ with allegro. Though it should not affect the way the AI should be made.
  13. Pong Clone Help

    I have made a C++ pong clone. However I don’t know how to make AI. What do I need to do in code so that the AI paddle goes after the ball? Does anyone know a specific tutorial or example code for this? Many thanks
  14. C++ getline problem

    perfect thanks. woot