Jump to content
  • Advertisement
phil67rpg

C++ win 32 pong

Recommended Posts

Advertisement

can we work on the code snippet  you gave me I have almost got it.

comp_move += 5.0f * comp_velocity;	

if(comp_move < (0.0f)) 
{ 
  comp_velocity = 1.0f; 
}
if(comp_move > (600.0f)) 
{ 
  comp_velocity = -1.0f; 
}

 

Share this post


Link to post
Share on other sites
Posted (edited)

You are entertaining predictable consistent, I'll give you that. 

Sure. How would you like to work. Perhaps show us how you use that constant rate ping ponging value. Please. By all means. 

https://en.wikipedia.org/wiki/Ping-pong_scheme (Only the first paragraph directly applies)

Making pong here right?

Edited by GoliathForge
Oh, I edited the <parc< out of it....LOL

Share this post


Link to post
Share on other sites
3 minutes ago, GoliathForge said:

Perhaps show us how you use that constant rate ping ponging value.

what do you mean?

Share this post


Link to post
Share on other sites

here is the code almost working I just want it to hit the left edge of the screen

comp_move += 0.1f * comp_velocity;	

if(comp_move <= (0.0f)) 
{ 
  comp_velocity = 1.0f; 
}
if(comp_move >= (710.0f)) 
{ 
  comp_velocity = -1.0f; 
}

 

well you will be happy that I solved my problem.

Share this post


Link to post
Share on other sites

I believe I would...sort of...I disagree with trying to compare exact float values...go back to where you were. Just use the source I unscrambled. You'll find it very familiar because you wrote most of it. Don't let the timer thing bother you, or the c++ string stream dirty usage or extracting out unnecessary continual brush creation.

Kick it in the corner if it pleases. Only software. 

Share this post


Link to post
Share on other sites

here is my code

comp_move += 0.1f * comp_velocity;	

if(comp_move <= (0.0f)) 
{ 
  comp_velocity = 1.0f; 
}
if(comp_move >= (730.0f)) 
{ 
  comp_velocity = -1.0f; 
}

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!