assume that the game world size is fixed and covers 1024(width) x 768(height)… 1 answer below »
assume that the game world size is fixed and covers 1024(width) x 768(height)… 1 answer below »
Assignment #1: Class Associations & InterfacesDue Dates:1st Delivery: 4 Test cases – February 11th, 2019 [1 week]2nd Delivery: UML Class Diagram + Source Files + Jar file – February 25th, 2019 [2+ weeks]IntroductionIn this Spring 2019 semester, we will be studying object-oriented computer graphicsprogramming by developing a program which is a variation of a classic arcade and home videogame called “Asteroids” (Version 5 – 8/4/18). In this game, you will be controlling a space shipflying through a field of asteroids, firing missiles to destroy asteroids which threaten to collidewith and destroy your ship. Occasionally, enemy ships attempt to impede progress. Variousother graphical operations will also be implemented to extend your game beyond the originalversion.If you have never seen the original Asteroids game, you can see a sample of the (Arcade)Asteroids game in Youtube. https://www.youtube.com/watch?v=WYSupJ5r2zo. However, yourgame will be slightly different, and it is not necessary to be familiar with the original Asteroidsgame to do any of the assignments during the semester.The initial version of your game will be text-based. As the semester progresses we will addgraphics, animation, and sound. The goal of this first assignment is to develop a good initialclass hierarchy and control structure, and to implement it in CN1/Java. This version useskeyboard input commands to control and display the contents of a “game world” containing a setof objects in the game. In future assignments, many of the keyboard commands will be replacedby interactive GUI operations or be replaced with animation functions, but for now we will simplysimulate the game in “text mode” with user input coming from the keyboard and “output” beinglines of text on the screen.Program StructureBecause you will be working on the same project all semester, it is extremely importantto organize it correctly from the beginning. Pay careful attention to the class structure describedbelow and make sure your program follows this structure accurately.The primary class encapsulates the notion of a Game. A game in turn contains severalcomponents: (1) a GameWorld which holds a collection of game objects and other statevariables, and (2) a play() method to accept and execute user commands. Later, we will learnthat a component such as GameWorld that holds the program’s data is often called a model.The top-level Game class also encapsulates the flow of control in the game (such a classis therefore sometimes called a controller). The controller enforces rules such as what actionsa player may take and what happens as a result. This class accepts input in the form of keyboardcommands from the human player and invokes appropriate methods in the game world toperform the requested commands – that is, to manipulate data in the game model.In this first version of the program the top-level game class will also be responsible fordisplaying information about the state of the game. In future assignments, we will learn about aseparate kind of component called a View which will assume that responsibility.For now, assume that the game world size is fixed and covers 1024(width) x 768(height)area (although we are going to change this later). The origin of the “world” (location (0,0)) is thelower left hand corner. The game world contains a collection which aggregates objects ofabstract type GameObject. There are two kinds of abstract game objects: “fixed objects” withfixed locations (which are fixed in place) and “moveable objects” with changeable locations(which can move or be moved about the world). For this first version of the game there is just asingle kind of fixed object: a space station; and there are three kinds of moveable objects:ships (Player Ship (PS) and Non-Player Ship (NPS), missiles (which are objects fired byships), and asteroids. Later we will see that there are other kinds of game objects as well.