| | |
RAMP GAME
Please support our Game Development advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 1,439
Reputation:
Solved Threads: 118
•
•
•
•
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???
Somewhere in your game loop, try:
ySpeed += 0.5f;
Last edited by William Hemsworth; Sep 2nd, 2009 at 9:32 am.
I need pageviews! most fun profile ever :)
•
•
Join Date: Aug 2009
Posts: 12
Reputation:
Solved Threads: 0
I have changed these lines of code
Now the ball is moving in y-axis only...
And William where i should make these changes u r talking ??
GLfloat xSpeed = 0.0f; // Ball's speed in x and y directions GLfloat ySpeed = 0.05f;
And William where i should make these changes u r talking ??
ySpeed += 0.5f;
•
•
Join Date: Mar 2008
Posts: 1,439
Reputation:
Solved Threads: 118
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 :)
•
•
Join Date: Aug 2009
Posts: 12
Reputation:
Solved Threads: 0
Thanks William it is working......
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
[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]
// Animation Control - compute the location for the next refresh ySpeed -= 0.04f; xPos += xSpeed; yPos += ySpeed;
I MEAN I SET THESE LINES OF CODE
GLfloat xSpeed = 0.0f; // Ball's speed in x and y directions GLfloat ySpeed = 0.001f;
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.
•
•
Join Date: Mar 2008
Posts: 1,439
Reputation:
Solved Threads: 118
You're shouting again, and i don't understand your question.
I need pageviews! most fun profile ever :)
•
•
Join Date: Aug 2009
Posts: 12
Reputation:
Solved Threads: 0
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
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?
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;
U GOT ME NOW?
Last edited by ammadkhan; Sep 2nd, 2009 at 3:49 pm.
![]() |
Similar Threads
- looking for C++ London 3D Game Porgrammers - Growing proffessional startup company (Software Development Job Offers)
- Motion Behavior Engineer - C++ - Game Engine (Software Development Job Offers)
- Roblox seeks Game and Graphics Guru (Software Development Job Offers)
- game programmer needed (Software Development Job Offers)
- Ajax Game Developer Needed for a small project (Web Development Job Offers)
Other Threads in the Game Development Forum
- Previous Thread: playing age of empires 2 with hamachi
- Next Thread: Recommended C# - XNA Game Software
| Thread Tools | Search this Thread |
3d advertising ai algorithm ban c++ cambridge camera censorship china competition console development engine fov fpx game gamer games gaming gauntanamo government idaho in-gameadvertisement intellectualproperty l-systems laracroft lindenmayer live manhunt math mathematics matrix mercenaries microsoft mmorpg modded msn naked news nintendo obama opengl palin physics pirate playstation politics projection ps3 rpg search selection software sony stephenhawking stocks studio technology terrorism tombraider uk videogame web wii world-of-warcraft xbox xbox-live xbox360







