Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualburnt_casadilla

Posted 15 August 2012 - 04:25 PM

aha! created a new arraylist called BallREctangle

[source lang="java"]public ArrayList<Rectangle> BallRectangle;[/source]

then in the updategame method if loop...

[source lang="java"]BallRectangle.add(new Rectangle(newX, newY, 20, 20));[/source]

does this work for what i want?

scratch that

[source lang="java"] for(int i = 0; i < BALLS.size(); i++) { BallRectangle.add(new Rectangle(BALLS.get(i).x, BALLS.get(i).y, 20, 20));[/source]

right below the checkCollision(); in the update game method

now i just need the for statement in my checkCollision method

after running my program with the new for loop it freezes when the first ball is created

this is in my checkcollision method

[source lang="java"] if(mainBallRectangle.intersects(BallRectangle.get(i))) { mainBall.xspeed = 0; mainBall.yspeed = 0; mainBall.xpos = 100; mainBall.ypos = 100; }[/source]

now the game doesnt even run lol

#4burnt_casadilla

Posted 15 August 2012 - 04:15 PM

aha! created a new arraylist called BallREctangle

[source lang="java"]public ArrayList<Rectangle> BallRectangle;[/source]

then in the updategame method if loop...

[source lang="java"]BallRectangle.add(new Rectangle(newX, newY, 20, 20));[/source]

does this work for what i want?

scratch that

[source lang="java"] for(int i = 0; i < BALLS.size(); i++) { BallRectangle.add(new Rectangle(BALLS.get(i).x, BALLS.get(i).y, 20, 20));[/source]

right below the checkCollision(); in the update game method

now i just need the for statement in my checkCollision method

after running my program with the new for loop it freezes when the first ball is created

#3burnt_casadilla

Posted 15 August 2012 - 04:00 PM

aha! created a new arraylist called BallREctangle

[source lang="java"]public ArrayList<Rectangle> BallRectangle;[/source]

then in the updategame method if loop...

[source lang="java"]BallRectangle.add(new Rectangle(newX, newY, 20, 20));[/source]

does this work for what i want?

scratch that

[source lang="java"] for(int i = 0; i < BALLS.size(); i++) { BallRectangle.add(new Rectangle(BALLS.get(i).x, BALLS.get(i).y, 20, 20));[/source]

right below the checkCollision(); in the update game method

now i just need the for statement in my checkCollision method

#2burnt_casadilla

Posted 15 August 2012 - 03:58 PM

aha! created a new arraylist called BallREctangle

[source lang="java"]public ArrayList<Rectangle> BallRectangle;[/source]

then in the updategame method if loop...

[source lang="java"]BallRectangle.add(new Rectangle(newX, newY, 20, 20));[/source]

does this work for what i want?

scratch that

[source lang="java"] for(int i = 0; i < BALLS.size(); i++) { BallRectangle.add(new Rectangle(BALLS.get(i).x, BALLS.get(i).y, 20, 20));[/source]

right below the checkCollision(); in the update game method

#1burnt_casadilla

Posted 15 August 2012 - 03:54 PM

aha! created a new arraylist called BallREctangle

[source lang="java"]public ArrayList<Rectangle> BallRectangle;[/source]

then in the updategame method if loop...

[source lang="java"]BallRectangle.add(new Rectangle(newX, newY, 20, 20));[/source]

does this work for what i want?

PARTNERS