Open andrewshi98 opened 10 years ago
for pong.java, just change g2.fill(gameBall.geteEllipse()); to: g2.fill(gameBall.sigh());
By the way:
change (bCent >= p1Y && bCent < p1Y + ((1/3) * pSizeY)) to (bCent >= p1Y - pSizeY && bCent < p1Y + ((1/3) * pSizeY))
p2 ALSO
Ah thank you! I will implement that
Why should I make gameBall a Rectangle2D though? I think that making it that will make it a draw a rectangle and not a circle (for the gameBall)
And also, I am going to make an edit on the logic of the paddle reflection, for it seems that it changes the y-direction of the ball when it shouldn't. Ill point out the change in my next commit
Ehhhh.... for the shape of the gameball, i make it as a rectangle because i forgot the name of the method to create a circle.....
A circle is an Ellipse2D with the length and width being the same.
I made an update, but it doesnt work at all yet. I will work on it more later, but I wanted to throw out my collider testing. Maybe you guys can tweak it so that it work right, it should pretty easily
Its in the TestPong (test for a collider method to collisions rather than boundaries)
you didn't put break; after every case
Switches and cases have special syntax
Oh wait i see what you mean
i will fix that
Also guys, try to put your new repositories in the Pong / NGSE_Pong repository so we can have all the pong stuff in one place.
Pong now works! Just a few slightly buggy things to fix in my code. I will check your guys's out tomorrow in apcompsci
import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Graphics2D.; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.; import java.awt.event.*;
import javax.swing.JFrame; import javax.swing.Timer;
public class GameBall {
}
//Should be like that