Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+6 votes

Is there a method or a way to check if a node is within a the area of a shape?

asked in CSC305 Fall 2020 by (8 points)

2 Answers

+3 votes

In javaFX a node has a getBoundsInParent method, which you can call getX and getY on. My group ended up writing an intersects method for nodes using these methods to check if the player car intersected with the enemy car

answered by (8 points)
+3 votes

You can use the getBoundsInParent method, also calling getX and getY with that, to see if it intersects.

answered by (8 points)
...