Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java FX problem with Rectangle Intersects

  1. #1
    Junior Member
    Join Date
    Oct 2021
    Thanked 0 Times in 0 Posts

    Default Java FX problem with Rectangle Intersects

    HI my friends.
    I am trying to do a collision with 2 rectangles..
    It works.. but I have a problem.
    I have a ball going down.. and when it colides with a box.. I say go UP..
    but it just stops there..
    my logic is:

    public class Collision {

    private boolean check = false;
    public void check(Player player, Ball ball){

    if (!player.getPlayer().intersects(ball.getBall()) && check == false){
    } else {
    check = true;

    dont know what is wrong.
    Thank you

  2. #2
    Junior Member
    Join Date
    Jul 2019
    Thanked 2 Times in 2 Posts

    Default Re: Java FX problem with Rectangle Intersects

    look if intetsects() is true after moveDOWN()
    and if move down snd up works in this situation, because result is stop move
    look at loop where check() is called if its condition is still true
    do some test prints of key values or use debugger

Similar Threads

  1. Replies: 2
    Last Post: June 9th, 2014, 04:06 PM
  2. Intersects method problems(FIXED)
    By albin1228 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 22nd, 2013, 06:51 AM
  3. intersects method
    By game06 in forum Java Theory & Questions
    Replies: 6
    Last Post: March 31st, 2013, 01:06 AM
  4. How to display a Rectangle object in JFrame (Problem).
    By voltaire in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 15th, 2012, 07:22 PM
  5. grow a rectangle in java
    By Khoatic in forum Java Theory & Questions
    Replies: 2
    Last Post: September 8th, 2010, 06:13 PM