|
Massive Hit Deletion Help please
Hello I am new here but could someone please guide be through how to make an array for my hit detection.
Below is the code I am focusing on for my hit detection.
// in my public void run()
Rectangle paddleRect = new Rectangle(paddlex,650,75,15);
Rectangle ballRect = new Rectangle(ballx,bally,25,25);
if(ballRect.intersects(paddleRect))
{
yChange=yChange*-1;
bally=bally-1;
}
if(ballRect.intersects(Rect))
{
yChange=yChange*-1;
}
As you can see I am using a very basic method for my hit detection for my 40 blocks in my break out game.
Here is how I have my game setup
I am using one array for the blocks x locations than I just create four different images of the blocks which I place at 4 different y locations.
I hope this is enough infomation. If you need more infomation please tell me so I can get this breakout game done before christmas
|