0

How can I detect if the ball in the breakout.c problem (pset3) is moving up or down? In other words how do I detect changes in Y parameter of velocity?

Are there any functions for this purpose in the Stanford package? Or if anyone can provide insight to some process to get the same, the one which I'm currently overlooking.

5
  • I don't think the task is to detect changes as much as to make the changes yourself. The bounce.c program only had an X velocity, but the function that was called to give the ball that velocity had to take in an argument for the Y velocity as well, although it had to be zero in order to ensure the ball would only move left/right. You'll need to change this for the breakout program. Hope this helps!
    – Michael F
    Jan 25, 2015 at 8:52
  • sorry, I meant the breakout.c problem. I edited the question accordingly.
    – ABor
    Jan 25, 2015 at 8:53
  • The normal should be that if the Y velocity is positive the ball moves up and if it is negative the ball moves down. Notice that Y velocity only change if you want it to change, by specifying some condition. I am not sure what you are asking here, maybe you should explain a bit more.
    – wallek876
    Jan 25, 2015 at 9:24
  • 1
    Actually, GWindow calls the top left corner 0,0 and the bottom right (max-x), (max-y). In other words, down actually adds y. So for X positive is right and negative is left, but for Y positive is down and negative is up
    – Michael F
    Jan 25, 2015 at 10:10
  • You are right, i forgot about that. But stil i don't understand what you are asking. Can you explain a bit more about your problem or your doubt, maybe with an example.
    – wallek876
    Jan 25, 2015 at 10:45

0

You must log in to answer this question.

Browse other questions tagged .