Please support our Game Development advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2009
Posts: 12
Reputation: ammadkhan has a little shameless behaviour in the past 
Solved Threads: 0
ammadkhan ammadkhan is offline Offline
Newbie Poster

Re: RAMP GAME

 
0
  #11
Aug 31st, 2009
I know the physics thing .......but i don't know how interact both the things......
I mean i can make a class of VECTOR working for 2D, it can find the dot product, addition, subtraction and all.
But i don't how interact this class with the circle to find collision detection....
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: ammadkhan has a little shameless behaviour in the past 
Solved Threads: 0
ammadkhan ammadkhan is offline Offline
Newbie Poster

Re: RAMP GAME

 
0
  #12
Sep 1st, 2009
This code is running good ... but I'm unable to make the ball fall down.
Plz tell what changes i should make to create gravity effects???
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,439
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 118
Sponsor
William Hemsworth William Hemsworth is online now Online
Nearly a Posting Virtuoso

Re: RAMP GAME

 
0
  #13
Sep 2nd, 2009
Originally Posted by ammadkhan View Post
This code is running good ... but I'm unable to make the ball fall down.
Plz tell what changes i should make to create gravity effects???
Constantly increment ySpeed by however strong you want the gravity to be.

Somewhere in your game loop, try:
ySpeed += 0.5f;
or a value of your choice (better stored as a constant variable).
Last edited by William Hemsworth; Sep 2nd, 2009 at 9:32 am.
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: ammadkhan has a little shameless behaviour in the past 
Solved Threads: 0
ammadkhan ammadkhan is offline Offline
Newbie Poster

Re: RAMP GAME

 
0
  #14
Sep 2nd, 2009
I have changed these lines of code
GLfloat xSpeed = 0.0f;      // Ball's speed in x and y directions
GLfloat ySpeed = 0.05f;
Now the ball is moving in y-axis only...
And William where i should make these changes u r talking ??
ySpeed += 0.5f;
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,439
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 118
Sponsor
William Hemsworth William Hemsworth is online now Online
Nearly a Posting Virtuoso

Re: RAMP GAME

 
0
  #15
Sep 2nd, 2009
Pretty much anywhere in your game loop, if you want an exact position, I would put it directly before the lines:
// Animation Control - compute the location for the next refresh
xPos += xSpeed;
yPos += ySpeed;
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: ammadkhan has a little shameless behaviour in the past 
Solved Threads: 0
ammadkhan ammadkhan is offline Offline
Newbie Poster

Re: RAMP GAME

 
0
  #16
Sep 2nd, 2009
Thanks William it is working......
// Animation Control - compute the location for the next refresh
   ySpeed -= 0.04f;
   xPos += xSpeed;
   yPos += ySpeed;
NOW I HAVE A QUESTION, IF THE BALL DETECTS ANY COLLISION IN BETWEEN THE SCREEN WILL IT MOVEIN X-AXIS OR NOT????
I MEAN I SET THESE LINES OF CODE
GLfloat xSpeed = 0.0f;      // Ball's speed in x and y directions
GLfloat ySpeed = 0.001f;
[edit]
which means ( GLfloat xSpeed = 0.0f; ) this will effect the ball to move in x-axis if the ball detects any sloped line ....right?
[/edit]
Last edited by ammadkhan; Sep 2nd, 2009 at 12:56 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,439
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 118
Sponsor
William Hemsworth William Hemsworth is online now Online
Nearly a Posting Virtuoso

Re: RAMP GAME

 
0
  #17
Sep 2nd, 2009
You're shouting again, and i don't understand your question.
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: ammadkhan has a little shameless behaviour in the past 
Solved Threads: 0
ammadkhan ammadkhan is offline Offline
Newbie Poster

Re: RAMP GAME

 
1
  #18
Sep 2nd, 2009
I'm not shouting my friend...
First tell me how can i attach my file here in the thread?
then will understand my problem...
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: ammadkhan has a little shameless behaviour in the past 
Solved Threads: 0
ammadkhan ammadkhan is offline Offline
Newbie Poster

Re: RAMP GAME

 
-2
  #19
Sep 2nd, 2009
http://www.4shared.com/file/12969485...8122/ramp.html
CHECK THIS OUT , I HAVE MADE A .bmp FOR U.
[EDIT]
NOW U CAN SEE THE SLOPED LINES TO WHICH THE BALL IS INTERSECTING,
NOW AFTER INTERSECTION THE BALL WILL TRAVEL BOTH THE AXIS i.e X AND Y.
I WRITE THIS LINE IN MY CODING
GLfloat xSpeed = 0.0f;      // Ball's speed in x and y directions
GLfloat ySpeed = 0.001f;
WHICH MEANS BALL HAS ONLY ySpeed BUT NOT xSpeed, WHICH FURTHER MEANS THE BALL WILL MOVE IN ONLY ONE DIRECTION i.e Y-AXIS.
U GOT ME NOW?
Last edited by ammadkhan; Sep 2nd, 2009 at 3:49 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 12
Reputation: ammadkhan has a little shameless behaviour in the past 
Solved Threads: 0
ammadkhan ammadkhan is offline Offline
Newbie Poster
 
0
  #20
21 Days Ago
Well , Thanks William..... That was very very helpful....
Sorry because my English is not that much strong to specify my question correctly.......
But u helped anyways.....
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Game Development Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC