Questions tagged [ball]
The ball tag has no usage guidance.
13
questions
0
votes
1
answer
114
views
Pset3 Breakout: Ball is passing through the paddle despite collision code.
so my ball is passing through my paddle despite the collision code I implemented.
//bounce off paddle and bricks
GObject collision = detectCollision(window, ball);
if (collision != NULL)...
0
votes
1
answer
134
views
Pset3 Breakout Ball blatantly ignores velocity change when colliding with wall
Something rather strange is taking place while I test my collision detection for the ball hitting the walls. The code below to my eye seems correct to make the ball bounce off of all 4 walls of the ...
0
votes
0
answers
39
views
Cannot get both ball and paddle to work at the same time
Breakout: If I put return ball inside the while loop, I get a working paddle but the ball doesn't move. If instead, I put return ball outside the while loop or have no return at all, the ball moves, ...
0
votes
1
answer
155
views
Breakout -- ball continues bouncing after it moves past paddle
i'm currently working on breakout.c, but i'm having trouble with the ball continuing to bounce off the bottom even after it drops below the paddle (step 9 of the spec walkthrough). Instead, I want it ...
0
votes
0
answers
55
views
Pset3 : Ball doesn't begin motion from center of window
I initially instantiated the ball in the center of the window using the initBall function. However after I implemented the code to move the ball randomly across the window, it doesn't begin its motion ...
0
votes
1
answer
262
views
pset3 Ball not detecting bricks
I have used detectCollision to make the ball bounce off the paddle. I have tried to use it to make the ball bounce of the bricks but it does not. Actually, it does not compile. This is the piece of ...
1
vote
2
answers
659
views
Ball moving problems
I’m having some problem with the movement and collisions of the ball. I’ve searched for answers here but I still cannot figure out how to do what they suggested.
The ball gets stuck in the paddle ...
0
votes
2
answers
68
views
Problems implementing initBall()
I have written the code for pset4 but I have an odd problem and I can't find the solution for this malfunctioning issue I have in the ball function.
The code I have is the following:
GOval initBall(...
1
vote
1
answer
136
views
Ball bounces just above paddle
When I run the following code the ball bounces just above the paddle (around 10 pixels above the paddle).
I haven't messed with the detect-collision function and following are my initPaddle() and code ...
0
votes
1
answer
281
views
Breakout: Bouncing the Ball Up and Down
I'm not sure how to make the ball bounce up and down.
Here's my code:
while (lives > 0 && bricks > 0)
{
double velocity = 2.0;
move(ball, 0, velocity);
if (getY(ball) <...
0
votes
3
answers
422
views
pset4 Ball is not moving
Issue: the ball is not moving.
Code:
// keep playing until game over
while (lives > 0 && bricks > 0)
{
while (true)
{
// check for mouse event
GEvent event = ...
0
votes
1
answer
208
views
Why Does the Ball Disappear After Calling move()?
Code runs perfectly when the initialization functions are called. I get the bricks, the ball and the paddle which moves with mouse. However, when program calls
move(ball, velocity, vertical);
where ...
0
votes
1
answer
484
views
pset 4 breakout ball hitting bricks
I am having trouble with hitting all my bricks. I'm done with all 10 steps in the pset but when I get to hitting the last 3 - 5 or so bricks, my ball doesn't have enough "randomness" to hit them. My ...