Project 7. You will implement a version of Breakout/Ark

Added on - 19 Sep 2019

  • Dissertation

    type

  • 2

    pages

  • 885

    words

  • 98

    views

  • 0

    downloads

Showing pages 1 to 1 of 2 pages
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 notedbelow 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 classesand/or methods. For instance, I have a private helper method in my Breakout classcalledupdateBallthat call's the Ball's move method and checks for collisions against theother parts. Another example is theballHitBlocksmethod which first checks to see if a ballhits 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/orhorizontally. Then after that pass through all the blocks, it removes the blocks both from the rootof the scene graph as well as the collection of blocks.4.On the class diagram you will notice on the "has a" link betweenBreakoutandBlockanasterisk, which means thatBreakouthas 0 or more blocks. The way that is implemented isusing 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 helpfulespecially because when it comes time to remove any blocks hit by the ball (on agivenKeyFrameupdate) you can use theremoveIfmethod that takes alambda.5.You should have nomagic numbersin your code (except if you need to divide by 2). Yourcode 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 3blocks at a time. The way the ball bounces off, depends on which part of the brick the ball hit. Ifthe ball hit the left or right side of the block then you flip the horizontal velocity. If the ball hit thetop 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 thedirection accordingly. The good news is that the logic for determining where the ball hit aparticular block is given to you in the methodwhichPartHit. Notice it returns anenum,BlockSide. This tutorial (http://tutorials.jenkov.com/java/enums.html(Links to anexternal 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 themiddle 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 sothat the horizontal velocity does not end up too fast.8.Like shown in the demo video, you must provide the instancevariables_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
desklib-logo
You’re reading a preview
card-image

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Unlock This Document