Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 Oct 2012
Offline Last Active Jun 19 2013 01:57 PM

Posts I've Made

In Topic: Bullets won't shoot up or down

12 June 2013 - 02:45 PM

Take a look in your keylistener and shoot functions for player. Change the else ifs to just ifs, because what is happening there is that if you press right and then press and hold down, it will not shoot down as well because of the else clause.

I tried that but it seems like the keyboard is not the issue. When I replace the setVy with setVx the program responds to the keyboard input. But if I replace it back then it won't respond with the setVy. Basically something is wrong with the methods/variable itself not the keyboard.

In Topic: Bullets won't shoot up or down

12 June 2013 - 11:57 AM

First of all:

if(intDir == 1){vectBullet.back().setVy(-10);}
else if(intDir == 2){vectBullet.back().setVy(-10);}

I don't think this will result in the shoot going in opposite ways.

Sorry, minor mistake. But the bullets still won't shoot on the Y axis. Is there anything else wrong witht the code?

In Topic: Collision Detection

12 June 2013 - 11:16 AM

I made a bounding box class if you want.

Just create a bounding box for the ball and the paddle and just check if they collide.

Here are the files:



This only fixes the collision problem(hopefully). The bouncing problem I don't know how to fix...

In Topic: OpenGL application stopped working

31 December 2012 - 05:22 PM

Well I made Tex and Bitmap no longer a global variable.

I also checked the debugger and it says the problem is this section of the code.

 if((i + 1) % padWidth == 0)
i += offset;
*(pixelData + j + 2) = *(tempPixelData + i);
*(pixelData + j + 1) = *(tempPixelData + i + 1);
*(pixelData + j) = *(tempPixelData + i + 2);

I tried deleting that part of the code and it worked but it didn't show the texture.

Any idea what could be wrong?

In Topic: OpenGL Triangle not being displayed

26 December 2012 - 04:19 PM

You're passing hDc and hRc to EnableOpenGL by value but expect the function to change the values in your main function since you're using those variables later. Pass them by reference instead if you expect the function to change the original variables and not the parameter variables local to the function itself. You're also not creating the device context anywhere; you need to call GetDC to actually get the value for hDc.


You're missing many of these errors because you're not checking the return values from the functions. You definitely should start checking for errors from the functions you call; they are there for a reason.

Thank you for that. You saved me from future errors with my program.

But after looking at the code bit.

I switched

GetMessage(&msg,NULL,0,0) > 0





making the program work. Thank you for giving me more insight on opengl.