Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Pirates In this step you will add at least two Pirate ships to the ocean in any available cell. (Alternately you may designate two islands

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Pirates In this step you will add at least two Pirate ships to the ocean in any available cell. (Alternately you may designate two islands as Pirate islands and launch the ships from those islands--Optional). I have provided a pirate ship icon or you may find your own.

You will then implement the observer pattern using Javas inbuilt observer/observable. The pirate ship will register itself with Christopher Columbus ship (CCS) and will receive notifications each time the ship moves. The pirate will use the information about CCS location to chase CC.

Hint 1: Dont forget to load the new ship into an ImageView and add the ImageView to the GraphScene (node tree).

Hint 2: You are going to need to create a class for the PirateShip. Remember this class will implement the observer interface. Your ship class will now extend Observable.

Stretch Suggestions

For some of you this will be easier than others. If you are looking for additional learning opportunities here they are: Add a button on the bottom of the screen. When you press the button the game will reset. i.e. the ocean will be cleared, new islands will be created, and new ships will be placed. There are two different ways to think about this:

(1) if the number of islands remains the same then you can just randomly relocate all the ships and islands that already exist. (2) if the number of islands is going to change then you can remove everything from the scene graph and recreate the entire scene from scratch. Either option is valid so just decide which you want to do. Replace blue rectangles with ocean images and/or islands with Island images.

SE 350 Lab 2: Christopher Columbus Sails the Ocean Blue Objective Christopher Columbus Sails the Ocean Blue This lab is a precursor to Homework #2. It will give you the opportunity to become more familiar with JavaFX before using it to complete your second homework assignment. The lab work involves completing a few guided steps in the JavaFX domain The steps are part of the "Christopher Columbus" adventure- which will be extended for Homework 2 In this adventure you will (1) create a grid of rectangles representing an ocean, (3) place Christopher Columbus' ship onto the ocean, and (3) create a key event handler that moves the ship as you press up, down, left, and right arrows. If you have time, you will add islands to the ocean and integrate the logic that disallows the ship to sail through an island Design Thinkin Create and display the "ocean" in JavaFX. Note: The ocean is initially a 10X10 grid of blue rectangles displayed in a Pane Before we start - let's think about the design. We are going to follow a very similar design to the Maze application and work with three classes: OceanExplorer (aka MazeGame), OceanMap (aka Maze), and Ship (aka Seeker). The OceanExplorer is going to include the main method, set up the JavaFX stage and screen, and include the key event handler. The OceanMap will include the grid (for now this will be quite simple- but it will get more interesting when we add islands etc). The ship tracks the current location of the ship and is responsible for move North, South, East, and West operations Step 1: Set u 1. Create a new java project called ColumbusGame 2. Create three new classes: OceanExplorer, OceanMap, and Ship. Make sure OceanExplorer contains a main) method Step 2: Create a Stage in Ocean Explorer 3. Make the OceanExplorer class extend Application. Import necessary packages and add the Start method (you can just accept Eclipse's recommendation to add unimplemented methods) Add the statement: launch(args) to main(...) Now you are ready to create and display a scene on the stage. In this first step we will just create an empty stage 4. 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions