Fill in the blanks...

Alright so I have this asteroid project I am having to do for a class... I pretty much have to make the asteroids game out of a template he gave us... I have a lot of it done but There are probably like 12ish blanks I need help fiilling in. He gives comments about how he wants it done but I still don't know how to do it. If anyone could tell me how to/what to do that would be awesome. Here is the code. I am going to separate each code (there is one for the ship one for the meteors etc) but a line of ****.
PS Whatever you can help me with even if it is just one line would be appreciated. :) Oh and there is a bullet code too and an "asteroid" code for the physical comets (my only problem on that one is similar to the assigning a random negative number on the other one... there just isn't enough room for it. :)
import java.util.Random;
public class Ship {
     private final int SCREEN_WIDTH = 500;
     private final int SCREEN_HEIGHT = 500;
     private static Random rdm = new Random();
     private boolean visible;
     private int x;
     private int y;
     private int xSpeed;
     private int ySpeed;
     private int xDir;
     private int yDir;
     private int shipHeight;
     private int shipWidth;
     private int maxSpeed;
     // Default constructor for Ship calls the other constructor
     // with a hard-coded value of 30 (ship size)
     public Ship() {
          this(30);
     //Constructor that is reponsible for initializing / instantiating
     // all of a Ship object's instance variables.
public Ship(int s) {
          //set visibility to true          
          visible = true;
          //set ship height and width to argument passed in
               shipHeight = 30;
               shipWidth = 30;
          //initialize the x and y speeds to 0 (ship is not moving)
          xSpeed = 0;
          ySpeed = 0;
          //initialize xDir to a random choice between -1,0, and 1
          //This means the x direction is either right, left, or no change (only vertical movement)
          //initialize yDir to a random choice between -1,0, and 1
          //This means the y direction is either right, left, or no change (only horizontal movement)
          //set x and y to the middle of the screen (initial x and y coordinates of the ship)
          x = SCREEN_WIDTH/2;
          y = SCREEN_HEIGHT/2;
          //set max speed to 10
          maxSpeed = 10;
     //This method resets the ship to the middle of the screen
     // with 0 speed. It is called when a ship is hit by an asteroid.
     public void reset() {
          x = SCREEN_WIDTH / 2;
          y = SCREEN_HEIGHT / 2;     
          xDir = yDir = xSpeed = ySpeed = 0;     
     //get the x position of the ship
     public int getXPos() {
          return x;
     //get the y position of the ship
     public int getYPos() {
          return y;
     //gets the height of the ship
     public int getHeight() {
          return shipHeight;
     //gets the width of the ship
     public int getWidth() {
          return shipWidth;
     //gets the visibility of the ship
     public boolean getVisibility() {
          return visible;
     //gets the x speed of the ship
     public int getXSpeed() {
          return xSpeed;
     //gets the y speed of the ship
     public int getYSpeed() {
          return ySpeed;
     //gets the max speed of the ship
     public int getMaxSpeed() {
          return maxSpeed;
     //SETTER METHODS
     //sets the x speed of the ship
     public void setXSpeed(int xs) {
          for(int i=0;i<maxSpeed.length;i++){
     //sets the y speed of the ship
     public void setYSpeed(int ys) {
     //sets the x direction of the ship
     public void setXDir(int xd) {
     //sets the y direction of the ship
     public void setYDir(int yd) {
     //sets the visibility of the ship
     public void setVisibility(boolean v) {
     //This method is called when it's time for a ship to move (caused by right click).
     //The formula for moving is in the comments below
     public void move() {
          //if xSpeed is greater than 0 (it still has x-ward momentum)
          // change x position by the "x direction" multiplied by the "x speed"
          // You may add a factor to slow down or speed up your ship movement
          // The xSpeed should be decremented by 1 so that eventually the ship will stop moving (giving
          // it the "thrust" effect)
          if(xSpeed>0) {
          //if ySpeed is greater than 0 (it still has y-ward momentum)
          // change y position by the "y direction" multiplied by the "y speed"
          // You may add a factor to slow down or speed up your ship movement
          // The ySpeed should be decremented by 1 so that eventually the ship will stop moving (giving
          // it the "thrust" effect)
          if(ySpeed>0) {
     //This method is called when a user right clicks -- you do NOT need to change this.
     //It is mean to set the x and y speeds/directions such that the ship will burst in the
     //direction of the click, and the move method slowly backs off the speed so it appears
     //like a "burst" on screen. The method's parameters contain the x and y values of the
     //mouse click on screen.
     public void thrust(int cx, int cy) {
          double run = cx - x;
          double rise = cy - y;
          int xInc, yInc;
          double shipAngle = Math.toDegrees(Math.atan(rise / run));
          if((run>0 && rise>0) || (run > 0 && rise < 0)) {
               xInc = (int) (Math.cos(Math.toRadians(shipAngle)) * (double) maxSpeed);
               yInc = (int) (Math.sin(Math.toRadians(shipAngle)) * (double) maxSpeed);
          else {
               xInc = - (int) (Math.cos(Math.toRadians(shipAngle)) * (double) maxSpeed);
               yInc = - (int) (Math.sin(Math.toRadians(shipAngle)) * (double) maxSpeed);
          xSpeed = ySpeed = maxSpeed;
          xDir = xInc;
          yDir = yInc;
************This one and one other are a mess and I have no idea what I am doing. I pretty much just put in my getter methods and did a few other things that I knew how to do... ********************************
Thank you

Sorry to harp on with the do's and don't's, but some things do elicit help and some things don't so it's relevant...
Try and say what specifically your problem is. Of course you may be completely stuck and have no idea even what the problem is, how to describe it, or which way is forward. Still it may come across as a presumption that others will wade through the teacher's comments and figure things out for you. You will do well to avoid giving the impression that you might be sitting with your feet up having dumped the homework request on the forum.
One way to avoid getting into this situation is to move: one step at a time. Carry out the teacher's instructions in just one comment. Then stop and make sure you can compile and run your code. (possibly even test that the code does the right thing!). Only once you've got one small step nailed do you go on from the beginning of this paragraph.
Just four things can go wrong with the previous paragraph:
(a) The teacher's comment makes no sense
(b) You get a compiler message
(c) You get a runtime error
(d) The code runs but does something weird
Notice how each of these four things gives rise to a very precise question. That's the point. Don't be put off by the fact that even a modest assignment may lead you to many of such questions. As you learn the frequency of puzzlement declines (although hopefully never vanishes.)
I have waded through the code (or at least glanced at it) and noticed this:
// if xSpeed is greater than 0 (it still has x-ward momentum)
// change x position by the "x direction" multiplied by the "x speed"
// You may add a factor to slow down or speed up your ship movement
// The xSpeed should be decremented by 1 so that eventually the ship will stop moving (giving
// it the "thrust" effect)Do you understand this? The idea seems to be for this method to adjust the x variable - which represents the ship's position along the x-axis.
{noformat}
Before:
                           xSpeed    xDir <-- (ie -1)
                          <--------->
  O.......................SHIP
                          x
After:
                 xSpeed   xDir <-- (ie -1)
                <------>
  O.............SHIP
                x
{noformat}Take the xSpeed represented by <--------> and multiply it by xDir which functions as the "heading". In the case illustrated xDir is -1 which means the ship is heading leftwards. Once we have multiplied these thing together we simply add the result to x to find the new value for x.
{noformat}
Before:
                    xSpeed * xDir
                <---------
  O.......................SHIP
                .         x
After:          .
                 xSpeed   xDir <-- (ie -1)
                <----->
  O.............SHIP
                x
{noformat}Notice how the speed is smaller after the move: because the ship is slowing down. The instructions say to subtract one from the speed to achieve this.
The code for this - multiplying the speed and heading and adding the result to the position, then subtracting one from the speed - goes in the first if statement of the move() method.
Edited by: pbrockway2 on May 2, 2009 12:45 PM

Similar Messages

  • Have 2 or more fill in the blank on one slide

    How is it possible to have 2 or more fill in the blank options in Captivate 8?
    I have seen posts on here that link to now closed websites.  If anyone could give some advice I would appreciate it hugely.
    Thanks

    Thanks for that I'm very thankful.
    Do you know if its possible to create a GIFT file which allows an import of 2 FITB fields?

  • Fill in the Blank Problem

    Alright, I'm new to captivate and all that, but I have a slight problem with fill in the blank quizes that I can't seem to figure out. What I want to do is create fill in the blank quiz questions that already have an incorrect answer in the blank that, after a user attempts to answer the question, returns to the original incorrect answer. So, for instance, if I had a fill in the blank that read "(Cats) go woof woof" where the parentheses represent the blank, I would want 'Cats' to reappear after a user incorrectly filled in that blank. As it is, it seems to keep the user text. I've tried checking and unchecking the retain text button in options, but that doesn't seem to do it. Any help would be much appreciated.

    Re-reading the question, I realize I may not being clear? I want the example text in a text entry box to re-appear after a user types in an answer and is given the failure or success message. Not possible? Thanks in advance.

  • How can I make a fill-in-the-blank question with partial score?

    I need to make an evaluation test with some questions. Some of them is a fill-in-the-blank question and it has to have partial score.
    I have:
    4 fields (text entry boxes) with: retain text, validate user input;
    also checked include in quiz, with points, add to total and report answers;
    an action that disables the 4 fields when the student is on review mode (otherwise it would be possible to change the answer after submitting the answers);
    Problems:
    I can't give feddback to the student: if i turn on success/failure captions the student will see them while answering, if i turn them off he wont know what's the right answer. I tried to use a shape to hide captions but the captions are always in front of the shape;
    When reviewing the test something happens and the second time we see the results slide it assumes that the fields in the FIB question are empty;
    Notes: it will be used in Moodle, as a scorm package
    What can I do?

    I have a test with some questions (multiple choice, FIB, matching, etc). I have just one button to submit all the answers, and after submiting the student can see his score and review the test to know where he failed. He can't answer again. However, he can change the answer multiple times before submiting.
    "if i turn on success/failure captions the student will see them while answering" - before submitting
    "if i turn them off he wont know what's the right answer" - after submitting
    My results page is the default. I didn't use any variable. When i go to the results page after reviewing the test all the entry boxes are "wrong".

  • How do I create a "fill-in-the-blanks" worksheet?

    I am a teacher that works with students who have various needs - some of them have a difficult time writing with a pencil. There are tons of great teacher resources out there that I can print and use for students to write on. However online worksheets are another story. I came across the idea of using AdobeForms as an adaptation to writing.
    For example...
    Yesterday was _____________________. Tomorrow will be _________________.
    Or even:
    My n__me is _____________.
    Can anyone help me? Right now the only way I can do a fill in the blank is to have a field below a blurb of text, but I don't know how to do a field in between text.
    Help!

    If I were doing this I wouldn't use FormsCentral. I would create the layout in InDesign or a word processor and convert to PDF using Acrobat. I'd then add the form fields in Acrobat where the blank spaces are. You can limit the number of characters in a field and a lot more. Do you have Acrobat available to you? If not another option is to use the free OpenOffice /NeoOffice and create your layout and form fields and then export to PDF.

  • Fill-In-The-Blank drop down space issue

    Hi,
    I have Captivate 7 and am putting in a number of Fill-In-The-Blank quiz questions and using the drop down but when the user makes the selection, not all the words are shown, it cuts off the last few letters and in some cases where I have a one character you can't see any of the answer.
    Any ways around this? (Other than not using one character)

    Do you need scoring? There is a Scrolling Text interaction (more control, you can empty the variable and it will be displayed empty) but it is a non-interactive one, no score possible except by adding other interactive objects.
    Custom Short Answer Question - Captivate blog

  • Fill-In-The-Blank drop-down list in HTML5 output

    I'm working in Captivate 7 (WIN) and developing for both SWF and HTML5 output, viewing courses in IE9 for Windows and Safari on iPad.
    I have a quiz containing a fill-in-the-blank question, using a drop-down list to select the correct answer, however it does not display the drop-down button or function correctly in HTML5 output (see screenshot).
    The issue began after updating to Captivate 7 version 7.0.1.237. The drop-down list worked prior to the update I installed recently. I'm viewing the published course locally and in the LMS, and it does not work in either.
    I've not read in the help documents that drop-down list questions are an unsupported question type in HTML5, and so I'm wondering if this is a bug that needs to be reported. Has anyone encountered this issue?

    Do you need scoring? There is a Scrolling Text interaction (more control, you can empty the variable and it will be displayed empty) but it is a non-interactive one, no score possible except by adding other interactive objects.
    Custom Short Answer Question - Captivate blog

  • Using wild card with Captivate 5 ( fill in the blank)

    I am training software package that requires many fill in the blanks besides the login screeen.  If I were to recording the actions using Captivate 5 record, I think,  I can only use a demonstration recording as oppsed to having my students interact with the product by filling in the blank. For example, my product asks for a login. When I login to demonstrate how it should be done, the product reponds correctly.  By my student is limited to watching as opposed to interacting.  While login is not such a big deal, there are several other areas where the same concept applies.  Ideally, I wish to use wild cards in fill in the blank so that any name or information can be used to interact with Captivate and move the slide along.    Is this possible, and if so, how?

    I think Lilybiri may be misinterpreting your use of the term "wildcards" to mean using them in the programming sense.
    Perhaps you are referring to the characters that appear in a typical Password field to hide what the user is actually typing?
    If so, the text field object in Captivate has an option to use these password characters so that the user's typing characters are hidden.  The characters used are asterisks, which are what some people refer to as wildcard characters.

  • Please help me fill in the blank

    Our own �innovative� Chunk Sort algorithm is designed for sorting arrays that consist of a few presorted chunks. The idea is to find the next chunk and merge it with the already sorted beginning segment of the array. We will implement this algorithm iteratively, without recursion.
         Fill in the blanks in the following merge method:
    * Precondition: 0 <= m <= n
    * m == 0 or a[0] <= ... <= a[m-1]
    * n == m or a[m] <= ... <= a[n-1]
    * Postcondition: the values a[0] .. a[n-1] are arranged
    * in the ascending order
    private static void merge(int a[], int m, int n)
    // If any of the two segments is empty, do nothing:
    int i = 0, j = m; // starting indices into the two segments
    // Allocate a temporary array temp to hold n elements
    int k = 0; // starting index into the temporary array
    while (i < m && j < n)
    if ( ______________________ )
    else
    k++;
    // Copy remaining elements:
    while (i < m)
    k++;
    while (j < n)
    k++;
    // Copy temp back to a:
    for ( _____________________________________ )

    Your teacher needs to teach you to Teach
    Yourself[b]. People can't always tell you the answer
    to everything. There comes a time in life when you
    just have to break down and fire up that brain cell.
    Not quite, you need at least two neurones to make a synapse. Unless, we talking about extrapyramidal pathways. Then termination on peripheral skeletal muscle is what is going on. Certainly, that is required in this case as the OP doesn't appear motivated enough to pick up a book.

  • Cannot 'Unmark Blank' for FIB Questions after Upgrade from CP4 to CP5 (Fill in the Blank)

    Hi Everyone!
    I'm having trouble editing a fill in the blank question that was upgraded from CP4 to CP5.
    The problems is I cannot see where the blank is.  Not the blank in my sentence, I have that, but the entry box. When running the course the blanks are at the TOP LEFT corner fo the slide.
    but when creating the course I can't see where the blanks are, to move them.....
    So to Troubleshoot, I thought I'd re-construct the answers, I clicked the sentence, and clicked unmark ... but it does not unmark....
    <EDIT> Okay I got it to unmark, sorta, but not really. Now I have three answer boxes on the test in run mode, but cant see ANY in CP5 when building it. </EDIT>
    Hmmmmm
    Anyone got ideas?
    (re-constructing the question on a new slide is not desired, I have hundres of questions, considering my 30 courses.
    Thank you!
    Greg

    Hello,
    Sorry, but I do not understand your question quite well, it is an editing issue when upgrading. Perhaps it would help if you posted some screenshots?
    And to be sure: did you install the patch for CP5 released in December?
    Lilybiri

  • Issue with fill in the blank field and back button.

    I am working in CP4 AS2.  I have create a page of fill in the blank fields to simulate filling in a form.  On the next slide, I show the answers by extracting the variables into text boxes.  I have a back and a next button and instruct the user to review their answers and if incorrect, to select the back button in order to reenter the data.  I have the back button set to jump to the previous slide by number (i've tried previous, last slide, etc...)
    The flash movie freezes when I select the back button.  I think flash is having trouble going back to the fill in the blank fields from the displayed variables.  Any ideas? or work arounds for this.  The idea solution would take them back to the page with the data already in the fields so they could correct the errors only and then return to the review page.
    Thanks
    Scott

    Hi there
    Is scoring enabled on these? If so, perhaps your quiz settings are preventing backward movement.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Two fill-in-the-blank answers from same list.

    I have a quiz question that is fill in the blank, two separate blanks.  The list of answers is exactly the same.  How do I insure that the learner does not use the same answer for both blank.  Example:  List two drinks that taste good to drink: 1. _________  2. __________   and the list is "coke, pepsi, Dr. Pepper, Sprite".  How do I make sure the learner does not list coke twice?
    I have Captivate 6......thanks 

    I do not think this will be possible with the default FIB slide. I would create a custom question slide, using either TEB's or TextArea widget for the 'blanks'. Then you'll be able to check the content of each of the variables that are associated with them, using an advanced conditional action.
    Lilybiri

  • Changing font / appearance of Fill-in-the-blank questions

    1) I am using a Fill-in-the-blank question. I can change the
    font of the name and the description, but not of the Blank Answers
    themselves. I figure this should be possible, since these are
    basically text entry boxes (or drop down lists if you select the
    list option). Is there a way to do this? Perhaps an option I
    missed, or with a Javascript code that modifies some system
    variables, or some other way?
    2) Also, how can I get rid of the numbering in front of the
    Blank Answers that Captivate generates? Is there a way to do this
    (an option I missed, Javascript, or whatever)? I even tried to
    cover them up with a highlight box, but Captivate does not allow me
    to bring the highlight box in front in z-order.
    Surely, you wonder why would I want to do this, especially
    #2. One really useful example would be to embed the Blank Answers
    in the Phrase itself. Example:
    The <1> and the <2> are the two longest rivers on
    earth.
    1. __________
    2. __________
    By adding some blanks in the Phrase and moving around the
    Blank Answers, this could be turned into:
    The __________ and the __________ are the two longest rivers
    on earth.
    I would think that many would consider the second version
    more appealing.
    In addition, this would open other possible uses for
    Fill-in-the-blank questions. For example, consider a table or
    spreadsheet like setting where each Blank Answer is actually a
    cell. The user fills in the cells, and all entries are evaluated
    when the user submits.

    I guess the best response would be generate the
    Fill-In-The-Blank question as Captivate requires. After it creates
    the questions slide, double click on the text box you wish to edit.
    For example, when you publish your question "The <1>
    and the <2> are the two longest rivers on earth.", this will
    appear as a text box on the screen. Double click it to edit and
    change "<1>" and "<2>" to "___________".
    You should also be able to edit your answer boxes in this
    manner as well.
    HTH
    Jim

  • Fill In The Blank / Sequence Questions

    Is it possible to have a fill in the blank question in captivate (4 or 5) that is scored according to how many options the user got correct?
    For example:
    If you use 4 grams of 'b' you will need _____ grams of 'x', _____ grams of 'y' and ____ grams of 'z' to complete the forumula.
    In this example if they answered all 3 blanks correctly they would get 3 points, 2 correct answers would give them 2 points and so on.
    Also, is it possible to  score sequence questions according to how many items were correctly sequenced?

    Hello,
    For the moment partial scoring (as I'm calling it) is not possible in Captivate, at least not in the included Question slides. If you want that feature, and you are certainly not alone, please fill in a Feature Request to get this feature on the priority list of the Adobe team.
    If you do not mind the work, it is possible to create question slides yourself using the available objects, user variables and advanced actions. I wrote several articles and blogged about those workarounds, one of them is about creating question slides with possibility for partial scoring (it is not a FIB-question but the principles are the same):
    Question slide with partial score
    Lilybiri

  • Fill in the Blank Options

    When editing a fill in the blank there is a pull down in the top left of the correct answers box when it is setup as a user enters the correct answer. When I change the selection and close  the box the pull down slections update for a reason I don't understand either. Lastly, when I have two blanks in the same question, the pull down will show the first correct answer form each blank.
    What does all this mean?

    Hello There,
    If you have multiple blanks in a question, this pull down helps you to change the answer for other blanks as well by quickly changing the option. And yes, when we have multiple correct answers, the blank shows the first correct answer.
    Hope this info helps.
    Thanks,
    Vish

  • Fill in the blank and advanced actions

    Hi everyone,
    I'm wondering whether this can be accomplished with fill in the blanks standard quiz question or whether I need use Advanced Actions.
    I have a graphic of a form that needs to be correctly filled out with specific values. There are multiple fields on each graphic/slide. I want all fields to be filled in correctly to get the question (slide) correct. I also want to be able to adjust to fields to have an invisible border and no inset so they are invisible on top of the the graphic.
    Is this possible using a standard fill in the blank question slide (I couldn't really figure it out) or is this something that I should be looking at Advanced Actions to accomplish? If Advanced Actions will be required, does anyone have an example?
    I appreciate the assistance!

    Hello,
    With the default FIB you are a bit limited especially concerning the field to be filled in. Advanced actions will give you more control. Would need some more details, but I did blog about constructing all kinds of questions. Here is one link to a post that has a FIB question:
    Extended TextArea widget for custom questions
    This will not be exactly what you are looking for, but perhaps give you some idea about what is possible. Are you familiar with advanced actions?
    Lilybiri

Maybe you are looking for

  • MBP 10.8.2 with external display freeze on wake up.

    The external screen is black, when i open the lid the mouse pointer is in "thinking" mode, and i can't do anything but power off/on. Any help will be appreciated.

  • Netting logic for BI Query

    Hi, Presently my Query output is as follows : CurrPair     Buy Curr     Sale Curr     Amount(USD) USD/INR       USD       INR       100 USD/INR       INR       USD       125 We have to take the Absolute value of the difference of both the Amounts and

  • Unlock button stuck

    I am having problems with the lock button it is stuck and won't slide.....i tried rebooting the phone several times and it does not work!   Any suggestions/ideas?  Thanks

  • Boolean always returning false;

    Ok so i have this public static boolean testAuth(){           try{                BufferedReader authReader = new BufferedReader(new FileReader("auth.txt"));                String auth = authReader.readLine();                authReader.close();      

  • HT201210 I am trying to install the iOS 6 but keep getting an error message what is wrong

    I'am trying to update my iPad with ios6 but it keeps showing an error message, how do I fix this problem?