Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Assignment: An Asteroids Screen The Program should be in Java This assignment is about using variables, data types, loops, if statements, and FX Graphics

The Assignment: An Asteroids Screen The Program should be in Java This assignment is about using variables, data types, loops, if statements, and FX Graphics to draw a single screen from the classic video game Asteroids, configured according to user input. (Dont worry, its just a still screen nothing has to move in this assignment.) Setup Use the FXGraphicsTemplate for this assignment. Change the class name to something meaningful and change the window title, and size of the stage to whatever makes sense. Input When your program runs, it should have a dialog with the user (dont show the JavaFX stage until after this dialog is over). Ask the user: 1) the x and y location of the center of each asteroid as well as its size (allow the user to decide how many asteroids), 2) the current score, 3) the number of lives remaining, 4) the x and y location of the players spaceship, 5) the x and y location of at least 1 alien spaceship, and 6) the color of the players spaceship and the alien spaceship (use integers, e.g. 1=red, 2=blue, 3=green). Make sure the user enters values that will look good (e.g. each asteroid should display fully on the screen). Give the user a range of acceptable values in each prompt and make them repeat each input until they get it right. Important Tip: Instead of storing the asteroid locations and sizes, draw each asteroid as soon as the user has entered its x, y, and size values. Output When the stage appears, it should look a bit like a scene from an Asteroids game, as shown below. Score and lives Asteroids Alien Spaceship Players Spaceship Copyright (Your name, 2021) NOTE: Your output does not have to look like the image shown above. For example, you could use circles for asteroids, and a rectangle for the player. And feel free to make the game as colorful as you like! But try to use at least two Java FX shapes to make the alien ship look like a flying saucer or something recognizable. But youre not going to be graded on your artistic skills. Documentation Standards Dont forget to follow the Documentation Standards for the course (i.e. Javadoc commenting, meaningful variable and class names, consistent indenting). See Documentation Standards on Canvas. Handing In You have approximately 1 week to complete this assignment. See the due date and time in the Assignments area on Canvas. Hand in by attaching a zipped version of your .java (not .class) file to the drop box. (If you used images or sounds see the extra challenges above you must also include these files in the zip file.) Evaluation Your assignment will be evaluated for performance (40%), structure (40%) and documentation (20%) using the rubric in the Assignments area on Canvas. Extra challenge 3: Use the FXAnimationTemplate instead and add some animation effects such as a moving alien spaceship. Maybe you could even figure out a way to add sound effects Extra challenge 1: Find some authentic videogame images on line and use those instead of squares and rectangles. Image img = new Image("imagename.jpg"); gc.drawImage(img, x, y); Extra challenge 2: Add a random option that generates all the inputs randomly and displays the result (Math.random()*RANGE+MIN) generates a random double between MIN and MIN+RANGE-1. Extra challenge 4: The asteroids in the original game are strangely-shaped polygons. There are polygon drawing methods in GraphicsContext. Can you figure out how to use them?

image text in transcribedimage text in transcribed

Page

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

Students also viewed these Databases questions