Skip navigation
Currently Being Moderated

Ball Movement

May 25, 2012 7:03 PM

Hi All,

 

I am developing a double bouncer  game below is the requirement.

 

  • There are two pads on the top boundary and the bottom boundary.
  • The pads are perfectly aligned horizontally.
  • The player can move both the pads left and right using the L/R arrow keys.
  • There is a ball that initially rests on the bottom pad.
    • As soon as the player moves the pad for the first time, the ball is set into motion.
    • The ball’s speed increases progressively with the next level.
    • Level complete after every 100 points.
  • The player has to prevent the ball from going out of the top and bottom boundaries.
  • The left and right boundaries act as walls and the ball bounces off them.
  • The two pads control the angle of bounce of the ball depending on whether they are moving or not when the ball collides with them.
    • If they are moving in the direction of the bounce, the bounce angle is increase.
    • If they are moving against the direction of the bounce, the bounce angle is reduced.
  • The game auto-generates squares at random locations in the empty space in between.
  • All the values should be read from XML file. (e.g. speed of ball, level points)
  • On clicking restart button, game should be reset to initial position.
  • Use any background music in loop.
  • Every time the ball bounces off a square, the player gets +10 points.
    • The square is removed.
    • A new square is added randomly in the empty space
  • Use primitive shapes for all the objects.

 

 

 

 

In this i had a doubt how can i increase the ball bounce angle if pad and ball moving in same direction and how to reduce the ball bounce angle if the pad and ball is not moving in same direction how can i detect whether the ball and pad moving in same direction or not.

 

Please help me out to solve this

 

Thanks in Advance.

 

Regards

Kiran

 
Replies
  • Currently Being Moderated
    May 25, 2012 7:24 PM   in reply to kiran1989

    You should be able to use the arrow keys to determine which way a pad is moving (if it is moving).  And you should be able to use the increase/decrease in the x property to determine which way the ball is moving.

     
    |
    Mark as:
  • Currently Being Moderated
    May 26, 2012 4:16 AM   in reply to kiran1989

    I don't see where needing to know how close you are to the pad has anything to do with what happens when the two objects are touching.  You won't be calculating the bounce until they touch.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points