Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+7 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 (1 point)

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 (1 point)
+3 votes

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

answered by (1 point)
...