Hi, I am trying to learn some basic game programming and already made simple pong game so I thought next step could be simple breakout. I already got ball and bat made by Rectangle. How about bricks, also Rectangle? If so it would be easy to break them just by using intersect(), but how to add those? And second question, what is the best way to modify the angle of the ball?
Viped 0
Junior Poster in Training
Recommended Answers
Jump to PostBy angles do you mean the changes in the x and y locations of the object as it moves?
If you change only the x value then the object moves horizontally. Changes in the y value moves the object vertically. Changes of both will move somewhere in between.
Jump to PostHow do you execute the code for testing? I don't see a main() method.
Have you tried debugging the code by adding printlns to show the values of variables as they are changed and used?
I see one println but it doesn't show which item it is refering to. It …
Jump to PostI am not sure what you mean by "i and dy".
The following code uses the variables: i & dy. Their values should be printed for debugging:
bricks[i].setDestroyed(true); System.out.println("Brick destroyed! i="+i + ", dy="+dy); dy*=-1;
if ball hits on the right side …
Jump to Postwhere you want the debug info
When you wrote the code you expected the variables to have certain values and for their values to change in a certain way. Debugging the code means that you should print out the values of the variables as their values change and …
Jump to Postfrom which line I should get the debug info
For all variables used in the program.
All 17 Replies
Viped 0
Junior Poster in Training
NormR1 563
Posting Sage Team Colleague
Viped 0
Junior Poster in Training
NormR1 563
Posting Sage Team Colleague
Viped 0
Junior Poster in Training
NormR1 563
Posting Sage Team Colleague
Viped 0
Junior Poster in Training
NormR1 563
Posting Sage Team Colleague
Viped 0
Junior Poster in Training
NormR1 563
Posting Sage Team Colleague
Viped 0
Junior Poster in Training
NormR1 563
Posting Sage Team Colleague
Viped 0
Junior Poster in Training
NormR1 563
Posting Sage Team Colleague
Viped 0
Junior Poster in Training
NormR1 563
Posting Sage Team Colleague
Viped 0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.