- Here are the JavaFX references
- Obtain a clone of
https://bitbucket.org/jeffondich/cs257_2016,
open the Sprites project in IntelliJ, and run it.
- Use breakpoints to determine which methods in SpriteWorld get called in which order.
- Sprite extends Group, which is a class in the JavaFX library. Find the reference
documentation for Group, and read it. What's its parent class? What methods does Group
add that aren't in its parents?
- Sprite is an abstract class. Where is that marked in the source? What does that mean?
(Try replacing "new Ball()" with "new Sprite()" in SpriteWorld.start to see what happens.)
- Why is there an empty "makeSound" method in Ball? What happens if you delete that method? Why?
- Sprite has several methods marked "final". What does final mean for a method?
- What does Sprite.SHOW_BORDER=true do? (This is not a trick question, in case you were wondering.)
- Try changing the size of each sprite every time it hits the floor. Maybe multiply
the size by 1.5, or alternate between original size and half original size?
- Keep your size-changing-on-bounce code in place, and put breakpoints in Sprite.setSize
and Ball.setSize. When do they get called? Do they both need to get called? What happens
if you comment out "this.resize(width, height)" in Sprite.setSize? (You might find SHOW_BORDER
= true or false to be handy in answering this question.)
- Experiment as you wish.
- Move on to the Sprites assignment.