JavaFX Breakout/Arkanoid Game Implementation


Added on  2019-09-19

2 Pages885 Words200 Views
Project 7You will implement a version of Breakout/Arkanoid using JavaFX.RequirementsDownload theBreakoutStarter.zipstarter project zip file. Unzip it and open it in IntelliJ.1.Have fun!2.Your functionality will match that in shown in the demo, except for the extra credit noted below if you decide to attempt that.3.Implement the design shown in the class_diagram.uxf file included in the project directory. Recall you can open that inUmlet(Links to an external site.)Links to an external site.or (online) inUmletino(Links to an external site.)Links to an external site.. You may add additional classes and/or methods. For instance, I have a private helper method in my Breakout class calledupdateBallthat call's the Ball's move method and checks for collisions against the other parts. Another example is theballHitBlocksmethod which first checks to see if a ball hits one or more of the blocks, noting which part of the block the ball hit (HINT: useswhichPartHit) and then sets one or more flags on whether to bounce vertically and/or horizontally. Then after that pass through all the blocks, it removes the blocks both from the root of the scene graph as well as the collection of blocks.4.On the class diagram you will notice on the "has a" link betweenBreakoutandBlockan asterisk, which means thatBreakouthas 0 or more blocks. The way that is implemented is using some sort of collection, e.g. array, 2d-array, or something in thejava.util.package. HINT: In my implementation I use ajava.util.ArrayList<Block>.. This is helpful especially because when it comes time to remove any blocks hit by the ball (on a givenKeyFrameupdate) you can use theremoveIfmethod that takes alambda.5.You should have nomagic numbersin your code (except if you need to divide by 2). Your code should be written making use of the constants defined in theConstantsinterface.6.Having the ball bounce off the blocks. First note that it is possible for the ball to hit up to 3 blocks at a time. The way the ball bounces off, depends on which part of the brick the ball hit. If the ball hit the left or right side of the block then you flip the horizontal velocity. If the ball hit the top or bottom of the block, you flip the vertical velocity. If the ball hit the corner of a block, you flipboth. Of course, if you hit multiple blocks in different places then you will need to change the direction accordingly. The good news is that the logic for determining where the ball hit a particular block is given to you in the methodwhichPartHit. Notice it returns an enum,BlockSide. This tutorial (http://tutorials.jenkov.com/java/enums.html(Links to an external site.)Links to an external site.) should give you an idea of how to use an enum.7.Bouncing off the paddle, can change the ball's horizontal velocity. Basically, you subtract the middle horizontal point of the paddle from the middle point of the ball and then scale (divide) thatresult down and set it as the new horizontal velocity of the ball. Make sure to scale it enough so that the horizontal velocity does not end up too fast.8.Like shown in the demo video, you must provide the instance variables_bounceBottomand_testTop. When_bounceBottomis true, the ball will bounceoff the bottom of the screen instead of falling through and causing the game to end -- this will

End of preview

Want to access all the pages? Upload your documents or become a member.