Thread: Reference to making breakout game

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    133
    Hi darkness, thank you for ur elaborated explanation. I really think your suggestion is good.

    Code:
    // will be using a shrunken rect to represent round ball
    Ball 
    -shrunkenX:double  // coord of top left corner of shrunken rect
    -shrunkenY:double // in pixel
    -x: double // coord of ball
    -y:double 
    -x_vector:double // vector of ball movement
    -y_vector:double
    This time i will keep two double attribute x_vector and y_vector instead of angle. Each time i need to update the position of the ball. I simply do a

    Code:
    x +=x_vector;
    y +=y_vector;
    i can also change the magnitude of the vector to determine the speed of the ball.

    Reflection is a matter of change the sign of x_vector and y_vector as you mentioned.

    Now i can start coding the actual game. Once again, thanks!

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    580
    Yeah not a problem. Best of luck to you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Strange/false errors
    By Ganoosh in forum Windows Programming
    Replies: 8
    Last Post: 10-20-2005, 04:54 PM
  3. How to: Use OpenGL with Jgrasp
    By Pickels in forum Game Programming
    Replies: 3
    Last Post: 08-30-2005, 10:37 AM
  4. GCC - Strange networking functions error.
    By maththeorylvr in forum Windows Programming
    Replies: 3
    Last Post: 04-05-2005, 12:00 AM
  5. help with making a game
    By thatdude in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2003, 06:10 AM